zoukankan      html  css  js  c++  java
  • Zookeeper在Windows下搭建集群教程

    每个节点对应一个zoo.cfg配置文件。每个节点对应一个启动的ZKServer.cmd

    1、复制zoo.cfg,为zoo2.cfg、zoo3.cfg。内容如下:

    tickTime=2000
    initLimit=10
    syncLimit=5
    
    dataDir=D:\Development\ZZKK\apache-zookeeper-3.6.2-bin\dataDir
    clientPort=2181
    
    server.1 = 127.0.0.1:2887:3887
    server.2 = 127.0.0.1:2888:3888
    server.3 = 127.0.0.1:2889:3889
    zoo.cfg
    tickTime=2000
    initLimit=10
    syncLimit=5
    
    dataDir=D:\Development\ZZKK\apache-zookeeper-3.6.2-bin\dataDir2
    clientPort=2182
    
    
    server.1 = 127.0.0.1:2887:3887
    server.2 = 127.0.0.1:2888:3888
    server.3 = 127.0.0.1:2889:3889
    zoo2.cfg
    tickTime=2000
    initLimit=10
    syncLimit=5
    
    dataDir=D:\Development\ZZKK\apache-zookeeper-3.6.2-bin\dataDir3
    clientPort=2183
    
    
    server.1 = 127.0.0.1:2887:3887
    server.2 = 127.0.0.1:2888:3888
    server.3 = 127.0.0.1:2889:3889
    zoo3.cfg

    2、复制zkServer.cmd为zkServer2.cmd、zkServer3.cmd内容如下

    @echo off
    
    setlocal
    call "%~dp0zkEnv.cmd"
    
    set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
    set ZOO_LOG_FILE=zookeeper-%USERNAME%-server-%COMPUTERNAME%.log
    set ZOOCFG=D:DevelopmentZKKapache-zookeeper-3.6.2-binconfzoo.cfg
    
    echo on
    call %JAVA% "-Dzookeeper.extendedTypesEnabled=true" "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" "-Dzookeeper.log.file=%ZOO_LOG_FILE%" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%%%p /t /f" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*
    
    endlocal
    zkServer.cmd
    @echo off
    
    setlocal
    call "%~dp0zkEnv.cmd"
    
    set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
    set ZOO_LOG_FILE=zookeeper-%USERNAME%-server-%COMPUTERNAME%.log
    set ZOOCFG=D:DevelopmentZKKapache-zookeeper-3.6.2-binconfzoo2.cfg
    
    echo on
    call %JAVA% "-Dzookeeper.extendedTypesEnabled=true" "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" "-Dzookeeper.log.file=%ZOO_LOG_FILE%" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%%%p /t /f" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*
    
    endlocal
    zkServer2.cmd
    @echo off
    
    setlocal
    call "%~dp0zkEnv.cmd"
    
    set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
    set ZOO_LOG_FILE=zookeeper-%USERNAME%-server-%COMPUTERNAME%.log
    set ZOOCFG=D:DevelopmentZKKapache-zookeeper-3.6.2-binconfzoo3.cfg
    
    echo on
    call %JAVA% "-Dzookeeper.extendedTypesEnabled=true" "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" "-Dzookeeper.log.file=%ZOO_LOG_FILE%" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%%%p /t /f" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*
    
    endlocal
    zkServer3.cmd

    3、在各自的dataDir文件夹下新增一个文件名为myid的文件。内容为节点的唯一标识。我这里dataDir的myid为1,dataDir2的myid为2,dataDir3的myid为3,

    4、依次启动zkServer.cmd、zkServer2.cmd、zkServer3.cmd不按照顺序启动也可

  • 相关阅读:
    RHEL7 timedatectl命令
    广告点击率的贝叶斯平滑
    Expectation Propagation: Theory and Application
    微博推荐算法学习(Weibo Recommend Algolrithm)
    百度技术沙龙第48期回顾:大规模机器学习(含资料下载)
    内容匹配广告投放技术4:网盟CTR预估(百度文库课程)
    Logistic Regression的几个变种
    广告点击率预测 [离线部分]
    GBDT(MART) 迭代决策树入门教程 | 简介
    xgboost: 速度快效果好的boosting模型
  • 原文地址:https://www.cnblogs.com/yibao/p/14088705.html
Copyright © 2011-2022 走看看