一、集群部署
1. stack.yml配置文件
# Nacos服务注册与配置中心集群 nacos-1: image: nacos/nacos-server deploy: mode: global placement: constraints: - node.labels.nacos-1 == true restart_policy: condition: on-failure delay: 5s max_attempts: 10 window: 60s hostname: nacos-1 networks: - rws-mp volumes: - /etc/localtime:/etc/localtime - nacos:/home/nacos/init.d - nacos-1-logs:/home/nacos/logs environment: TZ: Asia/Shanghai PREFER_HOST_MODE: hostname NACOS_SERVERS: nacos-1:8848 nacos-2:8848 nacos-3:8848 MYSQL_SERVICE_HOST: 10.10.10.41 MYSQL_SERVICE_DB_NAME: rhxy-nacos MYSQL_SERVICE_PORT: 3300 MYSQL_SERVICE_USER: root MYSQL_SERVICE_PASSWORD: 123456 nacos-2: image: nacos/nacos-server deploy: mode: global placement: constraints: - node.labels.nacos-2 == true restart_policy: condition: on-failure delay: 5s max_attempts: 10 window: 60s hostname: nacos-2 networks: - rws-mp volumes: - /etc/localtime:/etc/localtime - nacos:/home/nacos/init.d - nacos-2-logs:/home/nacos/logs environment: TZ: Asia/Shanghai PREFER_HOST_MODE: hostname NACOS_SERVERS: nacos-1:8848 acos-2:8848 nacos-3:8848 MYSQL_SERVICE_HOST: 10.10.10.41 MYSQL_SERVICE_DB_NAME: rhxy-nacos MYSQL_SERVICE_PORT: 3300 MYSQL_SERVICE_USER: root MYSQL_SERVICE_PASSWORD: 123456 nacos-3: image: nacos/nacos-server deploy: mode: global placement: constraints: - node.labels.nacos-3 == true restart_policy: condition: on-failure delay: 5s max_attempts: 10 window: 60s hostname: nacos-3 networks: - rws-mp volumes: - /etc/localtime:/etc/localtime - nacos:/home/nacos/init.d - nacos-3-logs:/home/nacos/logs environment: TZ: Asia/Shanghai PREFER_HOST_MODE: hostname NACOS_SERVERS: nacos-1:8848 nacos-2:8848 nacos-3:8848 MYSQL_SERVICE_HOST: 10.10.10.41 MYSQL_SERVICE_DB_NAME: rhxy-nacos MYSQL_SERVICE_PORT: 3300 MYSQL_SERVICE_USER: root MYSQL_SERVICE_PASSWORD: 123456
先记录搭建大概,后面详细补充
原文:https://www.cnblogs.com/ruhuanxingyun/p/14852559.html