Apache Zookeeper 多节点集群不运行
Apache Zookeeper multi-nodes cluster not running
我正在按照 http://jayatiatblogs.blogspot.com/2011/11/storm-installation.html & http://seaip.narlabs.org.tw/upload/content_file/547c1db495987.pdf 在 Amazon Web Services EC2 的 Ubuntu 14.04 LTS 上设置我的 Apache Storm 和 Apache Zookeeper 集群。
以下是我的 zoo.cfg 从属节点:
## The number of milliseconds of each tick. The length of a single tick, which i
s the basic time unit used by ZooKeeper, as measured in milliseconds.
## It is used to regulate heartbeats, and timeouts. For example, the minimum ses
sion timeout will be 2 ticks.
tickTime=2000
## The number of ticks that the initial synchronization phase can take
## The new entry, initLimit is timeouts ZooKeeper uses to limit the length of ti
me the ZooKeeper servers in quorum have to connect to a leader.
initLimit=1000
## The number of ticks that can pass between sending a request and getting an ac
knowledgement
## Amount of time, in ticks to allow followers to sync with ZooKeeper. If follow
ers fall too far behind a leader, they will be dropped.
## The entry syncLimit limits how far out of date a server can be from a leader.
syncLimit=500
## The directory where the snapshot is stored. The location where ZooKeeper will
store the in-memory database snapshots and, unless specified otherwise, the tra
nsaction log of updates to the database.
dataDir=/home/ubuntu/zookeeper-data
## The location of the log file. Write the transaction log to the dataLogDir rat
her than the dataDir.
#dataLogDir=/home/ubuntu/zookeeper/log/data_log
## The port to listen for client connections; that is, the port that clients att
empt to connect to.
clientPort=2181
## No need to put in standalone mode
## server.id = host:port:port
server.1=10.0.0.79:2888:3888
server.2=10.0.0.124:2888:3888
server.3=10.0.0.84:2888:3888
## The number of snapshots to retain in dataDir
## When enabled, ZooKeeper auto purge feature retains the autopurge.snapRetainCo
unt most recent snapshots and the corresponding transaction logs in the dataDir
and dataLogDir respectively and deletes the rest.
## Defaults to 3. Minimum value is 3.
autopurge.snapRetainCount=3
## Purge task interval in hours. Enable regular purging of old data and transact
ion logs every 24 hours
## Set to "0" to disable auto purge feature
## The time interval in hours for which the purge task has to be triggered. Set
to a positive integer (1 and above) to enable the auto purging. Defaults to 0.
autopurge.purgeInterval=1
我的slave节点的storm.conf如下:
########### These MUST be filled in for a storm configuration
storm.zookeeper.server:
- "10.0.0.79"
- "10.0.0.124"
- "10.0.0.84"
# - "localhost"
storm.zookeeper.port: 2181
# storm.zookeeper.port: 2888:3888
# nimbus.host: "localhost"
nimbus.host: "10.0.0.185"
# nimbus.thrift.port: 6627
#
#ui.port: 8772
#
storm.local.dir: "/home/ubuntu/storm/data"
java.library.path: "/usr/lib/jvm/java-7-oracle"
supervisor.slots.ports:
- 6700
- 6701
- 6702
- 6703
- 6704
#
# worker.childopts: "-Xmx768m"
# nimbus.childopts: "-Xmx512m"
# supervisor.childopts: "-Xmx256m"
#
# ##### These may optionally be filled in:
#
## List of custom serializations
# topology.kryo.register:
# - org.mycompany.MyType
# - org.mycompany.MyType2: org.mycompany.MyType2Serializer
#
## List of custom kryo decorators
# topology.kryo.decorators:
# - org.mycompany.MyDecorator
#
## Locations of the drpc servers
# drpc.servers:
# - "server1"
# - "server2"
## Metrics Consumers
# topology.metrics.consumer.register:
# - class: "backtype.storm.metric.LoggingMetricsConsumer"
# parallelism.hint: 1
# - class: "org.mycompany.MyMetricsConsumer"
# parallelism.hint: 1
# argument:
# - endpoint: "metrics-collector.mycompany.org"
zookeeper/conf处的myid对于10.0.0.79是1,对于10.0.0.124是2,对于10.0.0.84是3。
但是,当我使用 zkServer.sh 启动 运行 我的 Apache Zookeeper 时,然后我使用 zkServer.sh 状态显示状态,此消息显示:
JMX enabled by default
Using config: /home/ubuntu/zookeeper/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
当我从其中一个从属节点发出命令时,例如来自 10.0.0.124: zkCli.sh -server 10.0.0.84:2181 ,错误如下所示:
2015-05-27 04:44:03,745 [myid:] - INFO [main-SendThread(10.0.0.84:2181):ClientC nxn$SendThread@975] - Opening socket connection to server 10.0.0.84/10.0.0.84:21 81. Will not attempt to authenticate using SASL (unknown error)
Welcome to ZooKeeper!
2015-05-27 04:44:03,761 [myid:] - WARN [main-SendThread(10.0.0.84:2181):ClientC nxn$SendThread@1102] - Session 0x0 for server null, unexpected error, closing so cket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744 )
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocket NIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
JLine support is enabled
[zk: 10.0.0.84:2181(CONNECTING) 0]
有人知道可能的原因是什么以及如何解决吗?
我认为 zookeeper 运行 不正确。
myid 文件应该位于 dataDir=/home/ubuntu/zookeeper-data 而不是 conf 目录。
我正在按照 http://jayatiatblogs.blogspot.com/2011/11/storm-installation.html & http://seaip.narlabs.org.tw/upload/content_file/547c1db495987.pdf 在 Amazon Web Services EC2 的 Ubuntu 14.04 LTS 上设置我的 Apache Storm 和 Apache Zookeeper 集群。
以下是我的 zoo.cfg 从属节点:
## The number of milliseconds of each tick. The length of a single tick, which i
s the basic time unit used by ZooKeeper, as measured in milliseconds.
## It is used to regulate heartbeats, and timeouts. For example, the minimum ses
sion timeout will be 2 ticks.
tickTime=2000
## The number of ticks that the initial synchronization phase can take
## The new entry, initLimit is timeouts ZooKeeper uses to limit the length of ti
me the ZooKeeper servers in quorum have to connect to a leader.
initLimit=1000
## The number of ticks that can pass between sending a request and getting an ac
knowledgement
## Amount of time, in ticks to allow followers to sync with ZooKeeper. If follow
ers fall too far behind a leader, they will be dropped.
## The entry syncLimit limits how far out of date a server can be from a leader.
syncLimit=500
## The directory where the snapshot is stored. The location where ZooKeeper will
store the in-memory database snapshots and, unless specified otherwise, the tra
nsaction log of updates to the database.
dataDir=/home/ubuntu/zookeeper-data
## The location of the log file. Write the transaction log to the dataLogDir rat
her than the dataDir.
#dataLogDir=/home/ubuntu/zookeeper/log/data_log
## The port to listen for client connections; that is, the port that clients att
empt to connect to.
clientPort=2181
## No need to put in standalone mode
## server.id = host:port:port
server.1=10.0.0.79:2888:3888
server.2=10.0.0.124:2888:3888
server.3=10.0.0.84:2888:3888
## The number of snapshots to retain in dataDir
## When enabled, ZooKeeper auto purge feature retains the autopurge.snapRetainCo
unt most recent snapshots and the corresponding transaction logs in the dataDir
and dataLogDir respectively and deletes the rest.
## Defaults to 3. Minimum value is 3.
autopurge.snapRetainCount=3
## Purge task interval in hours. Enable regular purging of old data and transact
ion logs every 24 hours
## Set to "0" to disable auto purge feature
## The time interval in hours for which the purge task has to be triggered. Set
to a positive integer (1 and above) to enable the auto purging. Defaults to 0.
autopurge.purgeInterval=1
我的slave节点的storm.conf如下:
########### These MUST be filled in for a storm configuration
storm.zookeeper.server:
- "10.0.0.79"
- "10.0.0.124"
- "10.0.0.84"
# - "localhost"
storm.zookeeper.port: 2181
# storm.zookeeper.port: 2888:3888
# nimbus.host: "localhost"
nimbus.host: "10.0.0.185"
# nimbus.thrift.port: 6627
#
#ui.port: 8772
#
storm.local.dir: "/home/ubuntu/storm/data"
java.library.path: "/usr/lib/jvm/java-7-oracle"
supervisor.slots.ports:
- 6700
- 6701
- 6702
- 6703
- 6704
#
# worker.childopts: "-Xmx768m"
# nimbus.childopts: "-Xmx512m"
# supervisor.childopts: "-Xmx256m"
#
# ##### These may optionally be filled in:
#
## List of custom serializations
# topology.kryo.register:
# - org.mycompany.MyType
# - org.mycompany.MyType2: org.mycompany.MyType2Serializer
#
## List of custom kryo decorators
# topology.kryo.decorators:
# - org.mycompany.MyDecorator
#
## Locations of the drpc servers
# drpc.servers:
# - "server1"
# - "server2"
## Metrics Consumers
# topology.metrics.consumer.register:
# - class: "backtype.storm.metric.LoggingMetricsConsumer"
# parallelism.hint: 1
# - class: "org.mycompany.MyMetricsConsumer"
# parallelism.hint: 1
# argument:
# - endpoint: "metrics-collector.mycompany.org"
zookeeper/conf处的myid对于10.0.0.79是1,对于10.0.0.124是2,对于10.0.0.84是3。 但是,当我使用 zkServer.sh 启动 运行 我的 Apache Zookeeper 时,然后我使用 zkServer.sh 状态显示状态,此消息显示:
JMX enabled by default
Using config: /home/ubuntu/zookeeper/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
当我从其中一个从属节点发出命令时,例如来自 10.0.0.124: zkCli.sh -server 10.0.0.84:2181 ,错误如下所示:
2015-05-27 04:44:03,745 [myid:] - INFO [main-SendThread(10.0.0.84:2181):ClientC nxn$SendThread@975] - Opening socket connection to server 10.0.0.84/10.0.0.84:21 81. Will not attempt to authenticate using SASL (unknown error)
Welcome to ZooKeeper!
2015-05-27 04:44:03,761 [myid:] - WARN [main-SendThread(10.0.0.84:2181):ClientC nxn$SendThread@1102] - Session 0x0 for server null, unexpected error, closing so cket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744 )
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocket NIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
JLine support is enabled
[zk: 10.0.0.84:2181(CONNECTING) 0]
有人知道可能的原因是什么以及如何解决吗?
我认为 zookeeper 运行 不正确。
myid 文件应该位于 dataDir=/home/ubuntu/zookeeper-data 而不是 conf 目录。