当前位置:   article > 正文

010_redhat安装zookeeper

010_redhat安装zookeeper

1.环境准备

准备一台linux服务器
ZooKeeper服务器是用Java创建的,它运行在JVM之上。需要安装JDK 7或更高版本。
我测试安装的jdk1.8

2.下载上传zookeeper安装包

1)官网下载zookeeper-3.6.4安装包

apache-zookeeper-3.6.4-bin.tar.gz
  • 1

2)创建soft文件夹

#根目录创建 /soft
mkdir soft
#使用终端工具把下载的zookeeper安装包上传到服务器上 /soft 目录下
  • 1
  • 2
  • 3

3.解压

将tar包解压到/usr/local/目录下

tar -zxvf apache-zookeeper-3.6.4-bin.tar.gz  -C /usr/local/
  • 1

4.配置启动

1、配置zoo.cfg

进入到conf目录拷贝一个zoo_sample.cfg并完成配置

#进入到conf目录
[root@rhel local]# cd /usr/local/apache-zookeeper-3.6.4-bin/conf
#拷贝
cp  zoo_sample.cfg  zoo.cfg

#打开目录
[root@rhel local]# cd /usr/local/apache-zookeeper-3.6.4-bin
#创建zooKeeper存储目录
[root@rhel apache-zookeeper-3.6.4-bin]# mkdir zkdata
#修改zoo.cfg
vim /opt/zooKeeper/apache-zooKeeper-3.5.6-bin/conf/zoo.cfg


# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/usr/local/apache-zookeeper-3.6.4-bin/zkdata
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#

#修改存储目录:dataDir=/usr/local/apache-zookeeper-3.6.4-bin/zkdata
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

2、启动zookeeper

cd /opt/zooKeeper/apache-zooKeeper-3.5.6-bin/bin/

 ./zkServer.sh  start
#启动
[root@rhel bin]# ./zkServer.sh  start
#启动成功	Starting zookeeper ... STARTED
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.6.4-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
#查看zookeeper状态	standalone代表zk没有搭建集群,现在是单节点
[root@rhel bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.6.4-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

小结

zookeeper的安装在RedHat与CentOS、ubuntu 等Linux系统下的安装基本相同,我是在redhat系统中操作的,安装步骤做个记录,仅供参考。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/551190
推荐阅读
相关标签
  

闽ICP备14008679号