Reputation: 2931
I am trying to set up a single zookeeper instance using the configuration below , however the start log indicates that the zookeeper is halting while trying to bind the port 2181.Can some one please let me know the issue here. Thank you.
Start up Log;
2014-07-18 16:00:48,976 [myid:] - INFO [main:QuorumPeerConfig@103] - Reading configuration from: /opt/zookeeper/bin/../conf/zoo.cfg
2014-07-18 16:00:48,980 [myid:] - ERROR [main:QuorumPeerConfig@289] - Invalid configuration, only one server specified (ignoring)
2014-07-18 16:00:48,982 [myid:] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2014-07-18 16:00:48,982 [myid:] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2014-07-18 16:00:48,983 [myid:] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2014-07-18 16:00:48,983 [myid:] - WARN [main:QuorumPeerMain@113] - Either no config or no quorum defined in config, running in standalone mode
2014-07-18 16:00:48,997 [myid:] - INFO [main:QuorumPeerConfig@103] - Reading configuration from: /opt/zookeeper/bin/../conf/zoo.cfg
2014-07-18 16:00:48,998 [myid:] - **ERROR** [main:QuorumPeerConfig@289] - Invalid configuration, only one server specified (ignoring)
2014-07-18 16:00:48,998 [myid:] - INFO [main:ZooKeeperServerMain@95] - Starting server
2014-07-18 16:00:49,007 [myid:] - INFO [main:Environment@100] - Server environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2014-07-18 16:00:49,007 [myid:] - INFO [main:Environment@100] - Server environment:host.name=<NA>
2014-07-18 16:00:49,007 [myid:] - INFO [main:Environment@100] - Server environment:java.version=1.7.0_51
2014-07-18 16:00:49,007 [myid:] - INFO [main:Environment@100] - Server environment:java.vendor=Oracle Corporation
2014-07-18 16:00:49,007 [myid:] - INFO [main:Environment@100] - Server environment:java.home=/usr/java/jdk1.7.0_51/jre
2014-07-18 16:00:49,007 [myid:] - INFO [main:Environment@100] - Server environment:java.class.path=/opt/zookeeper/bin/../build/classes:/opt/zookeeper/bin/../build/lib/*.jar:/opt/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/opt/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/opt/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/opt/zookeeper/bin/../lib/log4j-1.2.16.jar:/opt/zookeeper/bin/../lib/jline-0.9.94.jar:/opt/zookeeper/bin/../zookeeper-3.4.6.jar:/opt/zookeeper/bin/../src/java/lib/*.jar:/opt/zookeeper/bin/../conf:
2014-07-18 16:00:49,008 [myid:] - INFO [main:Environment@100] - Server environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2014-07-18 16:00:49,010 [myid:] - INFO [main:Environment@100] - Server environment:java.io.tmpdir=/tmp
2014-07-18 16:00:49,010 [myid:] - INFO [main:Environment@100] - Server environment:java.compiler=<NA>
2014-07-18 16:00:49,010 [myid:] - INFO [main:Environment@100] - Server environment:os.name=Linux
2014-07-18 16:00:49,010 [myid:] - INFO [main:Environment@100] - Server environment:os.arch=amd64
2014-07-18 16:00:49,011 [myid:] - INFO [main:Environment@100] - Server environment:os.version=3.10.0-123.4.2.el7.x86_64
2014-07-18 16:00:49,011 [myid:] - INFO [main:Environment@100] - Server environment:user.name=root
2014-07-18 16:00:49,011 [myid:] - INFO [main:Environment@100] - Server environment:user.home=/root
2014-07-18 16:00:49,011 [myid:] - INFO [main:Environment@100] - Server environment:user.dir=/opt/zookeeper/bin
2014-07-18 16:00:49,018 [myid:] - INFO [main:ZooKeeperServer@755] - tickTime set to 2000
2014-07-18 16:00:49,018 [myid:] - INFO [main:ZooKeeperServer@764] - minSessionTimeout set to -1
2014-07-18 16:00:49,018 [myid:] - INFO [main:ZooKeeperServer@773] - maxSessionTimeout set to -1
2014-07-18 16:00:49,029 [myid:] - INFO [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181
Zookeeper Config File.
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/opt/zookeeper/data
# the port at which the clients will connect
clientPort=2181
#log directory.
dataLogDir=/opt/zookeeper/log
server.1=localhost:2888:3888
# 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
Upvotes: 12
Views: 17719
Reputation: 3
my configuration file (zoo.cfg) in single mode is here and its work correctly:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=5
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=2
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/zookeeper/data
# the port at which the clients will connect
clientPort=2181
admin.serverPort=8081
4lw.commands.whitelist=*
# 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
## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
Upvotes: 0
Reputation: 7847
If you are running a standalone zookeeper for test/dev, comment this line in zoo.cfg
: #server.1=localhost:2888:3888
Then, instead of:
ERROR [main:QuorumPeerConfig@289] - Invalid configuration, only one server specified (ignoring)
You will see:
WARN [main:QuorumPeerMain@125] - Either no config or no quorum defined in config, running in standalone mode
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888The entries of the form server.X list the servers that make up the ZooKeeper service. When the server starts up, it knows which server it is by looking for the file myid in the data directory. That file has the contains the server number, in ASCII.
Finally, note the two port numbers after each server name: " 2888" and "3888". Peers use the former port to connect to other peers. Such a connection is necessary so that peers can communicate, for example, to agree upon the order of updates. More specifically, a ZooKeeper server uses this port to connect followers to the leader. When a new leader arises, a follower opens a TCP connection to the leader using this port. Because the default leader election also uses TCP, we currently require another port for leader election. This is the second port in the server entry.
Upvotes: 0
Reputation: 764
On CentOS you can edit the following file and add the line for _JAVA_OPTIONS
sudo vim /etc/default/zookeeper
export _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"
Then restart process
sudo service zookeeper-server restart
Upvotes: 0
Reputation: 25
Are you running zookeeper it on Windows 64 bit. I was having the same problem but then figured out that Win64 is not supported. See the Zookeeper link http://zookeeper.apache.org/doc/r3.4.5/zookeeperAdmin.html#sc_supportedPlatforms
Upvotes: -3
Reputation: 485
I suggest you to remove the following line from your configuration file
server.1=localhost:2888:3888
and then restart the server.
Upvotes: 0
Reputation: 2931
I would to mention that when you get the following logging message it means the server is actually started.
INFO [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181
Also the ERROR message that you see if you have a single zookeeper instance as below is actually a warning rather than an error.
2014-07-18 16:00:48,980 [myid:] - ERROR [main:QuorumPeerConfig@289] - Invalid configuration, only one server specified (ignoring)
Upvotes: -1