网站建设资讯

NEWS

网站建设资讯

PXC5.7的安装步骤

这篇文章主要介绍“PXC5.7的安装步骤”,在日常操作中,相信很多人在PXC5.7的安装步骤问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”PXC5.7的安装步骤”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

侯马ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!

节点分配


IP

hostname

用途

192.168.137.201

c1

node1

192.168.137.202

c2

node2

192.168.137.203

c3

node3

需要的包

percona-xtrabackup-24-2.4.7-2.el6.x86_64.rpm

Percona-XtraDB-Cluster-5.7.18-rel15-29.20.1.Linux.x86_64.ssl101.tar.gz

安装epel源(所有节点)

centos6

 rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

centos7

 rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

安装依赖包

yum install perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes socat nc -y

安装xtrabackup

wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.7/binary/redhat/6/x86_64/percona-xtrabackup-24-2.4.7-2.el6.x86_64.rpm

rpm -ivh percona-xtrabackup-24-2.4.7-2.el6.x86_64.rpm

数据库初始化

/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/mysql3306/data  --user=mysql --initialize

修改mysqld_safe启动文件

#####具体需要替换的路径根据安装的包名称去mysqld_safe文件中查询#############

sed -i 's#/mnt/workspace/percona-xtradb-cluster-5.7-binary-tarball/label_exp/centos6-64/Percona-XtraDB-Cluster-5.7.18-29.20/346/usr/local/Percona-XtraDB-Cluster-5.7.18-rel15-29.20.1.Linux.x86_64.ssl101#/usr/local/mysql#g' /usr/local/mysql/bin/mysqld_safe

vi /usr/local/mysql/support-files/mysql.server

basedir=/usr/local/mysql

datadir=/data/mysql/mysql3306/data

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

chmod 755 /etc/init.d/mysql

添加PXC相关的参数

vi /etc/my.cnf

[mysqld]

...

#PXC

wsrep_provider=/usr/local/mysql/lib/libgalera_smm.so

wsrep_cluster_address=gcomm://192.168.137.201,192.168.137.202,192.168.137.203

wsrep_node_address=192.168.137.201

wsrep_slave_threads=2

innodb_autoinc_lock_mode=2

binlog_format = ROW

default_storage_engine=InnoDB

wsrep_cluster_name=pxc-jiangzq

wsrep_sst_auth=sst:jiangzq

wsrep_sst_method=xtrabackup-v2

检查环境

[root@c1 xtrabackup]# /etc/init.d/mysql --help

Usage: mysql {start|stop|restart|restart-bootstrap|reload|force-reload|status|bootstrap-pxc}  [ MySQL (Percona XtraDB Cluster) options ]

启动第一个节点

shell>/etc/init.d/mysql bootstrap-pxc

/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf  bootstrap-pxc &

/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf bootstrap-pxc

修改root密码和添加sst账户

alter user user() identified by 'root';

create user 'sst'@'localhost' identified by 'jiangz';

grant all  on *.* to 'sst'@'localhost';

将整个虚拟机再克隆两个

#####修改主机名

shell>hostname c2

shell>vi /etc/sysconfig/network

hostname=c2

#####修改ip地址

shell>vi /etc/sysconfig/network-script/ifcfg-eth0

shell>service network restart

#####修改mysql配置文件

shell>vi /etc/my.cnf

server-id=203306

pid-file = c2.pid

wsrep_node_address=192.168.137.202

第2、3个节点启动

shell>/etc/init.d/mysql

遇到的错误

 ##############启动第二个节点报的错误###############

2017-07-18T06:40:24.829678Z 0 [ERROR] WSREP: Failed to read 'ready ' from: wsrep_sst_xtrabackup-v2 --role 'joiner' --address '192.168.137.202' --datadir '/data/mysql/mysql3306/data/' --defaults-file '/etc/my.cnf' --defaults-group-suffix '' --parent '10520' --binlog '/data/mysql/mysql3306/logs/mysql-bin'

    Read: '(null)'

2017-07-18T06:40:24.829714Z 0 [ERROR] WSREP: Process completed with error: wsrep_sst_xtrabackup-v2 --role 'joiner' --address '192.168.137.202'

--datadir '/data/mysql/mysql3306/data/' --defaults-file '/etc/my.cnf' --defaults-group-suffix '' --parent '10520' --binlog '/data/mysql/mysql3306/logs/mysql-bin' :

2 (No such file or directory)

selinux 没关和xtrabackup版本太低

日常启动关闭

#/etc/init.d/mysql    stop

全部节点关闭后重启

第一个节点启动的节点( 如果集群全部关闭,第一个起动也需要用这样的形式)

#/etc/init.d/mysql    bootstrap-pxc

其它节点

#/etc/init.d/mysql    start

备注:

如集群是不是所有的节点都关闭不用使#/etc/init.d/mysql    bootstrap-pxc 启动。都可以用

#/etc/init.d/mysql    start

启动。

到此,关于“PXC5.7的安装步骤”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!


新闻标题:PXC5.7的安装步骤
本文地址:http://cdweb.net/article/gdsdpg.html