redhat
installing-perconaxtradb cluster 5.6
for redhat 6.4
一、服务器版本查看
root# cat /etc/redhat-release
red hatenterprise linux server release 6.4 (santiago)
二、新建目录:
root#mkdir -p /softwares
三、下载rpm包
1、下载xtradbcluster包
wgethttp://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-56-5.6.15-25.5.759.rhel6.x86_64.rpm
wget http://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-56-debuginfo-5.6.15-25.5.759.rhel6.x86_64.rpm
wgethttp://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-client-56-5.6.15-25.5.759.rhel6.x86_64.rpm
wgethttp://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-devel-56-5.6.15-25.5.759.rhel6.x86_64.rpm
wget http://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-full-56-5.6.15-25.5.759.rhel6.x86_64.rpm
wgethttp://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-galera-3-3.4-1.213.rhel6.x86_64.rpm
wgethttp://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-galera-3-debuginfo-3.4-1.213.rhel6.x86_64.rpm
wgethttp://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-server-56-5.6.15-25.5.759.rhel6.x86_64.rpm
wgethttp://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-shared-56-5.6.15-25.5.759.rhel6.x86_64.rpm
wget http://www.percona.com/redir/downloads/percona-xtradb-cluster-56/latest/rpm/rhel6/x86_64/percona-xtradb-cluster-test-56-5.6.15-25.5.759.rhel6.x86_64.rpm
2、下载xtrabackup包
wget http://www.percona.com/redir/downloads/xtrabackup/latest/rpm/rhel6/x86_64/percona-xtrabackup-2.1.9-744.rhel6.x86_64.rpm
wget http://www.percona.com/redir/downloads/xtrabackup/latest/rpm/rhel6/x86_64/ percona-xtrabackup-debuginfo-2.1.9-744.rhel6.x86_64.rpm
wget
http://www.percona.com/redir/downloads/xtrabackup/latest/rpm/rhel6/x86_64/ percona-xtrabackup-test-2.1.9-744.rhel6.x86_64.rpm
四、安装依赖包
1、安装包准备
安装光盘package目录下:perl-dbd-mysql-4.013-3.el6.x86_64.rpm
wget http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/rpms/socat-1.7.2.4-1.el6.rf.x86_64.rpm
wget
http://mirror.centos.org/centos/6/os/x86_64/packages/nc-1.84-22.el6.x86_64.rpm
2、安装
rpm -ivh perl-dbd-mysql-4.013-3.el6.x86_64.rpm socat-1.7.2.4-1.el6.rf.x86_64.rpmnc-1.84-22.el6.x86_64.rpm
五、删除原有软件包
rpm -qa | grepmysql | xargs sudo rpm -e --nodeps
六、安装
1、安装percona-xtrabackup
rpm -ivhpercona-xtrabackup-2.1.9-744.rhel6.x86_64.rpm
2、安装percona-xtradb-cluster-galera
rpm -ivhpercona-xtradb-cluster-galera-3-3.5-1.216.rhel6.x86_64.rpmpercona-xtradb-cluster-galera-3-debuginfo-3.5-1.216.rhel6.x86_64.rpm
3、安装percona-xtradb-cluster-client
rpm -ivhpercona-xtradb-cluster-client-56-5.6.15-25.5.759.rhel6.x86_64.rpm
4、安装percona-xtradb-cluster-server
rpm -ivhpercona-xtradb-cluster-server-56-5.6.15-25.5.759.rhel6.x86_64.rpm
七、修改配置文件
find / -name 'my-default.cnf'
cp my-default.cnf /etc/my.cnf
八、cluster配置
在配置文件中增加如下部分:(/etc/my.cnf)
percona xtradb cluster documentation, release 5.6.15-25.5
[mysqld]
datadir=/var/lib/mysql
user=mysql
# path to galera library
wsrep_provider=/usr/lib64/libgalera_smm.so
# cluster connection url contains the ips of node#1,node#2 and node#3
wsrep_cluster_address=gcomm://192.168.70.71,192.168.70.72,192.168.70.73
# in order for galera to work correctly binlog formatshould be row
binlog_format=row
# myisam storage engine has only experimental support
default_storage_engine=innodb
# this changes how innodb autoincrement locks are managedand is a requirement for galera
innodb_autoinc_lock_mode=2
# node #1 address
wsrep_node_address=192.168.70.71 # 本机ip地址
# sst method
wsrep_sst_method=xtrabackup-v2
# cluster name
wsrep_cluster_name=my_centos_cluster
# authentication for sst method
wsrep_sst_auth=sstuser:s3cret
注:其他节点配置文件同上,注意wsrep_node_address=192.168.70.71 # 本机ip地址。
在第一个节点上执行:
mysql@percona1> create user 'sstuser@'localhost'identified by 's3cret';
mysql@percona1> grant reload, lock tables, replicationclient on
*.* to 'sstuser'@'localhost';
mysql@percona1> flush privileges;
九、启动
第一个节点:/etc/init.d/mysql bootstrap-pxc
其他节点: /etc/init.d/mysqlstart
十、更改root口令并授权从任何主机访问
登录mysql:
mysql -u root –p
mysql>
grant all privileges on *.* to 'root'@'%' identified by'mysql' with grant option;
