compose file for docker nacos cluster

compose file for docker nacos cluster,第1张

version: "3"

services: 
    nacos1:
        container_name: nacos-server01
        hostname: nacos-server01
        image: nacos/nacos-server:v2.0.4-slim
        env_file:
            - ./nacos-hostname.env
        environment: 
            - MYSQL_SERVICE_DB_NAME=nacos-c1
        volumes: 
            - ./cluster-logs/nacos-server01:/home/nacos/logs
            #- init.d:/home/nacos/init.d
        ports: 
            - 8846:8848
            - 9555:9555
        networks:
            naco-bridge:
                aliases:
                    - nacos-server01
        restart: on-failure

    nacos2:
        container_name: nacos-server02
        hostname: nacos-server02
        image: nacos/nacos-server:v2.0.4-slim
        env_file:
            - ./nacos-hostname.env
        environment: 
            - MYSQL_SERVICE_DB_NAME=nacos-c2
        volumes: 
            - ./cluster-logs/nacos-server02:/home/nacos/logs
            #- init.d:/home/nacos/init.d
        ports: 
            - 8847:8848
        networks:
            naco-bridge:
                aliases:
                    - nacos-server02
        restart: on-failure

    nacos3:
        container_name: nacos-server03
        hostname: nacos-server03
        image: nacos/nacos-server:v2.0.4-slim
        env_file:
            - ./nacos-hostname.env
        environment: 
            - MYSQL_SERVICE_DB_NAME=nacos-c3
        volumes: 
            - ./cluster-logs/nacos-server03:/home/nacos/logs
            #- init.d:/home/nacos/init.d
        ports: 
            - 8848:8848
        networks:
            naco-bridge:
                aliases:
                    - nacos-server03
        restart: on-failure 
networks:
  naco-bridge:
    driver: bridge

nacos-hostname.env

#nacos dev env
PREFER_HOST_MODE=hostname
NACOS_SERVERS=nacos-server01:8848 nacos-server02:8848 nacos-server03:8848
MYSQL_SERVICE_HOST=128.30.202.25
MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=root
MYSQL_SERVICE_PASSWORD=123456

JVM_XMS=128m
JVM_XMX=256m
JVM_XMN=128m

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/740422.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-28
下一篇 2022-04-28

发表评论

登录后才能评论

评论列表(0条)

保存