0% found this document useful (0 votes)
10 views10 pages

Innodb Cluster Configuration

The document outlines the steps to install and configure MySQL on three nodes, including the installation of MySQL Shell and Router. It details the creation of an InnoDB cluster, adding nodes to the cluster, and configuring the router for routing operations. Additionally, it provides commands for checking cluster status and managing connections for read/write operations across the nodes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views10 pages

Innodb Cluster Configuration

The document outlines the steps to install and configure MySQL on three nodes, including the installation of MySQL Shell and Router. It details the creation of an InnoDB cluster, adding nodes to the cluster, and configuring the router for routing operations. Additionally, it provides commands for checking cluster status and managing connections for read/write operations across the nodes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Dost Muhammad Khalil

[email protected]
+92 311 4848475
Node1: 192.168.231.182 node1

Node2: 192.168.231.186 node2

Node3: 192.168.231.183 node3

##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

##Starting MySQL on each node and verify the status.


Dost Muhammad Khalil
[email protected]
+92 311 4848475

##Now Installing MySQL Shell on each Node.

rpm -ivh mysql-shell-commercial-8.0.38-1.1.el9.x86_64.rpm ##This will install mysql shell utility.

##Now Connecting to mysqlsh on Node1

mysqlsh ##This will take you to mysql shell interface.

MySQL JS > \connect root@localhost ##This will connect to root user on mysql.

##Configuring MySQL Instance for Innodb Cluster on all three nodes

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.

MySQL localhost:33060+ ssl JS > dba.configureLocalInstance()

##Select the below option

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.

##Configuring Innodb Cluster

##connect to newly created user in my case it was ic user.

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

##Checking Status of Created Cluster

##Adding Node2 and Node3 to the cluster.

##Run the following commands on node one in mysqlsh.

MySQL localhost:33060+ ssl JS > dba.getCluster().addInstance('[email protected]'); ##Adding node 2 to cluster


Dost Muhammad Khalil
[email protected]
+92 311 4848475
MySQL localhost:33060+ ssl JS > dba.getCluster().addInstance('[email protected]'); ##Adding node 3 to cluster

## 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.

MySQL localhost:33060+ ssl JS > dba.getCluster().status()


Dost Muhammad Khalil
[email protected]
+92 311 4848475

##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

yum install -y mysql-router-commercial-8.0.39-1.1.el9.x86_64 ##This will install router on the node.


Dost Muhammad Khalil
[email protected]
+92 311 4848475

## 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.

mysqlrouter --bootstrap [email protected]:3306 --directory /root/data --user=root


Dost Muhammad Khalil
[email protected]
+92 311 4848475

##Starting mysql router and check verify.

##Now Installing MySQL client on router node just for verifying the connection with the cluster.

yum install -y mysql-commercial-client-plugins-8.0.39-1.1.el9.x86_64.rpm

## MySQL Classic protocol

- Read/Write Connections: localhost:6446

- Read/Only Connections: localhost:6447

##Our Current Read,Write node is NODE2

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

##Now connecting to Secondary node for read only operation.

##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.configureInstance('ic@localhost') ##This will configure cluster using the pre-existing user.

dba.dropMetadataSchema()

STOP GROUP_REPLICATION;

CHANGE REPLICATION SOURCE TO SOURCE_HOST=' ';

RESET SLAVE ALL;

RESET MASTER;

RESET REPLICA ALL;

You might also like