virtualBox CentOS7 安装zookeeper

 - 安装zookeeper

  1.  下载后解压:    tar -zxvf zookeeper-3.4.9.tar.gz;
  2.  解压后配置zoo.cfg: 进入解压文件夹的conf目录,复制zoo_sample.cfg(cp zoo_smaple.cfg  zoo.cfg)
  3. 修改dataDir 配置数据文件夹路径,创建相应文件夹。在最下面添加服务器地址。我的配置是单机模式,只有一个服务。并且在数据文件目录下创建相应临时文件夹myid,对应服务器编号(echo "1">/root/zkdata/myid)
# 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.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/root/zkdata
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

server.1=192.168.125.118:2888:3888
~


 - 启动zookeeper

  • 1. 启动ZK服务:       sh bin/zkServer.sh start
  • 2. 查看ZK服务状态: sh bin/zkServer.sh status
  • 3. 停止ZK服务:       sh bin/zkServer.sh stop
  • 4. 重启ZK服务:       sh bin/zkServer.sh restart

这里我启动成功以后,查看状态时,发现没有运行。结果是没有安装JDK

可以查看bin下的zookeeper.out 查看报错信息。一开始我的是没有这个文件,后来多启动了几次就有了。不知道什么原因。


 - 安装jdk

解压以后配置环境变量

vi /etc/profile

#java environment
export JAVA_HOME=/usr/local/services/jdk1.8.0_191
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

source  /etc/profile

但是java -version没有成功!!!
搞了半天,最后 env 查看环境变量,原来 JAVA_HOME路径后面加了个空格。。

装完以后,bin /zkServer.sh staus 就正常了。
 - Xshell远程本地虚拟机

virtualBox设置,然后查看CentOS7的IP地址,Xshell远程。但是rz,sz命令无效

yum install lrzsz

netstat  ifconfig无效

 yum install net-tools

virtualBox CentOS7 安装zookeeper_第1张图片

virtualBox CentOS7 安装zookeeper_第2张图片

 

你可能感兴趣的:(VirtualBox,CentOS7,Zookeeper,JDK,dubbo)