搭建Zookeeper环境
1、下载安装包:https://www.apache.org/dyn/closer.cgi/zookeeper/
2、下载后放到服务器上,解压
解压命令:tar -xvf file.tar //解压 tar包
tar -xzvf file.tar.g-z //解压tar.gz
3、在zookeeper解压文件夹中创建logs文件夹和data文件夹,用于存放日志和数据
4、进入config目录,复制一份zoo_sample.cfg为zoo.cfg,对其进行修改
配置dataDir和dataLogDir的路径,为之前创建的两个文件夹的路径,client使用默认的2181端口即可
tickTime:Zookeeper 服务器之间或客户端与服务器之间心跳的时间间隔。
dataDir:Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
clientPort:Zookeeper 服务器监听端口,用来接受客户端的访问请求
5启动服务,一定要加上sudo! 还可用 start-foreground 启动时可看见日志信息