PXC

PXC SWARM 集群 创建 SWARM 主节点 (–advertise-addr 用来指定使用哪个网卡的 IP) docker swarm init --advertise-addr 192.168.x.x 复制初始化输出的加入命令,在需要加入的机器执行 docker swarm join --token xxxxxxxx 创建 PXC 专用的 overlay 网络 pxc docker network create -d overlay --attachable pxc Docker Node1 创建目录,赋权 A mkdir -p /opt/pxc-node1/conf /opt/pxc-node1/data /opt/pxc-node1/logs chmod 777 /opt/pxc-node1/conf /opt/pxc-node1/data /opt/pxc-node1/logs node1 的配置 docker-compose.yml version: "3" services: pxc-node1: image: percona/percona-xtradb-cluster:8.0.36-28.1 container_name: pxc-node1 volumes: - /opt/pxc-node1/conf:/etc/percona-xtradb-cluster.conf.d - /opt/pxc-node1/data:/var/lib/mysql - /opt/pxc-node1/logs:/var/log/mysql environment: - TZ=Asia/Shanghai - MYSQL_ROOT_PASSWORD=xxxxxx # root 密码 - XTRABACKUP_PASSWORD=xxxxxx # pxc 集群同步密码 - CLUSTER_NAME=pxc # - CLUSTER_JOIN=pxc-node1 network_mode: pxc # overlay 网络名称 ports: - 3316:3306 restart: always privileged: true 启动...

April 17, 2024 · Kevin