1.安装jdk配置环境变量
我买的阿里云服务器是Linux系统64,所以需要安装Linux64位jdk,可以oracle官方下载,但是速度太慢,
建议百度云盘寻找资源

jdk版本
2.添加阿里云安全组件

步骤一
点击箭头所指

步骤二

步骤三

步骤四
3.安装zookeeper
我是通过使用xftp把zookeeper传到服务器上,当然也有其它方法.
安装zookeeper的步骤:
1.解压文件夹
tar -zxvf zookeeper-3.5.4-beta.tar.gz
2.修改conf目录
zoo_sample.cfg为样例配置文件,需要修改为自己的名称,一般为zoo.cfg
cp zoo_sample.cfg zoo.cfg
3.编辑zoo.cfg文件,修改为:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# 指定数据存放目录
dataDir=/usr/zookeeper
# log 存放目录
dataLogDir=/usr/zookeeper/log
# the port at which the clients will connect
# 端口号
clientPort=2181
配置文件简单解析:
1、tickTime:这个时间是作为Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。
2、dataDir:顾名思义就是Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
3、dataLogDir:顾名思义就是Zookeeper 保存日志文件的目录
4、clientPort:这个端口就是客户端连接Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。
4.启动zookeeper
到bin目录下
./zkServer.sh start 启动
./zkServer.sh status 查看状态,看看是否启动成功
./zkServer.sh stop 关闭zookeeper服务