翼度科技»论坛 编程开发 mysql 查看内容

PXC

6

主题

6

帖子

18

积分

新手上路

Rank: 1

积分
18
centos8下安装pxc-80

官方地址

https://www.percona.com/doc/percona-repo-config/index.html
https://www.percona.com/doc/percona-xtradb-cluster/LATEST/install/yum.html#yum
yum仓库配置
  1. # 安装仓库管理器
  2. yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm -y
  3. # 禁用mysql模组
  4. yum module disable mysql -y
复制代码
安装pxc
  1. # 安装pxc
  2. percona-release enable-only pxc-80 release
  3. percona-release enable tools release
  4. yum install percona-xtradb-cluster -y
复制代码
初始化及配置
  1. # 创建证书文件
  2. mkdir -p /etc/mysql/certs/
  3. mysql_ssl_rsa_setup -d /etc/mysql/certs/
  4. # 将文件复制到集群所有节点的/etc/mysql/certs/目录,并设置所有者为mysql
  5. scp /etc/mysql/certs/* 10.1.1.22:/etc/mysql/certs/
  6. chown -R mysql:mysql /etc/mysql/
复制代码
编辑/etc/my.cnf
  1. # /etc/my.cnf
  2. [mysqld]
  3. ssl-ca = /etc/mysql/certs/ca.pem
  4. ssl-cert = /etc/mysql/certs/server-cert.pem
  5. ssl-key = /etc/mysql/certs/server-key.pem
  6. datadir=/var/lib/mysql
  7. socket=/tmp/mysql.sock
  8. log-error=/var/log/mysqld.log
  9. skip-host-cache
  10. binlog_format=ROW
  11. default_storage_engine=InnoDB
  12. innodb_flush_log_at_trx_commit  = 0
  13. innodb_flush_method             = O_DIRECT
  14. innodb_file_per_table           = 1
  15. innodb_autoinc_lock_mode=2
  16. bind_address = 0.0.0.0
  17. wsrep_slave_threads=2
  18. wsrep_cluster_address=gcomm://10.1.1.20,10.1.1.21,10.1.1.22 # 集群地址
  19. wsrep_provider=/usr/lib64/galera4/libgalera_smm.so
  20. wsrep_cluster_name=pxc-cluster
  21. #wsrep_node_address=10.1.1.20 # 所在节点的ip地址,可以不配置
  22. wsrep_sst_method=xtrabackup-v2
  23. [client]
  24. socket=/tmp/mysql.sock
  25. ssl-ca = /etc/mysql/certs/ca.pem
  26. ssl-cert = /etc/mysql/certs/client-cert.pem
  27. ssl-key = /etc/mysql/certs/client-key.pem
  28. [sst]
  29. progress=/var/lib/mysql/sst_in_progress
  30. encrypt = 4
  31. ssl-ca = /etc/mysql/certs/ca.pem
  32. ssl-cert = /etc/mysql/certs/server-cert.pem
  33. ssl-key = /etc/mysql/certs/server-key.pem
复制代码
将配置文件复制到其他节点 scp /etc/my.cnf 10.1.1.22:/etc ,并修改wsrep_node_address的值为对应的节点ip
启动集群
  1. # 启动初始化节点
  2. systemctl start mysql@bootstrap.service
复制代码
初始化节点配置
  1. # 查询密码
  2. grep 'temporary password' /var/log/mysqld.log
  3. # 初始化设置
  4. mysql_secure_installation
  5. # 登陆配置
  6. mysql -u root -p
  7. # select * from mysql.user where User='root' \G;
  8. update mysql.user set Host='%' where User='root';
  9. flush privileges;
复制代码
其他节点加入集群
  1. systemctl start mysql
复制代码
集群查看 show status like 'wsrep_cluster%';
其他
  1. # 安装percona-server
  2. percona-release enable ps-80 release
  3. # percona-release setup ps80
  4. yum install percona-server-server
  5. # 开启防火墙
  6. firewall-cmd --add-port=3306/tcp --add-port=4444/tcp --add-port=4567/tcp --add-port=4568/tcp --permanent
  7. firewall-cmd --reload
复制代码
来源:https://www.cnblogs.com/xwjh/p/17141615.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

举报 回复 使用道具