centos 7下安装配置zookeeper

本文涉及的产品
服务治理 MSE Sentinel/OpenSergo,Agent数量 不受限
简介:

一、安装好java

二、配置 zookeeper:

1 、创建 /usr/local/services/zookeeper 文件夹:
     mkdir -p /usr/local/services/zookeeper
 
2 、进入到 /usr/local/services/zookeeper 目录中:
     cd /usr/local/services/zookeeper
 
3 、下载 zookeeper- 3.4 . 9 .tar.gz:
     wget https: //mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz
 
4 、解压缩 zookeeper- 3.4 . 9 .tar.gz:
     tar -zxvf zookeeper- 3.4 . 9 .tar.gz
 
5 、进入到 /usr/local/services/zookeeper/zookeeper- 3.4 . 9 /conf 目录中:
     cd zookeeper- 3.4 . 9 /conf/
 
6 、复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg:
     cp zoo_sample.cfg zoo.cfg
 
7 、用 vim 打开 zoo.cfg 文件并修改其内容为如下:
     # The number of milliseconds of each tick
 
     # zookeeper 定义的基准时间间隔,单位:毫秒
     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=/tmp/zookeeper
 
     # 数据文件夹
     dataDir=/usr/local/services/zookeeper/zookeeper- 3.4 . 9 /data
 
     # 日志文件夹
     dataLogDir=/usr/local/services/zookeeper/zookeeper- 3.4 . 9 /logs
 
     # the port at which the clients will connect
     # 客户端访问 zookeeper 的端口号
     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
 
8 、保存并关闭 zoo.cfg 文件:
     
9 、进入到 /usr/local/services/zookeeper/zookeeper- 3.4 . 9 /bin 目录中:
     cd ../bin/
 
10 、用 vim 打开 /etc/ 目录下的配置文件 profile:
     vim /etc/profile
     并在其尾部追加如下内容:
 
     # idea - zookeeper- 3.4 . 9  config start -  2016 - 09 - 08
 
     export ZOOKEEPER_HOME=/usr/local/services/zookeeper/zookeeper- 3.4 . 9 /
     export PATH=$ZOOKEEPER_HOME/bin:$PATH
     export PATH
 
     # idea - zookeeper- 3.4 . 9  config start -  2016 - 09 - 08
 
11 、使 /etc/ 目录下的 profile 文件即可生效:
     source /etc/profile
 
12 、启动 zookeeper 服务:
     zkServer.sh start
     如打印如下信息则表明启动成功:
     ZooKeeper JMX enabled by  default
     Using config: /usr/local/services/zookeeper/zookeeper- 3.4 . 9 /bin/../conf/zoo.cfg
     Starting zookeeper ... STARTED
 
13 、查询 zookeeper 状态:
     zkServer.sh status
 
14 、关闭 zookeeper 服务:
     zkServer.sh stop
     如打印如下信息则表明成功关闭:
     ZooKeeper JMX enabled by  default
     Using config: /usr/local/services/zookeeper/zookeeper- 3.4 . 9 /bin/../conf/zoo.cfg
     Stopping zookeeper ... STOPPED
 
15 、重启 zookeeper 服务:
     zkServer.sh restart
     如打印如下信息则表明重启成功:
     ZooKeeper JMX enabled by  default
     Using config: /usr/local/services/zookeeper/zookeeper- 3.4 . 9 /bin/../conf/zoo.cfg
     ZooKeeper JMX enabled by  default
     Using config: /usr/local/services/zookeeper/zookeeper- 3.4 . 9 /bin/../conf/zoo.cfg
     Stopping zookeeper ... STOPPED
     ZooKeeper JMX enabled by  default
     Using config: /usr/local/services/zookeeper/zookeeper- 3.4 . 9 /bin/../conf/zoo.cfg

    Starting zookeeper ... STARTED



如果出现 这类错误

[root@localhost ~]# /usr/zookeeper/bin/zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper/bin/../conf/zoo.cfg
Stopping zookeeper ... /usr/zookeeper/bin/zkServer.sh: 第 182 行:kill: (2453) - 没有那个进程 

