• Docker部署ZooKeeper分布式协调服务


    1、准备工作

    docker pull zookeeper:3.6.3
    Pwd="/data/software/zookeeper"
    mkdir -p ${Pwd}/{logs,data,conf}
    
    • 1
    • 2
    • 3

    2、创建TEST容器,将conf目录COPY出来,在映射进去,方便后续维护管理!

    docker run -itd --name zookeeper zookeeper:3.6.3
    docker cp zookeeper:/conf ${Pwd}
    docker rm -f zookeeper
    
    • 1
    • 2
    • 3

    3、运行容器

    docker run -itd --name zookeeper \
        -v ${Pwd}/data:/data \
        -v ${Pwd}/logs:/datalog \
        -v ${Pwd}/conf:/conf \
        -v /etc/localtime:/etc/localtime \
        -p 2181:2181 \
        --restart=always \
        zookeeper:3.6.3
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    4、测试链接zookeeper

    docker exec -it zookeeper zkCli.sh
    
    • 1

    正常输出内容:

    Connecting to localhost:2181
    2023-09-24 00:23:01,538 [myid:] - INFO  [main:Environment@98] - Client environment:zookeeper.version=3.6.3--6401e4ad2087061bc6b9f80dec2d69f2e3c8660a, built on 04/08/2021 16:35 GMT
    2023-09-24 00:23:01,546 [myid:] - INFO  [main:Environment@98] - Client environment:host.name=a23908e4020e
    2023-09-24 00:23:01,546 [myid:] - INFO  [main:Environment@98] - Client environment:java.version=11.0.13
    2023-09-24 00:23:01,550 [myid:] - INFO  [main:Environment@98] - Client environment:java.vendor=Oracle Corporation
    2023-09-24 00:23:01,550 [myid:] - INFO  [main:Environment@98] - Client environment:java.home=/usr/local/openjdk-11
    2023-09-24 00:23:01,550 [myid:] - INFO  [main:Environment@98] - Client environment:java.class.path=/apache-zookeeper-3.6.3-bin/bin/../zookeeper-server/target/classes:/apache-zookeeper-3.6.3-bin/bin/../build/classes:/apache-zookeeper-3.6.3-bin/bin/../zookeeper-server/target/lib/*.jar:/apache-zookeeper-3.6.3-bin/bin/../build/lib/*.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/zookeeper-prometheus-metrics-3.6.3.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/zookeeper-jute-3.6.3.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/zookeeper-3.6.3.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/snappy-java-1.1.7.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/slf4j-log4j12-1.7.25.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/slf4j-api-1.7.25.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/simpleclient_servlet-0.6.0.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/simpleclient_hotspot-0.6.0.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/simpleclient_common-0.6.0.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/simpleclient-0.6.0.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/netty-transport-native-unix-common-4.1.63.Final.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/netty-transport-native-epoll-4.1.63.Final.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/netty-transport-4.1.63.Final.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/netty-resolver-4.1.63.Final.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/netty-handler-4.1.63.Final.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/netty-common-4.1.63.Final.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/netty-codec-4.1.63.Final.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/netty-buffer-4.1.63.Final.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/metrics-core-3.2.5.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/log4j-1.2.17.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/json-simple-1.1.1.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jline-2.14.6.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jetty-util-ajax-9.4.39.v20210325.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jetty-util-9.4.39.v20210325.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jetty-servlet-9.4.39.v20210325.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jetty-server-9.4.39.v20210325.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jetty-security-9.4.39.v20210325.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jetty-io-9.4.39.v20210325.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jetty-http-9.4.39.v20210325.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/javax.servlet-api-3.1.0.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jackson-databind-2.10.5.1.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jackson-core-2.10.5.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/jackson-annotations-2.10.5.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/commons-cli-1.2.jar:/apache-zookeeper-3.6.3-bin/bin/../lib/audience-annotations-0.5.0.jar:/apache-zookeeper-3.6.3-bin/bin/../zookeeper-*.jar:/apache-zookeeper-3.6.3-bin/bin/../zookeeper-server/src/main/resources/lib/*.jar:/conf:
    2023-09-24 00:23:01,551 [myid:] - INFO  [main:Environment@98] - Client environment:java.library.path=/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
    2023-09-24 00:23:01,551 [myid:] - INFO  [main:Environment@98] - Client environment:java.io.tmpdir=/tmp
    2023-09-24 00:23:01,551 [myid:] - INFO  [main:Environment@98] - Client environment:java.compiler=<NA>
    2023-09-24 00:23:01,551 [myid:] - INFO  [main:Environment@98] - Client environment:os.name=Linux
    2023-09-24 00:23:01,551 [myid:] - INFO  [main:Environment@98] - Client environment:os.arch=amd64
    2023-09-24 00:23:01,551 [myid:] - INFO  [main:Environment@98] - Client environment:os.version=3.10.0-1160.el7.x86_64
    2023-09-24 00:23:01,551 [myid:] - INFO  [main:Environment@98] - Client environment:user.name=root
    2023-09-24 00:23:01,551 [myid:] - INFO  [main:Environment@98] - Client environment:user.home=/root
    2023-09-24 00:23:01,552 [myid:] - INFO  [main:Environment@98] - Client environment:user.dir=/apache-zookeeper-3.6.3-bin
    2023-09-24 00:23:01,552 [myid:] - INFO  [main:Environment@98] - Client environment:os.memory.free=116MB
    2023-09-24 00:23:01,555 [myid:] - INFO  [main:Environment@98] - Client environment:os.memory.max=256MB
    2023-09-24 00:23:01,556 [myid:] - INFO  [main:Environment@98] - Client environment:os.memory.total=124MB
    2023-09-24 00:23:01,564 [myid:] - INFO  [main:ZooKeeper@1006] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@735b478
    2023-09-24 00:23:01,573 [myid:] - INFO  [main:X509Util@77] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
    2023-09-24 00:23:01,589 [myid:] - INFO  [main:ClientCnxnSocket@239] - jute.maxbuffer value is 1048575 Bytes
    2023-09-24 00:23:01,605 [myid:] - INFO  [main:ClientCnxn@1736] - zookeeper.request.timeout value is 0. feature enabled=false
    Welcome to ZooKeeper!
    2023-09-24 00:23:01,641 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1181] - Opening socket connection to server localhost/127.0.0.1:2181.
    2023-09-24 00:23:01,642 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1183] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
    2023-09-24 00:23:01,660 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1013] - Socket connection established, initiating session, client: /127.0.0.1:42962, server: localhost/127.0.0.1:2181
    JLine support is enabled
    2023-09-24 00:23:01,691 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1448] - Session establishment complete on server localhost/127.0.0.1:2181, session id = 0x100020e83f70001, negotiated timeout = 30000
    
    WATCHER::
    
    WatchedEvent state:SyncConnected type:None path:null
    [zk: localhost:2181(CONNECTED) 0] 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
  • 相关阅读:
    Qt QLineEdit详解
    [青少年CTF训练平台]web部分题解(已完结!)
    在Ubuntu上安装CUDA和cuDNN以及验证安装步骤
    逼格提升:内存泄漏检测工具
    智慧风电 | 图扑软件数字孪生风机设备,3D 可视化智能运维
    猫罐头哪个好?宠物店精选5款口碑好的猫罐头推荐!
    selenium firefox FirefoxProfile不生效
    互联网大厂的缓存策略:抵抗超高并发的秘密武器,已开源!
    深度学习100例-卷积神经网络(CNN)猴痘病识别 | 第45天
    一种通过注解处理数据权限设计整理
  • 原文地址:https://blog.csdn.net/weixin_45310323/article/details/133222940