Get the App
SLTechnology News&Howtos  ›  Database  › 

Mycat Middleware realizes the Separation of read and write in Percona Cluster Cluster

Shulou Source: shulou.com Published: 2022-06-01 05:13:10 11月10日 Update

Mycat implementation of read-write separation architecture diagram:

Mycat master-slave automatic switching architecture diagram:

Mycat download address: dl.mycat.io/1.6.7.3/20190828135747/Mycat-server-1.6.7.3-release-20190828135747-linux.tar.gz

Percona-XtraDB-Cluster download address: www.percona.com/downloads/Percona-XtraDB-Cluster-57/LATEST/

Percona-XtraBackup download address: https://www.percona.com/downloads/Percona-XtraBackup-2.4/LATEST/

yum Warehouse Address: www.percona.com/downloads/percona-release/redhat/

1. Download and install Percona-XtraDB-Cluster (all three need to be installed)

[root@k8s01 ~]# rpm -ivh https://www.percona.com/redir/downloads/percona-release/redhat/1.0-13/percona-release-1.0-13.noarch.rpm

[root@k8s01 ~]# yum repolist

[root@k8s01 ~]# rpm -ivh percona-xtrabackup-24-2.4.13-1.el7.x86_64.rpm

[root@k8s01 ~]# yum install Percona-XtraDB-Cluster-57 -y

2. Modify configuration and start service (k8s01 node)

[root@k8s01 ~]# vim /etc/percona-xtradb-cluster.conf.d/mysqld.cnf

log-bin=k8s01-bin

log-bin-index=k8s01-bin-index

[root@k8s01 ~]# vim /etc/percona-xtradb-cluster.conf.d/wsrep.cnf

[mysqld]

wsrep_provider=/usr/lib64/galera3/libgalera_smm.so

wsrep_cluster_address=gcomm://192.168.54.129,192.168.54.130,192.168.54.128

binlog_format=ROW

default_storage_engine=InnoDB

wsrep_slave_threads= 8

wsrep_log_conflicts

innodb_autoinc_lock_mode=2

wsrep_node_address=192.168.54.128 --Three nodes have different values

wsrep_cluster_name=mycluster

wsrep_node_name=k8s01

pxc_strict_mode=ENFORCING

wsrep_sst_method=xtrabackup-v2

wsrep_sst_auth="sstuser:s3cretPass"

[root@k8s01 ~]# mysql_install_db --defaults-file=/etc/percona-xtradb-cluster.cnf --datadir=/var/lib/mysql --initialization data

[root@k8s01 ~]# systemctl start mysql@bootstrap.service --first startup, no synchronization data required

[root@k8s01 ~]# ps -ef | grep mysql

root 60672 54285 0 14:56 pts/1 00:00:00 tailf /var/log/mysqld.log

root 66031 1 0 15:03 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr --wsrep-new-cluster

mysql 66568 66031 6 15:03 ? 00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --wsrep-provider=/usr/lib64/galera3/libgalera_smm.so --wsrep-new-cluster --log-error=

/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock --wsrep_start_position=00000000-0000-0000-0000-000000000000:-1root 66763 33815 0 15:04 pts/0 00:00:00 grep --color=auto mysql

[root@k8s01 ~]# cat ~/.mysql_secret

# Password set for user 'root@localhost' at 2019-11-15 14:40:31

ya;-t*taM8T< --mysql login password

[root@k8s01 ~]# mysql -u root -p'ya;-t*taM8T

Tags: Node data service address method user configuration cluster architecture first time synchronization login middleware equilibrium three master-slave warehouse password effect user name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Tech Info Shulou Information NVidia Linux