Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.47 KB

集群创建的命令.md

File metadata and controls

51 lines (34 loc) · 1.47 KB

Percona-XtraDB-Cluster的docker集群创建的命令

docker ps -a -q --filter name=document

docker stop `docker ps -a -q --filter name=mysql-cluster-node`
docker rm `docker ps -a -q --filter name=mysql-cluster-node`

docker network rm percona-xtradb-cluster-network

docker network create percona-xtradb-cluster-network
# docker network create --subnet=10.10.57.0/24 percona-xtradb-cluster-network

# 暂时不挂载数据卷出来:/var/lib/mysql
docker run -itd --restart always -p 3307:3306 \
    --net=percona-xtradb-cluster-network \
    --name=mysql-cluster-node01 \
    -e MYSQL_ROOT_PASSWORD=root \
    -e CLUSTER_NAME=cluster1 \
    percona/percona-xtradb-cluster:5.7.23


# 暂停1分钟,让mysql-cluster-node01处于完全就绪的状态


docker run -itd --restart always -p 3308:3306 \
    --net=percona-xtradb-cluster-network \
    --name=mysql-cluster-node02 \
    -e CLUSTER_JOIN=mysql-cluster-node01 \
    -e MYSQL_ROOT_PASSWORD=root \
    -e CLUSTER_NAME=cluster1 \
    percona/percona-xtradb-cluster:5.7.23


# 暂停1分钟,让mysql-cluster-node02处于完全就绪的状态


docker run -itd --restart always -p 3309:3306 \
    --net=percona-xtradb-cluster-network \
    --name=mysql-cluster-node03 \
    -e CLUSTER_JOIN=mysql-cluster-node01 \
    -e MYSQL_ROOT_PASSWORD=root \
    -e CLUSTER_NAME=cluster1 \
    percona/percona-xtradb-cluster:5.7.23


# 暂停1分钟,让mysql-cluster-node03处于完全就绪的状态


docker logs -f --tail=1000 mysql-cluster-node01