Incorrect GRANTS with mysql-router colocated with mysql-innodb-cluster
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL Router Charm |
New
|
Undecided
|
Unassigned |
Bug Description
Hi!
I'm trying to deploy vault HA colocated with MySQl on Focal and having a problem with mysql router charm on 1 of the 3 units that can't connect to mysql server, because the host is incorrect:
$ juju status
Model Controller Cloud/Region Version SLA Timestamp
k8s-1 k8s-shared-
App Version Status Scale Charm Store Rev OS Notes
hacluster-vault active 3 hacluster jujucharms 76 ubuntu
mysql 8.0.25 active 3 mysql-innodb-
vault 1.5.4 blocked 3 vault jujucharms 44 ubuntu
vault-mysql-router 8.0.25 waiting 3 mysql-router jujucharms 6 ubuntu
Unit Workload Agent Machine Public address Ports Message
mysql/0* active idle 0 10.254.9.205 Unit is ready: Mode: R/W, Cluster is ONLINE and can tolerate up to ONE failure.
mysql/1 active idle 1 10.254.9.183 Unit is ready: Mode: R/O, Cluster is ONLINE and can tolerate up to ONE failure.
mysql/2 active idle 2 10.254.9.229 Unit is ready: Mode: R/O, Cluster is ONLINE and can tolerate up to ONE failure.
vault/0* waiting idle 0 10.254.9.205 'shared-db' incomplete
hacluster-vault/2 active idle 10.254.9.205 Unit is ready and clustered
vault-
vault/1 blocked idle 1 10.254.9.183 8200/tcp Vault needs to be initialized
hacluster-
vault-
vault/2 blocked idle 2 10.254.9.229 8200/tcp Vault needs to be initialized
hacluster-vault/1 active idle 10.254.9.229 Unit is ready and clustered
vault-
Machine State DNS Inst id Series AZ Message
0 started 10.254.9.205 2a055bef-
1 started 10.254.9.183 9165b15a-
2 started 10.254.9.229 186e474c-
Logging in to the mysql cluster and listing the users we see:
mysql> select * from user where user='vault';
+------
| Host | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_
+------
| 10.254.9.183 | vault | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | NULL | NULL | NULL | 0 | 0 | 0 | 0 | caching_
| 10.254.9.229 | vault | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | NULL | NULL | NULL | 0 | 0 | 0 | 0 | caching_
+------
2 rows in set (0.00 sec)
mysql> select * from user where user='mysqlrout
+------
| Host | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_
+------
| 10.254.9.183 | mysqlrouteruser | N | N | N | N | N | N | N | N | N | N | Y | N | N | N | N | N | N | N | N | N | N | N | N | N | N | Y | N | N | N | | NULL | NULL |p_)/|D | 0 | 0 | 0 | 0 | caching_
SQesV5Ueg70RX6R
| 10.254.9.229 | mysqlrouteruser | N | N | N | N | N | N | N | N | N | N | Y | N | N | N | N | N | N | N | N | N | N | N | N | N | N | Y | N | N | N | | NULL | NULL | NULL | 0 | 0 | 0 | 0 | caching_
| 127.0.0.1 | mysqlrouteruser | N | N | N | N | N | N | N | N | N | N | Y | N | N | N | N | N | N | N | N | N | N | N | N | N | N | Y | N | N | N | | NULL | NULL |WkK%4o?/▒eHd ZSvswq4V8QvZUZ9
+------
3 rows in set (0.01 sec)
mysql> SHOW GRANTS FOR 'mysqlrouteruse
+------
| Grants for mysqlrouteruser
+------
| GRANT CREATE USER ON *.* TO `mysqlrouteruse
| GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE ON `mysql_
| GRANT SELECT ON `mysql`.`user` TO `mysqlrouteruse
| GRANT SELECT ON `performance_
| GRANT SELECT ON `performance_
| GRANT SELECT ON `performance_
+------
6 rows in set (0.00 sec)
The problematic user seems to be the 'mysqlrouteruse
$ tail unit-vault-
2021-06-24 16:59:03 ERROR juju-log Failed to bootstrap mysqlrouter: Error: Unable to connect to the metadata server: Error connecting to MySQL server at 10.254.9.205:0: Access denied for user 'mysqlrouteruse
Other units of vault-mysql-router are fine.
It looks like mysql router created mysql user incorrectly to access the local mysql and that blocked the deployment. See also the similar issue for the percona-cluster charm: https:/
Perhaps https:/
Attached the bundle to reproduce the issue.