Mysql Percona XtraDB Cluster

Installing from Repositories

1.Fetch the repository packages from Percona web:

<code>
wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
</code>

1.Install the downloaded package with dpkg. To do that, run the following command as root or with sudo:
<code>
sudo dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb
</code>

Once you install this package, the Percona repositories should be added. You can check the repository configuration in the /etc/apt/sources.list.d/percona-release.list
file.
1.Update the local cache:
<code>
sudo apt-get update
</code>

1.Install the server package:

Note
Make sure to remove existing Percona XtraDB Cluster 5.5 and Percona Server 5.5/5.6 packages before proceeding.
<code>
sudo apt-get install percona-xtradb-cluster-56
</code>
Note
Alternatively, you can install the percona-xtradb-cluster-full-56
meta package, which contains the following additional packages:
percona-xtradb-cluster-5.6-dbg

percona-xtradb-cluster-galera-3.x-dbg

percona-xtradb-cluster-galera3-dbg

percona-xtradb-cluster-garbd-3

percona-xtradb-cluster-garbd-3.x

percona-xtradb-cluster-garbd-3.x-dbg

percona-xtradb-cluster-server-debug-5.6

percona-xtradb-cluster-test-5.6

[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

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容