Reputation: 499
i'm new to zookeeper and started to run zookeeper and got this
Exception in thread "main" java.net.UnknownHostException: zoo1
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:848)
my zoo.cfg
tickTime=2000
dataDir=/home/st/storm/datadir/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888
my /etc/hosts is
127.0.0.1 localhost
127.0.1.1 ubuntu
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
Upvotes: 0
Views: 1645
Reputation: 3172
The problem is that in your zoo.cfg you have the following lines
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888
zoo1, zoo2 and zoo3 need to be replaced with actual IP addresses. Such as,
server.1=192.168.1.100:2888:3888
server.2=192.168.1.101:2888:3888
server.3=192.168.1.102:2888:3888
Or whatever the actual IP addresses that your zookeeper nodes are located at.
EDIT
If you only have zookeeper running on one machine and therefore one ip address. You would change the config to be something similar.
server.1=192.168.1.100:2888:3888
Since you only have one ip address you only need one entry in configuration. The number of zookeeper nodes you have is up to you to decide, 3 isn't a magic number. Though the more machines you you'll have more redundancy.
Upvotes: 1