**
1.pxc安装
**
docker pull percona/percona-xtradb-cluster
docker volume create --name v1
单台物理主机下(多台组网物理主机不用建虚拟网)
bash docker network create --subnet=172.21.128.0/24 pxc-network
创建第一个节点
docker run -d -p 3306:3306 -u root -e MYSQL_ROOT_PASSWORD=ABC123456 -e CLUSTER_NAME=PXC -e XTRABACKUP_PASSWORD=ABC123456 -v v1:/var/lib/mysql --restart=always --privileged=true --network host --name=mysql1 percona/percona-xtradb-cluster:latest
PS:①–network host 多台组网物理主机情形
把此处改成–network pxc-network就是单台物理主机情形
②单台物理主机情形修改暴露端口-p 10010:3306
配置文件如下 node1.cnf
#配置文件如下 node1.cnf
server_id=1
binlog_format=ROW
default_storage_engine=InnoDB
innodb_flush_log_at_trx_commit = 1
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_autoinc_lock_mode=2
bind_address = 0.0.0.0
wsrep_slave_threads=8
wsrep_cluster_address=gcomm://
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_provider_options='gcache.size=1G'
wsrep_cluster_name=PXC
wsrep_node