Mycat实现读写分离架构图:
Mycat主从自动切换架构图:
Mycat下载地址:http://dl.mycat.io/1.6.7.3/20190828135747/Mycat-server-1.6.7.3-release-20190828135747-linux.tar.gz
Percona-XtraDB-Cluster下载地址:https://www.percona.com/downloads/Percona-XtraDB-Cluster-57/LATEST/
Percona-XtraBackup下载地址: https://www.percona.com/downloads/Percona-XtraBackup-2.4/LATEST/
yum仓库地址:https://www.percona.com/downloads/percona-release/redhat/
1.下载,安装Percona-XtraDB-Cluster(三台都需要装)
[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.修改配置,启动服务(k8s01节点)
[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 --三个节点值不一样
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 --初使化数据
[root@k8s01 ~]# systemctl start
mysql@bootstrap.service --第一次启动,不需要同步数据
[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
# Password set for user 'root@localhost' at 2019-11-15 14:40:31
ya;-t*taM8T< --mysql登陆密码
[root@k8s01 ~]# mysql -u root -p'ya;-t*taM8T<'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.27-30-57-log
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
软考中级精品资料免费领
- 历年真题答案解析
- 备考技巧名师总结
- 高频考点精准押题
- 资料下载
- 历年真题
193.9 KB下载数265
191.63 KB下载数245
143.91 KB下载数1148
183.71 KB下载数642
644.84 KB下载数2756