Problem scenario
You want to set up Zookeeper with three nodes in AWS. What do you do?
Solution
1. Install Zookeeper on each of the servers. If you need assistance with this, see this posting.
2. Modify the zoo.cfg file on each of the servers. Add stanzas like these but substitute foobarX.amazonaws.com with the Public DNS name of each server:
server.1=foobar1.amazonaws.com:2888:3888
server.2=foobar2.amazonaws.com:2888:3888
server.3=foobar3.amazonaws.com:2888:3888
initLimit=5
syncLimit=5
3. The assignment of server.1, server.2, and server.3 should each be the exact same. That is, zoo.cfg should be the same on each server.
4. Create a file /var/zookeeper/myid on each server. The value should be either a 1, 2, or 3 based on the server.X assignments above. So the server with the Public DNS name of foobar2.amazonaws.com should have a file /var/zookeeper/id with "2" (with no quotes) because it was assigned in zoo.cfg with the value server.2.
5. Make sure the Security Group governing the servers allow for connectivity based on the internal IP address of each server. The servers need to communicate with each other.
6. Go to your zookeeper directory (e.g., /bin/zookeeper-3.4.13/
) and go to the bin subdirectory there in.
7. Run this command: sudo bash zkServer.sh start-foreground