Bug #71512 Servers in the same group should use a single user/password
Submitted: 29 Jan 2014 15:34 Modified: 28 Feb 2014 8:05
Reporter: Alfranio Junior Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Fabric Severity:S3 (Non-critical)
Version:1.4.0 OS:Any
Assigned to: Alfranio Junior CPU Architecture:Any

[29 Jan 2014 15:34] Alfranio Junior
Description:
Fabric requires to provide a user/password when a server is added to a group. This makes the configuration process error prone as this user must also have replication privileges at all servers that are member of the same group.

For example,

mysqlfabric group create my_group
mysqlfabric group add my_group server_1 user_1 passwd_1
mysqlfabric group add my_group server_2 user_2 passwd_2

At server_1:
GRANT SUPER,... *.* TO 'user_1'@'localhost';
GRANT REPLICATION SLAVE *.* TO 'user_2'@'localhost';
...

At server_2:
GRANT SUPER, ... *.* TO 'user_2'@'localhost';
GRANT REPLICATION SLAVE *.* TO 'user_1'@'localhost';
...

In order to ease the addition of a server into a group and avoid possible configuration mistakes and errors, Fabric should require/assume a common user among all servers in a group.

mysqlfabric group create my_group user passwd
mysqlfabric group add my_group server_1
mysqlfabric group add my_group server_2

At server_1:
GRANT SUPER, ... *.* TO 'user_1'@'localhost';

At server_2:
GRANT SUPER, ... *.* TO 'user_2'@'localhost';

How to repeat:
Check the code.

Suggested fix:
Assign user/password to the group and not to the server.
[20 Feb 2014 12:31] Alfranio Junior
Posted by developer:
 
Fabric requires to provide a user/password when a server is added to a group.
This makes the configuration process error prone as this user must also have
replication privileges at all servers that are member of the same group.
  
In order to ease the addition of a server into a group and avoid possible
configuration mistakes and errors, Fabric should require/assume a common user
for servers in a group or shard definition and when those are not defined, it
should use a global user/password.
  
In this patch, we introduce a global user/password and will consider the
other alternatives in the context of another bug or worklog. User and
password are defined in the "configuration file" in the section "servers".

After this patch the following commands are affected:
  
- mysqlfabric group add "group" "host:port"
  . user/password was removed from the list of parameters
  
- mysqlfabric group import_topology "group-pattern" "description" "host:port"
  . user/password was removed from the list of parameters
  
- mysqlfabric server lookup_uuid "host:port"
  . user/password was removed from the list of parameters
  
We also took the opportunity to improve the ./lib/mysql/fabric/services/server.py
file and the returned values in the following functions:
  
- mysqlfabric group lookup_servers "group" --uuid=uuid
  . List with servers' info:
    [{"server_uuid" : uuid, "address" : address,
     "status" : status, "mode" : mode, "weight" : weight},
     {...}, ... 
    ]
  
- mysqlfabric group lookup_groups --group_id=group_id
  . List with groups' info:
    [{"group_id" : group_id, "description" : description,
     "master_uuid" : master_uuid, "failure_detector" : True/False},
     {...}, ...
    ]
[28 Feb 2014 8:05] Philip Olson
Fixed as of the upcoming MySQL Utilities 1.4.2 release, and here's the changelog entry:

With Fabric, group definitions now use a single (global) username and
password, instead of requiring a username/password for each MySQL server as they
were added to the group.

Thank you for the bug report.