# https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
# ================================================================== Installing JDK
Mkdir-p/USR/JAVATAR-ZXVF ~/jdk-8u111-linux-x64.tar.gz-c/usr/javarm-r ~/jdk-8u111-linux-x64.tar.gz
# http://archive.apache.org/dist/zookeeper/
# ================================================================== Installation Zookeeper
# Zookeeper cluster build to at least 3 servers, the server will be deployed zookeeper
TAR-ZXVF ~/zookeeper-3.4.12.tar.gz-c/usr/localrm-r ~/zookeeper-3.4.12.tar.gz
# Configure Environment variables
# ==================================================================node1 Node2 Node3
vi/etc/profile# add export Histcontrol under Export PATH USER LOGNAME MAIL HOSTNAME histsize java_home=/usr/java/jdk1.8.0_ 111export zookeeper_home=/usr/local/zookeeper-3.4.12export path= $PATH: $JAVA _home/bin: $JAVA _home/jre/bin:$ Zookeeper_home/binexport classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
# ==================================================================node1
# Make environment variable effective source/etc/profile# Check for configuration success java-version# view configuration results echo $JAVA _homeecho $ZOOKEEPER _home# Create data file and log store directory mkdir $ ZOOKEEPER_HOME/{DATA,LOGS}CP $ZOOKEEPER _home/conf/zoo_sample.cfg $ZOOKEEPER _home/conf/zoo.cfgvi $ZOOKEEPER _home/ Conf/zoo.cfg
datadir=/usr/local/zookeeper-3.4.12/datadatalogdir=/usr/local/zookeeper-3.4.12/logsclientport= 2181autopurge.snapretaincount=3autopurge.purgeinterval=1server.1=node1:2888:3888server.2=node2 : 2888:3888server.3=node3:2888:3888vi $ZOOKEEPER _home/conf/log4j.propertieszookeeper.log.dir=/usr/local/ Zookeeper-3.4.12/logszookeeper.tracelog.dir=/usr/local/zookeeper-3.4.12/logs
# ==================================================================node2 Node3
Mkdir-p/usr/java
# Sync to other nodes
# ==================================================================node1
Scp-r $JAVA _home node2:/usr/java/scp-r $JAVA _home node3:/usr/java/scp-r $ZOOKEEPER _home node2:/usr/local/scp-r $ZOOKE Eper_home node3:/usr/local/
# ==================================================================node2 Node3
# Make environment variable effective source/etc/profile# Check for configuration success java-version# view configuration results echo $JAVA _homeecho $ZOOKEEPER _home
# Edit the myID separately in the Zookeeper data directory
# ==================================================================node1
echo "1" > $ZOOKEEPER _home/data/myid
# view myID
Cat $ZOOKEEPER _home/data/myid
# ==================================================================node2
echo "2" > $ZOOKEEPER _home/data/myid
# ==================================================================NODE3
echo "3" > $ZOOKEEPER _home/data/myid
# Start
# ==================================================================node1 Node2 Node3
zkserver.sh startzkserver.sh status# zkserver.sh stop# $ZOOKEEPER _home/bin/zkserver.sh start# $ZOOKEEPER _home/bin/ zkserver.sh status# $ZOOKEEPER _home/bin/zkserver.sh stopshutdown-h now# Snapshot ZOOKEEPER
# Do not configure Kafka SASL authentication configuration, wait until the Kafka is configured and then proceed.
# ==================================================================kafka SASL Certified Configuration
VI $ZOOKEEPER _HOME/CONF/ZOO.CFG
Authprovider.1=org.apache.zookeeper.server.auth.saslauthenticationprovider
Requireclientauthscheme=sasl
jaasloginrenew=3600000
# ================================================================== Reference
# Cat $ZOOKEEPER _home/conf/zoo.cfg
# Ticktime:cs Communication Heartbeat number
# The time interval between Zookeeper servers or between the client and server to maintain heartbeat, that is, each ticktime time sends a heartbeat. Ticktime in milliseconds
ticktime=2000
# INITLIMIT:LF initial communication time limit
# The maximum number of heartbeats (ticktime) that can be tolerated in the initial connection between the follower server (F) in the cluster and the leader server (L)
Initlimit=5
# SYNCLIMIT:LF Synchronous Communication time limit
# The maximum number of heartbeats (ticktime) that can be tolerated between the follower server in the cluster and the leader server between requests and responses
synclimit=2
# DataDir: Data file directory
# Zookeeper the directory where data is saved, by default, zookeeper log files that write data are also stored in this directory
Datadir=/usr/local/zookeeper-3.4.12/data
# Datalogdir: Log file directory
# Zookeeper directory where log files are saved
Datalogdir=/usr/local/zookeeper-3.4.12/logs
# clientport: Client Connection port
# The client connects to the port of the Zookeeper server, Zookeeper listens to the port and accepts the client's access request
clientport=2181
# Data files Save the last 3 snapshots, which are saved by default and take up a lot of disk space for a long time
Autopurge.snapretaincount=3
# The unit is hourly, and the snapshot data is cleaned up once per hour
Autopurge.purgeinterval=1
# server. n Server name and address
# Starting with N: Service number, service address, LF communication port, election port
server.1=node1:2888:3888
server.2=node2:2888:3888
server.3=node3:2888:3888
Hadoop Eco-building (3 node) -03.zookeeper configuration