当前位置:网站首页>MySQL configures PXC high availability cluster
MySQL configures PXC high availability cluster
2022-04-21 14:03:00 【daydayup9527】
To configure PXC High availability cluster
Percona XtraDB Cluster( abbreviation PXC) - Is based on Galera Of MySQL High availability cluster solution -Galera Cluster yes Codership A set of free and open source high availability solutions developed by the company
PXC Cluster features
Strong data consistency 、 No synchronization delay - There is no master-slave switching operation , No need to use virtual IP
Support InnoDB Storage engine - Multithreaded replication
Deployment is easy to use
Support nodes to join automatically , No need to copy data manually
Service port description
3306 Database service port
4444 SST port Non real time open port
4568 IST port Non real time open port non real time open port
4567 Cluster communication port
SST State Snapshot Transfer Full amount of synchronization
IST Incremental State Transfer The incremental synchronization
1、 Software package – Install in order
percona-xtrabackup-24-2.4.13-1.el7.x86_64.rpm # Online hot standby program
qpress-1.1-14.11.×86_64.rpm # Daily compression program
Percona-XtraDB-Cluster-server-57-5.7.25-31.35.1.el7.x86_64.rpm# Cluster service program
Install the software -3 Servers are installed in turn
~]# rpm -ivh libev-4.15-1.el6.rf.x86_64.rpm Installation dependency
~]# yum -y install percona-xtrabackup-24-2.4.13-1.el7.x86_64.rpm# Installation dependency
~]# rpm -ivh qpress-1.1-14.11.x86_64.rpm
~]# tar -xvf Percona-XtraDB-Cluster-5.7.25-31.35-r463-el7-x86_64-bundle.tar
~]# yum -y install Percona-XtraDB-Cluster-*.rpm
~]#ls /etc/percona-xtradb-cluster.conf.d/
mysqld.cnf # Database service profile , modify server_id
mysqld_safe.cnf # Database service process mysqld Configuration parameters for , There is no need to modify
wsrep.cnf # Cluster profile
2、 The configuration file mysqld.cnf file
[mysqld]
server-id=1 //server-id No repetition
datadir=/var/lib/mysql / Database directory
socket=/var/lib/mysql/mysql.sock //socket file
log-error=/var/log/mysqld.log / Log files
pid-file=/var/run/mysqld/mysqld.pid //pid file
log-bin // Enable binlog journal
log_slave_updates / Enable chained replication
expire_logs_days=7 // Log file retention days
2) To configure id colony IP sstuser
db1 ~]# vim /etc/percona-xtradb-cluster.conf.d/mysqld.cnf
[mysqld]
server-id=11 ##db2 db3 Modify in turn
db1~ ]# vim /etc/percona-xtradb-cluster.conf.d/wsrep.cnf
8 wsrep_cluster_address=gcomm://192.168.1.11,192.168.1.12,192.168.1.13
25 wsrep_node_address=192.168.1.11 # This machine ip
27 wsrep_cluster_name=pxc-cluster # identical
30 wsrep_node_name=pxc-cluster-node-11 # Different
39 wsrep_sst_auth="sstuser:123qqq...A" # The password is the same \
db2 ~]# vim /etc/percona-xtradb-cluster.conf.d/wsrep.cnf
8 wsrep_cluster_address=gcomm://192.168.1.11,192.168.1.12,192.168.1.13
25 wsrep_node_address=192.168.1.12
27 wsrep_cluster_name=pxc-cluster
30 wsrep_node_name=pxc-cluster-node-12
39 wsrep_sst_auth="sstuser:123qqq...A"
73 ~]# vim /etc/percona-xtradb-cluster.conf.d/wsrep.cnf
8 wsrep_cluster_address=gcomm://192.168.1.11,192.168.1.12,192.168.1.13
25 wsrep_node_address=192.168.1.13
27 wsrep_cluster_name=pxc-cluster
30 wsrep_node_name=pxc-cluster-node-13
39 wsrep_sst_auth="sstuser:123qqq...A"
3) Cluster initialization [email protected] to grant authorization sstuser
db1 ~]# systemctl start [email protected] # Wait patiently , Slightly longer
db1 ~]# systemctl status [email protected]
db1 ~]# ss -ntulp | grep 3306
db1 ~]# ss -ntulp | grep 4567
db1 ~]# grep -i password /var/log/mysqld.log
mysql> alter user root@localhost identified by "123456";
mysql> exit
db1 ~]# mysql -uroot -p123456
mysql> grant all on *.* to sstuser@localhost identified by "123qqq...A";
##sstuser The user has written... In the configuration
mysql> garnt reload, lock tables,replication client,process on *.* to
sstuser@"localhost” identified by “123qqq…A”; # Main required permissions
mysql>create database db; # Build a database to store data , Auto sync later
mysql> create table db.a(id int primary key auto_increment,name char(10));
mysql> insert into db.a(name) values("A");
#pxc When the cluster stores data , Table must have a primary key , Self increasing step size random , Less than or equal to the number of servers , Not more than 4.
mysql> select * from db.a;
4) start-up 12,13 The database service of the host , Complete synchronization
~]# ls /var/lib/mysql
~]# systemctl start mysql # Do full synchronization , Services in the cluster do not need to bring d
~]# ls /var/lib/mysql # Can see sock And others
~]# ss -ntulp | grep 3306
~]# ss -ntulp | grep 4567
~]# mysql -uroot -p123456
> insert into db.a(name) values("B");
> insert into db.a(name) values("c");
start-up 33 The database service of the host , The check operation is the same as 72
db1 initialization failed , Follow the steps below to solve the problem
1 Check mysqld.cnf and wsrep.cnf Modification of
2 rm -rf /var/lib/mysql/*
3 Check firewalld selinux Whether to shut down
4 Perform initialization again
db1 Successful initialization , but db2,3 Failed to start service , Follow the steps below to solve the problem
1 Check firewalld selinux Whether to shut down
2 Check db2,3mysqld.cnf and wsrep.cnf Modification of
3 , respectively, db2,3 perform rm -rf /var/lib/mysql/*
4 , respectively, db2,3 Execute startup service
5) test PXC colony ( At least make sure you do 1 The desk is working )
db2
mysql> show status like "%wsre%"; # Main information
wsrep_incoming_addresses |192.168.1.13:3306,192.168.1.11:3306,192.168.1.12:3306 |
wsrep_cluster_size 3 // Number of cluster servers
wsrep_cluster_status Primary // The host state
wsrep_connected ON // Connection status
wsrep_ready ON // Service status
db1 ~]# systemctl stop [email protected] Start and stop for the first time
db2
mysql> show status like "%wsre%";
|wsrep_incoming_addresses |192.168.1.13:3306,192.168.1.12:3306 |
db1 ~]# systemctl start mysql
db1 ~]# mysql -uroot -p123456 -e 'select * from db.a' # Auto join auto sync
db1 ~]# mysql -uroot -p123456 -e 'grant all on *.* to testt@"%" identified by "123456"'
db3 ~]# mysql -uroot -p123456 -e 'select user from mysql.user'
client ~]# mysql -h192.168.1.11 -utest-p123456
mysql> insert into db.a(name)values("AAA");
mysql> exit
client ~]# mysql -h192.168.1.12 -utest-p123456 -e 'select * from db.a'
版权声明
本文为[daydayup9527]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211351296766.html
边栏推荐
- MysQL读写分离服务器--maxscale服务
- 剑指office-割线子
- Shandong University project training raspberry pie promotion plan phase II (VII) objects and categories
- ssh服务器--密钥认证
- redis入门
- 优先级队列 (堆)常用接口介绍 堆的存储 堆的创建
- Zabbix5 series - access to grafana panel (XVII)
- <2021SC@SDUSC>山东大学软件工程应用与实践JPress代码分析(三)
- <2021SC@SDUSC>山东大学软件工程应用与实践JPress代码分析(九)
- Review notes in various order
猜你喜欢

Shandong University project training raspberry pie promotion plan phase II (III) SSH Remote Connection

Zabbix5系列-监控mysql(5.7/5.8/mariadb) (十)

Campus network architecture

RHCE搭建简单web网站

Zabbix5系列-监控华为、H3C交换机(snmpv2c/snmpv3/snmptrap) (二)

Shandong University project training raspberry pie promotion plan phase II (VI) condition judgment and cycle

墨墨背单词--通过安装包提取它的所有离线单词

The common interface of priority queue (heap) introduces the storage of heap and the creation of heap

Zabbix5 series - monitoring redis (XI)

Zabbix5系列-创建自动发现模板 (十六)
随机推荐
Shandong University project training raspberry pie promotion plan phase II (VII) objects and categories
Chapter III commercial password standards and product applications of commercial password application and security evaluation - Summary
Zabbix5 series - sound alarm, mail alarm (XIV)
各种排序的复习笔记
FTP service
< 2021SC@SDUSC > Application and practice of software engineering in Shandong University jpress code analysis (10)
glusterfs存储卷分布卷、复制卷测试
集合线程安全
Review notes in various order
恭喜 EDG 勇夺 2021 英雄联盟全球总决赛冠军
应急响应笔记
软件测试常见问题 开发模型 PC端qq登录测试用例 BUG的相关问题 测试用例设计的常用方法
7类排序总结 插入 选择 交换 快排 归并排序 快来冲冲冲
原子类的使用与原理
How does Jupiter notebook copy multiple code blocks / cells across files (to another file)
对机器学习的理解
基于Anki+Vocabulary的英语单词记忆法
nfs服务,lvm扩容
微信退款 No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
networkx计算边的重要性:边介数或者中介中心性edge_betweenness