MySQL InnoDB HA Cluster 8 1722158261
MySQL InnoDB HA Cluster 8 1722158261
mysql80-community-release-el8-3.noarch.rpm
100%[==========================================================================================
==================================================================>] 13.77K --.-KB/s in 0s
Last metadata expiration check: 0:59:32 ago on Mon 03 Apr 2023 02:59:01 PM EDT.
Dependencies resolved.
===============================================================================================
===============================================================================================
=========================================================================
Package Architecture
Version Repository
Size
===============================================================================================
===============================================================================================
=========================================================================
Installing:
mysql80-community-release noarch
el8-3 @commandline
14 k
Transaction Summary
===============================================================================================
===============================================================================================
=========================================================================
Install 1 Package
Total size: 14 k
Downloading Packages:
Running transaction
Preparing :
1/1
Installing : mysql80-community-release-el8-3.noarch
1/1
Verifying : mysql80-community-release-el8-3.noarch
1/1
Installed:
Mysql80-community-release-el8-3.noarch
Complete!
Dependencies resolved.
===============================================================================================
===============================================================================================
=========================================================================
Package Architecture
Version Repository
Size
===============================================================================================
===============================================================================================
=========================================================================
Disabling modules:
Mysql
Transaction Summary
===============================================================================================
===============================================================================================
=========================================================================
Is this ok [y/N]: y
Complete!
Last metadata expiration check: 0:00:12 ago on Mon 03 Apr 2023 04:00:59 PM EDT.
Dependencies resolved.
===============================================================================================
===============================================================================================
=========================================================================
Package Architecture
Version Repository
Size
===============================================================================================
===============================================================================================
=========================================================================
Installing:
mysql-community-server x86_64
8.0.32-1.el8 mysql80-community
64 M
Installing dependencies:
mysql-community-client x86_64
8.0.32-1.el8 mysql80-community
16 M
mysql-community-client-plugins x86_64
8.0.32-1.el8 mysql80-community
2.5 M
mysql-community-common x86_64
8.0.32-1.el8 mysql80-community
656 k
mysql-community-icu-data-files x86_64
8.0.32-1.el8 mysql80-community
2.1 M
mysql-community-libs x86_64
8.0.32-1.el8 mysql80-community
1.5 M
Transaction Summary
===============================================================================================
===============================================================================================
=========================================================================
Install 6 Packages
Downloading Packages:
(1/6): mysql-community-client-plugins-8.0.32-1.el8.x86_64.rpm
4.7 MB/s | 2.5 MB 00:00
(2/6): mysql-community-icu-data-files-8.0.32-1.el8.x86_64.rpm
6.7 MB/s | 2.1 MB 00:00
(3/6): mysql-community-common-8.0.32-1.el8.x86_64.rpm
633 kB/s | 656 kB 00:01
(4/6): mysql-community-libs-8.0.32-1.el8.x86_64.rpm
7.2 MB/s | 1.5 MB 00:00
(5/6): mysql-community-client-8.0.32-1.el8.x86_64.rpm
6.3 MB/s | 16 MB 00:02
(6/6): mysql-community-server-8.0.32-1.el8.x86_64.rpm
12 MB/s | 64 MB 00:05
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-------------------------------------------------------------------------
Total
14 MB/s | 87 MB 00:06
Fingerprint: 859B E8D7 C586 F538 430B 19C2 467B 942D 3A79 BD29
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Key imported successfully
Fingerprint: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction
Preparing :
1/1
Installing : mysql-community-common-8.0.32-1.el8.x86_64
1/7
Installing : mysql-community-client-plugins-8.0.32-1.el8.x86_64
2/7
Installing : mysql-community-libs-8.0.32-1.el8.x86_64
3/7
Installing : mysql-community-client-8.0.32-1.el8.x86_64
4/7
Installing : mysql-community-icu-data-files-8.0.32-1.el8.x86_64
5/7
Installing : mysql-community-server-8.0.32-1.el8.x86_64
6/7
Obsoleting : mariadb-connector-c-config-3.1.11-2.el8_3.noarch
7/7
Verifying : mysql-community-client-8.0.32-1.el8.x86_64
1/7
Verifying : mysql-community-client-plugins-8.0.32-1.el8.x86_64
2/7
Verifying : mysql-community-common-8.0.32-1.el8.x86_64
3/7
Verifying : mysql-community-icu-data-files-8.0.32-1.el8.x86_64
4/7
Verifying : mysql-community-libs-8.0.32-1.el8.x86_64
5/7
Verifying : mysql-community-server-8.0.32-1.el8.x86_64
6/7
Verifying : mariadb-connector-c-config-3.1.11-2.el8_3.noarch
7/7
Installed:
mysql-community-client-8.0.32-1.el8.x86_64 mysql-community-client-plugins-8.0.32-
1.el8.x86_64 mysql-community-common-8.0.32-1.el8.x86_64 mysql-community-icu-data-
files-8.0.32-1.el8.x86_64 mysql-community-libs-8.0.32-1.el8.x86_64
mysql-community-server-8.0.32-1.el8.x86_64
Complete!
Last metadata expiration check: 0:02:55 ago on Mon 03 Apr 2023 04:00:59 PM EDT.
Dependencies resolved.
===============================================================================================
===============================================================================================
=========================================================================
Package Architecture
Version Repository
Size
===============================================================================================
===============================================================================================
=========================================================================
Installing:
mysql-shell x86_64
8.0.32-1.el8 mysql-tools-
community 23 M
Installing dependencies:
python39-libs x86_64
3.9.16-1.module_el8.8.0+1243+5f5a1e61 appstream
8.2 M
python39-pip-wheel noarch
20.2.4-7.module_el8.7.0+1213+291b6551 appstream
1.1 M
python39-setuptools-wheel noarch
50.3.2-4.module_el8.6.0+930+10acc06f appstream
497 k
python39 x86_64
3.9.16-1.module_el8.8.0+1243+5f5a1e61 appstream
33 k
python39-pip noarch
20.2.4-7.module_el8.7.0+1213+291b6551 appstream
1.9 M
python39-setuptools noarch
50.3.2-4.module_el8.6.0+930+10acc06f appstream
871 k
python39
3.9
Transaction Summary
===============================================================================================
===============================================================================================
=========================================================================
Install 7 Packages
Downloading Packages:
(1/7): python39-3.9.16-1.module_el8.8.0+1243+5f5a1e61.x86_64.rpm
67 kB/s | 33 kB 00:00
(2/7): python39-pip-20.2.4-7.module_el8.7.0+1213+291b6551.noarch.rpm
1.2 MB/s | 1.9 MB 00:01
(3/7): python39-libs-3.9.16-1.module_el8.8.0+1243+5f5a1e61.x86_64.rpm
5.1 MB/s | 8.2 MB 00:01
(4/7): python39-setuptools-50.3.2-4.module_el8.6.0+930+10acc06f.noarch.rpm
1.0 MB/s | 871 kB 00:00
(5/7): mysql-shell-8.0.32-1.el8.x86_64.rpm
11 MB/s | 23 MB 00:02
(6/7): python39-setuptools-wheel-50.3.2-4.module_el8.6.0+930+10acc06f.noarch.rpm
148 kB/s | 497 kB 00:03
(7/7): python39-pip-wheel-20.2.4-7.module_el8.7.0+1213+291b6551.noarch.rpm
202 kB/s | 1.1 MB 00:05
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-------------------------------------------------------------------------
Total
5.6 MB/s | 35 MB 00:06
Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Running transaction
Preparing :
1/1
Installing : python39-setuptools-wheel-50.3.2-4.module_el8.6.0+930+10acc06f.noarch
1/7
Installing : python39-pip-wheel-20.2.4-7.module_el8.7.0+1213+291b6551.noarch
2/7
Installing : python39-libs-3.9.16-1.module_el8.8.0+1243+5f5a1e61.x86_64
3/7
Installing : python39-3.9.16-1.module_el8.8.0+1243+5f5a1e61.x86_64
4/7
Installing : python39-setuptools-50.3.2-4.module_el8.6.0+930+10acc06f.noarch
5/7
Installing : python39-pip-20.2.4-7.module_el8.7.0+1213+291b6551.noarch
6/7
Installing : mysql-shell-8.0.32-1.el8.x86_64
7/7
Verifying : python39-3.9.16-1.module_el8.8.0+1243+5f5a1e61.x86_64
1/7
Verifying : python39-libs-3.9.16-1.module_el8.8.0+1243+5f5a1e61.x86_64
2/7
Verifying : python39-pip-20.2.4-7.module_el8.7.0+1213+291b6551.noarch
3/7
Verifying : python39-pip-wheel-20.2.4-7.module_el8.7.0+1213+291b6551.noarch
4/7
Verifying : python39-setuptools-50.3.2-4.module_el8.6.0+930+10acc06f.noarch
5/7
Verifying : python39-setuptools-wheel-50.3.2-4.module_el8.6.0+930+10acc06f.noarch
6/7
Verifying : mysql-shell-8.0.32-1.el8.x86_64
7/7
[client]
Installed:
mysql-shell-8.0.32-1.el8.x86_64 python39-3.9.16-
1.module_el8.8.0+1243+5f5a1e61.x86_64 python39-libs-3.9.16-
1.module_el8.8.0+1243+5f5a1e61.x86_64 python39-pip-20.2.4-
7.module_el8.7.0+1213+291b6551.noarch
python39-pip-wheel-20.2.4-7.module_el8.7.0+1213+291b6551.noarch python39-setuptools-50.3.2-
4.module_el8.6.0+930+10acc06f.noarch python39-setuptools-wheel-50.3.2-
4.module_el8.6.0+930+10acc06f.noarch
Complete!
Step 3 Add the domains and IPs in the /etc/hosts
This step is not mandatory, the domains could be resolvable through the DNS,
but domains in the /etc/hosts are faster resolved with only local for the
system lookup. In fact, using /etc/hosts for the cluster domain names the IPs
may be different in the different nodes, but this setup is more complex is
beyond this article’s scope
192.168.87.187 innodb1
192.168.87.188 innodb2
192.168.87.189 innodb3
192.168.87.91 haproxy
Tune the MySQL generic and some InnoDB configuration variables for the
purpose of the setup. For example, add to the bottom of file /etc/my.cnf
(under section “[mysqld]”):
key_buffer_size = 256M
max_allowed_packet = 256M
table_open_cache = 500
open_files_limit = 5000
sort_buffer_size = 2048K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 1024K
myisam_sort_buffer_size = 64M
max_connections = 150
max_heap_table_size = 512M
innodb_buffer_pool_size = 2048M
innodb_log_buffer_size = 32M
innodb_log_files_in_group = 2
innodb_flush_log_at_trx_commit = 0
innodb_lock_wait_timeout = 50
innodb_file_per_table
innodb_thread_concurrency = 0
innodb_flush_method = O_DIRECT
Configuring local MySQL instance listening at port 3306 for use in an InnoDB cluster...
Clients and other cluster members will communicate with it through this address by default. If
this is not correct, the report_host MySQL system variable should be changed.
ERROR: User 'root' can only connect from 'localhost'. New account(s) with proper source address
specification to allow remote connection from all instances must be created to manage the
cluster.
1) Create remotely usable account for 'root' with same grants and password
2) Create a new admin account for InnoDB cluster with minimal required grants
4) Cancel
Please provide an account name (e.g: icroot@%) to have it created with the necessary
+----------------------------------------+---------------+----------------+--------------------
------------------------------+
+----------------------------------------+---------------+----------------+--------------------
------------------------------+
+----------------------------------------+---------------+----------------+--------------------
------------------------------+
Some variables need to be changed, but cannot be done dynamically on the server.
Configuring instance...
Restarting MySQL...
Bye!
Using the newly created admin user is easy to check whether the
dba.configureInstance fixed the issues reported above:
Validating local MySQL instance listening at port 3306 for use in an InnoDB cluster...
Clients and other cluster members will communicate with it through this address by default. If
this is not correct, the report_host MySQL system variable should be changed.
Checking whether existing tables comply with Group Replication requirements...
"status": "ok"
Bye!
<Cluster:mycluster1>
MySQL innodb1:33060+ ssl JS > var cluster = dba.getCluster()
MySQL innodb1:33060+ ssl JS > cluster.status()
{
"clusterName": "mycluster1",
"defaultReplicaSet": {
"name": "default",
"primary": "innodb1:3306",
"ssl": "REQUIRED",
"status": "OK_NO_TOLERANCE",
"statusText": "Cluster is NOT tolerant to any failures.",
"topology": {
"innodb1:3306": {
"address": "innodb1:3306",
"memberRole": "PRIMARY",
"mode": "R/W",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.32"
}
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "innodb1:3306"
}
MySQL innodb1:33060+ ssl JS > \q
Bye!
Repeat the above steps from 1 to 7 on rest for two nodes i.e.
innodb2,innodb2)
root@innodb1's password:
"clusterName": "mycluster1",
"defaultReplicaSet": {
"name": "default",
"primary": "innodb1:3306",
"ssl": "REQUIRED",
"status": "OK_NO_TOLERANCE",
"topology": {
"innodb1:3306": {
"address": "innodb1:3306",
"memberRole": "PRIMARY",
"mode": "R/W",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.32"
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "innodb1:3306"
NOTE: The target instance 'innodb2:3306' has not been pre-provisioned (GTID set is empty). The
Shell is unable to decide whether incremental state recovery can correctly provision it.
The safest and most convenient way to provision a new instance is through automatic clone
provisioning, which will completely overwrite the state of 'innodb2:3306' with a physical
snapshot from an existing cluster member. To use this method by default, set the
'recoveryMethod' option to 'clone'.
The incremental state recovery may be safely used if you are sure all updates ever executed in
the cluster were done with GTIDs enabled, there are no purged transactions and the new instance
contains the same GTID set as the cluster or a subset of it. To use this method by default, set
the 'recoveryMethod' option to 'incremental'.
NOTE: Group Replication will communicate with other members using 'innodb2:3306'. Use the
localAddress option to override.
A new instance will be added to the InnoDB Cluster. Depending on the amount of
data on the cluster this might take from a few seconds to several hours.
Monitoring recovery process of the new cluster member. Press ^C to stop monitoring and let it
continue in background.
NOTE: A server restart is expected to happen as part of the clone process. If the
server does not support the RESTART command or does not come back after a
** Clone Transfer
* Clone process has finished: 73.65 MB transferred in about 1 second (~73.65 MB/s)
State recovery already finished for 'innodb2:3306'
"clusterName": "mycluster1",
"defaultReplicaSet": {
"name": "default",
"primary": "innodb1:3306",
"ssl": "REQUIRED",
"status": "OK_NO_TOLERANCE",
"topology": {
"innodb1:3306": {
"address": "innodb1:3306",
"memberRole": "PRIMARY",
"mode": "R/W",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.32"
},
"innodb2:3306": {
"address": "innodb2:3306",
"memberRole": "SECONDARY",
"mode": "R/O",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.32"
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "innodb1:3306"
}
Bye!
"clusterName": "mycluster1",
"defaultReplicaSet": {
"name": "default",
"primary": "innodb1:3306",
"ssl": "REQUIRED",
"status": "OK_NO_TOLERANCE",
"topology": {
"innodb1:3306": {
"address": "innodb1:3306",
"memberRole": "PRIMARY",
"mode": "R/W",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.32"
},
"innodb2:3306": {
"address": "innodb2:3306",
"memberRole": "SECONDARY",
"mode": "R/O",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.32"
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "innodb1:3306"
NOTE: The target instance 'innodb3:3306' has not been pre-provisioned (GTID set is empty). The
Shell is unable to decide whether incremental state recovery can correctly provision it.
The safest and most convenient way to provision a new instance is through automatic clone
provisioning, which will completely overwrite the state of 'innodb3:3306' with a physical
snapshot from an existing cluster member. To use this method by default, set the
'recoveryMethod' option to 'clone'.
The incremental state recovery may be safely used if you are sure all updates ever executed in
the cluster were done with GTIDs enabled, there are no purged transactions and the new instance
contains the same GTID set as the cluster or a subset of it. To use this method by default, set
the 'recoveryMethod' option to 'incremental'.
NOTE: Group Replication will communicate with other members using 'innodb3:3306'. Use the
localAddress option to override.
A new instance will be added to the InnoDB Cluster. Depending on the amount of
data on the cluster this might take from a few seconds to several hours.
Monitoring recovery process of the new cluster member. Press ^C to stop monitoring and let it
continue in background.
NOTE: A server restart is expected to happen as part of the clone process. If the
server does not support the RESTART command or does not come back after a
** Clone Transfer
* Clone process has finished: 73.65 MB transferred in about 1 second (~73.65 MB/s)
"clusterName": "mycluster1",
"defaultReplicaSet": {
"name": "default",
"primary": "innodb1:3306",
"ssl": "REQUIRED",
"status": "OK",
"topology": {
"innodb1:3306": {
"address": "innodb1:3306",
"memberRole": "PRIMARY",
"mode": "R/W",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.32"
},
"innodb2:3306": {
"address": "innodb2:3306",
"memberRole": "SECONDARY",
"mode": "R/O",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.32"
},
"innodb3:3306": {
"address": "innodb3:3306",
"memberRole": "SECONDARY",
"mode": "R/O",
"readReplicas": {},
"replicationLag": "applier_queue_applied",
"role": "HA",
"status": "ONLINE",
"version": "8.0.32"
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "innodb1:3306"
Transaction Summary
===============================================================================================
==================================================================================
Install 1 Package
Installed:
mysql-router-community-8.0.32-1.el8.x86_64
- Verifying account (using it to run SQL queries that would be run by Router)
After this MySQL Router has been started with the generated configuration
$ /etc/init.d/mysqlrouter restart
or
or
$ mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf
## MySQL X protocol
Active: active (running) since Mon 2023-04-03 16:41:36 PDT; 43s ago
Status: "running"
Memory: 12.1M
CGroup: /system.slice/mysqlrouter.service
└─5145 /usr/bin/mysqlrouter
Port 6446 is for Read/Write operations and the 6447 is only for
Read operations of the classic MySQL protocol, the other two
ports are for the MySQL X protocol. Note that, by executing the
above firewall rules, all IPs would be allowed to contact the
specified ports.
+-------------------------------+
| Database |
+-------------------------------+
| information_schema |
| mysql |
| mysql_innodb_cluster_metadata |
| performance_schema |
| sys |
+-------------------------------+
Fetching global names, object names from `mukeshdb` for auto-completion... Press ^C to stop.
-> );
+--------------------+
| Tables_in_mukeshdb |
+--------------------+
| Persons |
+--------------------+
Bye!