centraldogma ha 配置

centraldogma 支持ha模式的运行(依赖zk),以下是参考配置

环境准备

  • docker-compose
version: "3"
services: 
    app:
        image: line/centraldogma
        volumes: 
        - "./shiro.ini:/opt/centraldogma/conf/shiro.ini"
        - "./dogma.json:/opt/centraldogma/conf/dogma.json"
        ports: 
        - "36462:36462"
    app2:
        image: line/centraldogma
        volumes: 
        - "./shiro.ini:/opt/centraldogma/conf/shiro.ini"
        - "./dogma2.json:/opt/centraldogma/conf/dogma.json"
        ports: 
        - "36463:36462"
    app3:
        image: line/centraldogma
        volumes: 
        - "./shiro.ini:/opt/centraldogma/conf/shiro.ini"
        - "./dogma3.json:/opt/centraldogma/conf/dogma.json"
        ports: 
        - "36464:36462"
  • 配置
    主要是关于dogma的,核心如下,具体参考github
 
"replication" : {
        "method": "ZOOKEEPER",
        "serverId": 1, // id 需要不同,因为使用了嵌入的zk,实际上就是myid,需要不同,而且需要奇数节点
        "servers": {
          "1": {
            "host": "app",
            "quorumPort": 36463,
            "electionPort": 36464,
            "groupId": null,
            "weight": null
          },
          "2": {
            "host": "app2",
            "quorumPort": 36463,
            "electionPort": 36464,
            "groupId": null,
            "weight": null
          },
          "3": {
            "host": "app2",
            "quorumPort": 36463,
            "electionPort": 36464,
            "groupId": null,
            "weight": null
          }
        },
        "secret": "JqJAkZ!oZ6MNx4rBpIH8M*yuVWXDULgR",
        "additionalProperties": {},
        "timeoutMillis": null,
        "numWorkers": null,
        "maxLogCount": null,
        "minLogAgeMillis": null
    },

运行效果

 

 


数据

 

 

说明

centraldogma 的ha 使用了内嵌模式的zk,或者部署起来还是比较方便的(但是注意如果使用了容器数据持久化必须做),以下是参考的数据格式
(容器内部存储,内嵌zk的数据目录)

 

 

参考资料

https://line.github.io/centraldogma/setup-configuration.html
https://github.com/rongfengliang/centraldogma-ha

posted on 2021-06-14 10:13  荣锋亮  阅读(107)  评论(0编辑  收藏  举报

导航