qq_36359679 2017-09-12 15:25 采纳率: 16.7%
浏览 984

zookeeper小白,不知道配置文件错哪了,谢谢了

[root@itcast conf]# vim zoo.cfg

#
tickTime=2000
#
initLimit=10
#
syncLimit=5

dataDir=/root/zookeeper-3.4.6/data

the port at which the clients will connect

clientPort=2181

the maximum number of client connections.

increase this if you need to handle more clients

#maxClientCnxns=60
#

Be sure to read the maintenance section of the

administrator guide before turning on autopurge.

#

http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

#

The number of snapshots to retain in dataDir

#autopurge.snapRetainCount=3

Purge task interval in hours

Set to "0" to disable auto purge feature

#autopurge.purgeInterval=1
~
~
~
~
~
~
~
~
~
~
~
~
~
"zoo.cfg" 25L, 618C 已写入
报的错
Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /zoo2
网上说是配置文件的原因但我不知道错哪了

  • 写回答

1条回答 默认 最新

  • 蚂蚁冲锋队 2017-09-13 00:31
    关注

    ZK至少需要三台机器(或者虚拟机),我的机器分别为slave1,slave2,slave3。我自己搭建的过程如下:
    1、在salve1中操作,我的ZK目录为 ~/soft/zookeeper-3.4.5,首先复制一份配置文件
    cd ~/solf/zookeeper-3.4.5/conf
    cp zoo__sample.cfg zoo.cfg
    2、修改zoo.cfg,其他的配置默认就行
    nano zoo.cfg
    修改
    dataDir=/home/ubuntu/solf/zookeeper-3.4.5/tmp
    文件末尾添加
    server.1=slave1:2888:3888
    server.2=slave2:2888:3888
    server.3=slave3:2888:3888
    3、创建tmp文件
    cd ~/solf/zookeeper-3.4.5
    mkdir tmp
    cd tmp
    touch myid
    echo 1 > myid
    查看
    cat myid
    1
    表示配置成功
    4、将配置好的zookeeper-3.4.5发送至slave2、slave3
    cd ~/solf
    scp -r zookeeper-3.4.5 ubuntu@slave2:~/solf
    scp -r zookeeper-3.4.5 ubuntu@slave3:~/solf

    修改myid
    slave2下:
    echo 2 > myid

    slave3下:
    echo 3 > myid

    整个hadoop ha模式的搭建可参考我的博客
    hadoop搭建

    评论

报告相同问题?

悬赏问题

  • ¥15 优质github账号直接兑换rmb,感兴趣伙伴可以私信
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)