zoukankan      html  css  js  c++  java
  • zookeeper基于docker的安装

    单机模式、集群模式

    单机模式:

    docker-compose.yml文件

    version:'3.1'
    services:
        zoo1:
          image: zookeeper
          restart: always
          hostname: zoo1
          ports:
            - 2181:2181
          environment:
            ZOO_MY_ID: 1
            ZOO_SERVERS: server.1=zoo1:2888:3888

    验证是否成功安装

      以交互的方式进入容器

      docker exec -it zookeeper_zoo1_1 /bin/bash

    docker-compose.yml文件

    version: '3.1'
     
    services:
        zoo1:
            image: zookeeper
            restart: always
            hostname: zoo1
            ports:
                - 2181:2181
            environment:
                ZOO_MY_ID: 1
                ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
     
        zoo2:
            image: zookeeper
            restart: always
            hostname: zoo2
            ports:
                - 2182:2181
            environment:
                ZOO_MY_ID: 2
                ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zoo3:2888:3888
     
        zoo3:
            image: zookeeper
            restart: always
            hostname: zoo3
            ports:
                - 2183:2181
            environment:
                ZOO_MY_ID: 3
                ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=0.0.0.0:2888:3888
    

      

    /usr/local/zookeeper

    1. vi docker-compose.yml 2. docker-compose up -d 3. docker ps 4. docker exec -it zookeeper-zoo1_1 /bin/bash 5. ls -al 6. pwd 7. cd bin/ 8. ./zkServer.sh status // 状态时follower 按照启动程序选举leader 9. exit 10. docker ps 11. docker exec -it zookeeper_zoo3_1 /bin/bash 12. cd bin/ 13. ./zkServer.sh status // ---leader

      

  • 相关阅读:
    bzoj 2152: 聪聪可可
    bzoj 2143: 飞飞侠
    bzoj 2132: 圈地计划
    bzoj 2127: happiness
    bzoj 2124: 等差子序列
    bzoj 2120: 数颜色
    对MySQL数据类型的认识
    MySQL详解--锁,事务(转)
    mysql 5.7快速部署
    elasticsearch报错[WARN ][bootstrap ] Unable to lock JVM Memory: error=12,reason=Cannot allocate memory,解决
  • 原文地址:https://www.cnblogs.com/cgy-home/p/11833831.html
Copyright © 2011-2022 走看看