解决:安装配置好java之后,需要赋予权限:

 chmod +x /usr/java/jdk1.8/bin/java                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    本文转自yunlielai51CTO博客,原文链接:http://blog.51cto.com/4925054/1920382,如需转载请自行联系原作者

相关实践学习
基于MSE实现微服务的全链路灰度
通过本场景的实验操作,您将了解并实现在线业务的微服务全链路灰度能力。
相关文章
|
3月前
|
应用服务中间件 Linux 网络安全
centos7 下离线安装gcc g++ nginx,并配置nginx进行网络流转发
centos7 下离线安装gcc g++ nginx,并配置nginx进行网络流转发
111 0
|
1月前
|
Java Linux
Flume【环境搭建 01】CentOS Linux release 7.5 安装配置 apache-flume-1.9.0 并验证
【2月更文挑战第16天】Flume【环境搭建 01】CentOS Linux release 7.5 安装配置 apache-flume-1.9.0 并验证
33 0
|
1月前
|
分布式计算 关系型数据库 MySQL
Sqoop【部署 01】CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
【2月更文挑战第8天】Sqoop CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
99 1
|
1天前
|
运维 网络协议 Linux
【运维系列】Centos7安装并配置PXE服务
PXE是Intel开发的预启动执行环境,允许工作站通过网络从远程服务器启动操作系统。它依赖DHCP分配IP,DNS服务分配主机名,TFTP提供引导程序,HTTP/FTP/NFS提供安装源。要部署PXE服务器,需关闭selinux和防火墙,安装dhcpd、httpd、tftp、xinetd及相关服务,配置引导文件和Centos7安装源。最后,通过syslinux安装引导文件,并创建pxelinux.cfg/default配置文件来定义启动参数。
5 0
|
1天前
|
运维 网络协议 Linux
【运维系列】Centos7安装并配置postfix服务
安装CentOS7的Postfix和Dovecot,配置Postfix的`main.cf`文件,包括修改完全域名、允许所有IP、启用邮箱等。然后,配置Dovecot的多个配置文件以启用auth服务和调整相关设置。重启Postfix和Dovecot,设置开机自启,并关闭防火墙进行测试。最后,创建邮箱账户并在Windows邮箱客户端中添加账户设置。
9 0
|
1天前
|
运维 Linux 网络安全
【运维系列】Centos7安装配置ntp服务
配置yum并安装ntp,编辑ntp配置文件,取消17行注释,适应本机网段,22行设置使用本地时间。关闭防火墙,重启ntp服务。测试时先关闭防火墙,然后使用ntpdate命令成功同步时间。
4 0
|
1天前
|
Linux 网络安全
Centos6.5安装并配置NFS服务
该内容描述了在Linux系统中设置NFS服务的步骤。首先挂载yum源,然后安装NFS服务,并编辑配置文件。接着,重启rpcbind和NFS服务,可能需要重复此过程以解决初始可能出现的问题。此外,关闭防火墙策略,并再次重启服务。最终,根目录被共享,特定IP网段被允许访问。
7 0
|
15天前
|
网络协议
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
15 0
|
1月前
|
运维 Linux 应用服务中间件
Centos7如何配置firewalld防火墙规则
Centos7如何配置firewalld防火墙规则
47 0
|
1月前
|
存储 监控 Linux
Flume【部署 02】Flume监控工具Ganglia的安装与配置(CentOS 7.5 在线安装系统监控工具Ganglia + 权限问题处理 + Flume接入监控配置 + 图例说明)
【2月更文挑战第17天】Flume【部署 02】Flume监控工具Ganglia的安装与配置(CentOS 7.5 在线安装系统监控工具Ganglia + 权限问题处理 + Flume接入监控配置 + 图例说明)
28 1
Flume【部署 02】Flume监控工具Ganglia的安装与配置(CentOS 7.5 在线安装系统监控工具Ganglia + 权限问题处理 + Flume接入监控配置 + 图例说明)