
zookeeper基本介绍:
A Distributed Coordination Service for Distributed Applications
ZooKeeper is a distributed, open-source coordination service for distributed applications. It exposes a simple set of primitives that distributed applications can build upon to implement higher level services for synchronization, configuration maintenance, and groups and naming. It is designed to be easy to program to, and uses a data model styled after the familiar directory tree structure of file systems. It runs in Java and has bindings for both Java and C.
Coordination services are notoriously hard to get right. They are especially prone to errors such as race conditions and deadlock. The motivation behind ZooKeeper is to relieve distributed applications the responsibility of implementing coordination services from scratch.
环境变量配置参考vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export HBASE_HOME=/usr/local/hbase-2.2.2
export PATH=$PATH:$JAVA_HOME/bin:$HBASE_HOME/bin
export HADOOP_HOME=/usr/local/hadoop-3.1.2
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
The configuration process:
一、三台linux虚拟机提前安装配置(略):操作系统CentOS Linux release 7.8.2003 (Core)
centos7镜像下载地址:(自备)
二、jdk环境
链接:https://pan.baidu.com/s/1Y4xDWmF3wTt6kq6xi3rfnQ
提取码:tnhs
三、zookeeper安装包
zookeeper-3.4.14.tar.gz下载地址:
链接:https://pan.baidu.com/s/1svJKuDRYMKWMEspIOghluw
提取码:bdnt
tar -zxvf zookeeper-3.4.14.tar.gz(解压)
cp zookeeper-3.4.14 zookeeper(重命名)
cp zoo_sample.cfg 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.
# do not use /tmp for storage, /tmp here is just
# example sakes.
# 修改数据存放的目录
dataDir=/usr/local/zookeeper/data
# 修改日志存放的目录
dataLogDir=/usr/local/zookeeper/logs
# the port at which the clients will connect
clientPort=2181
#
# 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
# zookeeper内嵌管理控制台是通过jetty启动的,会占用8080端口,如果要部署Tomcat之类的需要修改该端口
admin.serverPort=14400
# 集群服务器列表
server.1=***.***.**.***:2888:3888
server.2=***.***.**.***:2888:3888
server.3=***.***.**.***:2888:3888
手动创建dataDir=/usr/local/zookeeper/data, dataLogDir=/usr/local/zookeeper/logs这两个文件夹;
data下创建myid文件,配置集群服务器唯一标识(如: echo 1>/usr/local/zookeeper/data/myid ),不同服务器的标识不同,以zoo.cfg配置的为准。
注:zoo.cfg文件(data,logs文件路径,及节点server1\2\3),data文件夹中myid文件(数字1,2,3)
启动:bin目录下./zkServer.sh start
附:查看zookeeper状态:./zkServer.sh status


1439

被折叠的 条评论
为什么被折叠?



