ZooKeeper installation use – stand-alone mode

1.version package preparation

zookeeper-3.4.5.tar.gz< /p>

2.mkdir zookeeper folder.tar the package

mkdir zookeeper
tar xvf zookeeper-3.4.5.tar.gz

[[emailprotected] zookeeper]# pwd
/root/zookeeper
[[emailprotected] zookeeper]# ll
total
16024
drwxr
-xr-x. 12 501 games 4096 Jan 30 07:30 zookeeper-3.4.5
-rw-r--r--. 1< /span> root root 16402010 Apr 29 2018 zookeeper-3.4.5.tar.gz
[[email protected] zookeeper]#

3. The zookeeper -Copy the zoo_sample.cfg file in the 3.4.10/conf directory and name it zoo.cfg. Then modify the zoo.cfg file

# 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/zookeeper/zookeeper-3.4.5/data dataLogsDir=/root/zookeeper/zookeeper-3.4.5/logs< /strong>
# 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
#
server.
1=192.168.106.133:2888:3888
# 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

4. Configure myid file

path: dataDir=/root/zookeeper/zookeeper-3.4.5/data Create myid file ( Edit the myid file and enter the corresponding number on the corresponding IP machine. For example, on zookeeper, the content of the myid file is 1. If you only install and configure on a single point, there is only one server. 1)

5. Modify .bash_profile, add zookeeper configuration: path = etc/profile, edit the profile folder to take effect: source etc /profile

# zookeeper env export 
ZOOKEEPER_HOME
=/root/zookeeper/zookeeper-3.4.5 export
PATH
=$ZOOKEEPER_HOME/bin:$PATH

6. Turn off the firewall

systemctl stop firewalld.service

7. Test Zookeeper

Switch to the /root/zookeeper/zookeeper-3.4.5/bin directory to execute

./zkServer.sh start 

#View process
jps

Among them, QuorumPeerMain is the zookeeper process, which starts normally.

#View status
.
/zkServer.sh status

#Server output information
tail -500f zookeeper.out

#Stop the zookeeper process
.
/zkServer.sh stop

8. Set the zookeeper service to boot up

# Switch to /etc/rc.d/init.d/Under the directory
cd
/etc/rc.d/init.d
[[emailprotected] init.d]# pwd
-rwxr-xr-x. 1 root root 565 Jan 30 07:36 zookeeper

/etc/rc.d/init.d
# Create zookeeper file
touch zookeeper

#Update permissions
chmod +x zookeeper

#Edit the file and enter the following content in zookeeper

# chkconfig : 2345 10 90
# description: zookeeper
#processname:zookeeper
export JAVA_HOME=/root/jdk/jdk1.8.0_171
export PATH=$JAVA_HOME/bin:$PATH
case $1 in
start)su root /root/zookeeper/zookeeper-3.4.5/bin/zkServer.sh start;;
stop)su root /root/zookeeper/zookeeper-3.4.5/bin/zkServer. sh stop;;
status)su root /root/zookeeper/zookeeper-3.4.5/bin/zkServer.sh status;;
restart)su root /root/zookeeper/zookeeper-3.4.5/bin/ zkServer.sh restart;;
*) echo “require start|stop|status|restart” ;;
esac

 

chkconfig –list verify whether zookeeper is added to boot

[[emailprotected] init.d]# chkconfig --< span style="color: #000000">list
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network
0:off 1:off 2 span>:on 3:on 4:on 5:on 6:off
zookeeper < /span>0:off 1:off 2:on 3:on 4:on 5:on 6:off
[[emailprotected] init.d]#

mkdir zookeeper
tar xvf zookeeper-3.4.5.tar.gz

[[emailprotected] zookeeper]# pwd
/root/zookeeper
[[emailprotected] zookeeper]# ll
total
16024
drwxr
-xr-x. 12 501 games 4096 Jan 30 07:30 zookeeper-3.4 .5
-rw-r--r--. 1 root root < span style="color: #800080">16402010 Apr 29 2018 zookeeper- 3.4.5.tar .gz
[[emailprotected] zookeeper]#

# The number of milliseconds of each tick
tickTime
=2000< br /># 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 direct ory where the snapshot is stored.
#
do not use /tmp for span> storage, /tmp here is just
# example sakes.
dataDir< /strong>
=/root/zookeeper/zookeeper-3.4.5/data dataLogsDir =/root/zookeeper/zookeeper-3.4.5/< /strong>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
#
server.
1=192.168.106.133 :2888:3888
# The number of snapshots to retain
in dataDir
#autopurge.snapRetainCount
=3
# Purge task interval
span>in hours
# Set to
" 0" to disable auto purge feature
#autopurge.purgeInterval
= 1

# zookeeper env export 
ZOOKEEPER_HOME
=/root/zookeeper/zookeeper-3.4.5 export
PATH
=$ZOOKEEPER_HOME/bin:$PATH

systemctl stop firewalld.service

./zkServer.sh start 

#View process
jps

Among them, QuorumPeerMain is the zookeeper process, which starts normally.

#View status
.
/zkServer.sh status

#Server output information
tail -500f zookeeper.out

#Stop the zookeeper process
.
/zkServer.sh stop

# Switch to /etc/rc.d/init.d/ under the directory 
cd
/etc/rc.d /init.d
[[email protected] init.d]#
pwd< br />-rwxr-xr-x. 1 root root 565 Jan 30 07:36 zookeeper

/etc/rc.d/init.d
# Create zookeeper file
touch zookeeper

#Update permissions
chmod +x zookeeper

#Edit the file and enter the following in zookeeper

# chkconfig: 2345 10 90
# description: zookeeper
#processname:zookeeper
export JAVA_HOME=/root/jdk/jdk1.8.0_171
export PATH=$JAVA_HOME/bin:$PATH
case $1 in
start)su root /root/zookeeper/zookeeper-3.4. 5/bin/zkServer.sh start;;
stop)su root /root/zookeeper/zookeeper-3.4.5/bin/zkServer.sh stop;;
status)su root /root/zookeeper/zookeeper- 3.4.5/bin/zkServer.sh status;;
restart)su root /root/zookeeper/zookeeper-3.4.5/bin/zkServer.sh restart;;
*) echo “require start|stop| status|restart” ;;
esac

[[emailprotected ] init.d]# chkconfig --list
netconsole
0:off 1:off 2:off 3:off 4:off 5:off 6:off
network
0:off 1:off 2:on 3:on 4:on 5:on 6:off
zookeeper < /strong>
0:off 1:off 2:on 3:on 4:on 5:on 6:off
[[ email protected] init.d]#

Leave a Comment

Your email address will not be published.