1. Configuration Preparation Work
1) Configure ZooKeeper preparation work
2) Configuration Considerations
- Download the relevant software in advance, and the installation directory is best installed in the full English path. If the path has a Chinese name, there may be some inexplicable problems.
3) Sample Configuration environment
- MacOS 10.11.6
- MacOS 10.13.3
2, Configuration ZooKeeper
1) Download ZooKeeper
- Download ZooKeeper on the website.
- After the download is complete, unzip the download package to the
/Library
directory and name it ZooKeeper, and other directories are available.
2) Modify directory Permissions
3) Configure Environment variables
Open the terminal and enter the following command to open the .bash_profile
file
$ vim ~/.bash_profile
Add a command to set environment variables in this file
export ZK_HOME=/Library/ZooKeeperexport PATH=$PATH:$ZK_HOME/bin
Save and exit after adding, execute the following command in terminal to make the configuration take effect
$ source ~/.bash_profile
4) Edit the configuration file
/Library/ZooKeeper/conf/
under Directory, create a new file named zoo.cfg
, with the following content
# zookeeper 中使用的基本时间单位, 毫秒值.tickTime=2000# 数据目录. 可以是任意目录.dataDir=/Users/QianChia/ApacheZooKeeper/data # log 目录, 同样可以是任意目录. 如果没有设置该参数, 将使用和 #dataDir 相同的设置.dataLogDir=/Users/QianChia/ApacheZooKeeper/logs# 监听 client 连接的端口号clientPort=2181
5) See if the configuration is in effect
Start the ZooKeeper process by entering the following command at the terminal
$ zkServer.sh start
If the following occurs, the ZooKeeper Server process that is running in the background is started successfully.
ZooKeeper JMX enabled by defaultUsing config: /Library/ZooKeeper/bin/../conf/zoo.cfgStarting zookeeper ... STARTED
Stop ZooKeeper Process command
$ zkServer.sh stop
Mac Apache ZooKeeper Configuration