一、安装zookeeper
1、下载zookeeper
选择需要的版本:http://mirror.bit.edu.cn/apache/zookeeper/
2、上传到Linux指定目录并解压
[root@localhost zookeeper]# tar -zxvf zookeeper-3.4.13.tar.gz
3、进入zk的根目录创建一个data文件夹,用来保存zk的log信息
[root@localhost zookeeper-3.4.13]# mkdir data
4、进入conf 文件夹修改zoo_sample.cfg 为zoo.cfg
5、修改zoo.conf中的datalogDir路径
dataDir=/usr/local/java/zookeeper/zookeeper-3.4.13/data
配置文件中参数说明:
tickTime : 服务器与客户端之间交互的基本时间单元(ms)
dataDir : 保存zookeeper数据路径
dataLogDir : 保存zookeeper的日志路径,当此配置不存在时默认路径与dataDir一致
clientPort : 客户端访问zookeeper时经过服务器端时的端口号
6、配置zk环境变量
export ZOOKEEPER_HOME=/usr/local/java/zookeeper/zookeeper-3.4.13
export PATH=$ZOOKEEPER_HOME/bin;$ZOOKEEPER_HOME/conf
7、启动zookeeper
进入bin目录
启动:
[root@localhost bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/java/zookeeper/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
停止:
[root@localhost bin]# ./zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /usr/local/java/zookeeper/zookeeper-3.4.13/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
8、将zookeeper设置为开机启动
(1)在/etc/rc.d/init.d目录下新建zookeeper文件
[root@localhost ~]# vim /etc/init.d/zookeeper
(2)编辑文件加入以下代码
#!/bin/bash
#chkconfig: 2345 10 90
#description: service zookeeper
export JAVA_HOME=/usr/local/java/jdk1.8.0_181
export ZOO_LOG_DIR=/usr/local/java/zookeeper/log
ZOOKEEPER_HOME=/usr/local/java/zookeeper/zookeeper-3.4.13
su root ${ZOOKEEPER_HOME}/bin/zkServer.sh "$1"
(3)为新建的/etc/rc.d/init.d/zookeeper文件添加可执行的权限
[root@localhost ~]# chmod +x /etc/rc.d/init.d/zookeeper
(4)把zookeeper这个脚本添加到开机启动项里面,命令是
[root@localhost zookeeper]# chkconfig --add zookeeper
(5)查看是否添加成功,命令是:
[root@localhost ~]# chkconfig --list
(6)重启机器看是否开机启动
[root@localhost ~]# reboot
9、防火墙设置添加8161和61616端口号
[root@localhost bin]# firewall-cmd --zone=public --add-port=2181/tcp --permanent
success
[root@localhost bin]# firewall-cmd --reload
success
二、安装dubbo-admin
(1)下载
https://www.cnblogs.com/xhkj/p/7407092.html
(2)将doubbo-admin.war放到Linux中tomcat的webapps文件夹下面
(3)启动dubbo-admin
注意:启动tomcat之前我们需要把zookeeper启动起来
启动tomcat后我们就可以在访问了。