Stand-alone mode:
1: modify the hosts file
2: download, unzip the file zookeeper.tar
3: Create a data directory and logs directories
Create a directory into the zookeeper
4: a copy of zoo_sample.cfg profile and renamed zoo.cfg
In the conf directory
5: modify the configuration file zoo.cfg
6: Creating myid
Myid new file in the directory data, and add a value of 1
7: jdk installation slightly
8: Start zookeeper
bin/zkServer.sh start
distributed:
1, modify the hosts file (three hosts)
2, modify the host name (three hosts)
storm1 follows:
storm2:
HOSTNAME=storm2
storm3:
HOSTNAME=storm3
3, Jdk installation (three hosts)
(slightly)
4, upload and unzip files zookeeper / opt directory (three hosts)
(slightly)
5, the configuration ZooKeeper (three hosts)
① First zookeeper / conf / zoo_sample.cfg copy of the document, and changed its name to zoo.cfg
As shown below:
② Edit zoo.cfg file
The dataDir = / tmp / zookeeper deleted, and the new map data
③ create a directory
Both directories are written above zoo.cfg directory
mkdir -p /var/zookeeper/zkdata
mkdir -p /var/zookeeper/zkdatalog
④ Create a file
Create a directory on the file myid in zkdata created in step and increase the data, as follows
myid data server is a storm1
myid storm2 data server 2
myid data server is storm3 3
⑤ Zookeeper configuration environment variable
vi / etc / profile behind the increase in the following code:
#ZOOKEEPER
ZOOKEEPER=/home/hadoop/app/zookeeper
PATH=$PATH:$ZOOKEEPER/bin
Use the command to make the configuration changes take effect
source /etc/profile
6, start to see close zookeeper
Start zookeeper
bin/zkServer.sh start
Enter the jps command to see if started successfully, on behalf of QuorumPeerMain success
View zookeeper status
bin/zkServer.sh status
Stop zookeeper
bin/zkServer.sh stop