Innodb Cluster Configuration
Innodb Cluster Configuration
[email protected]
+92 311 4848475
Node1: 192.168.231.182 node1
##Install MySQL on all three nodes. In the previous screenshot I have run the command and it successfully run because I
have already downloaded and configured the corresponding repository which contains the necessary rpms.
yum install -y mysql-commercial-server* ##This will install all the necessary packages for MySQL
MySQL JS > \connect root@localhost ##This will connect to root user on mysql.
On mysqlsh prompt run the below command it will ask you for creating new user which can connect from anywhere and
has privlliges to manage innodb cluster so just go for that.
2) Create a new admin account for InnoDB cluster with minimal required grants
Dost Muhammad Khalil
[email protected]
+92 311 4848475
##After selecting the option 2 you will be prompt for some changes just type y and then again y for server restart so that
the changes persist.
MySQL localhost:33060+ ssl JS > dba.createCluster('DMK-Cluster') ##This will create cluster with the given name.
Dost Muhammad Khalil
[email protected]
+92 311 4848475
## I choose Clone option because I was adding a full fresh mysql which didn’t have any data if the instance was removed
previously from the cluster and then added after some time then it is better to chose incremental option.
##Run the below command on Node 1 to check for the status of cluster.
##As can be seen all the 3 nodes are running Node1 is Primary and open for read,write while Node2 and Node3 are
Secondry which are open for Read only.
##Connect to MySQL on Node1 and create a schema and verify it is created on all the secondry nodes.
## Now Configuring Router on another machine, the router will route the write operations to primary and
## Run the below command on router node and make sure the directory /root/data is already created because router
will use this directory to store its configuration files.
##Now Installing MySQL client on router node just for verifying the connection with the cluster.
mysql -h127.0.0.1 -P 6446 -u ic -p'Cluster123#' ##This will connect the client to read,write node NODE2
Dost Muhammad Khalil
[email protected]
+92 311 4848475
##It should be noted that if we have multi secondry then router will decide to which node the read only connection will
be made in our case it is made to NODE1 as can be seen in the above screen shot.
Dost Muhammad Khalil
[email protected]
+92 311 4848475
## Logs related to router can be checked from “/root/data/log/mysqlrouter.log”
Points:
1. If the primary Node goes down, router will automatically route the existing and new connections to the next
primary which.
dba.getCluster().resetRecoveryAccountsPassword() ##This will reset the passwords for cluster recovery users.
Make sure all the innodb nodes are online while performing this operation else there will be inconsistency.
dba.dropMetadataSchema()
STOP GROUP_REPLICATION;
RESET MASTER;