Linux Zookeeper self-boot service __linux

Source: Internet
Author: User
Tags chmod zookeeper

The project used to zookeeper, operation and maintenance department to restart the machine, to the project group of people on the scene to maintain, brother said too lazy to the scene, directly zookeeper into service.

First, configure your zookeeper.

Download, unzip (I put it under/usr/zookeeper), configure Zoo.cfg

The ZOO.CFG configuration is as follows:

# 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.
Datadir=/usr/zookeeper
# The port at which the clients'll connect
clientport=2181

Create a directory under/usr/zookeeper logs,mkdir/usr/zookeeper/logs

#cp/usr/zookeeper/zookeeper-3.3.6/bin/zkserver.sh/etc/rc.d/init.d/zookeeper

#cp/usr/zookeeper/zookeeper-3.3.6/bin/zkenv.sh/etc/rc.d/init.d/zkenv

sudo ln-s/etc/rc.d/init.d/zookeeper/usr/zookeeper/zookeeper-3.3.6/bin/zkserver.sh

Edit the/etc/rc.d/init.d/zookeeper and modify it as follows:

#1. Comment out

# only follow symlinks if Readlink supports it
#if readlink-f "$" >/dev/null 2>&1
#then
# zoobin= ' readlink-f ' $ '
#else
# zoobin= "$"
#fi

#2. Zoobinlink point to/etc/rc.d/init.d/zookeeper

Zoobinlink=/etc/rc.d/init.d/zookeeper

#3. Point to/usr/zookeeper/zookeeper-3.3.6/bin

Zoobin=/usr/zookeeper/zookeeper-3.3.6/bin
Zoobindir= $ZOOBIN

#去掉后缀sh
. "$ZOOENVDIR"/zkenv

Modify/usr/zookeeper/zookeeper-3.3.6/bin/zkenv.sh

If ["X$zoocfgdir" = "x"]
Then
If [-D "/etc/zookeeper"]
Then
Zoocfgdir= "/etc/zookeeper"
Else
#ZOOCFGDIR = "$ZOOBINDIR/. /conf "
Zoocfgdir= "$ZOOBIN/. /conf "
Fi
Fi


if ["x${zoo_log_dir}" = "X"]
Then
#ZOO_LOG_DIR = "."
Zoo_log_dir= "$ZOOBIN/. /logs "
Fi

Configure startup level

Ln-s/etc/init.d/zookeeper/etc/rc3.d/k30zookeeper

Ln-s/etc/init.d/zookeeper/etc/rc3.d/s70zookeeper

Ln-s/etc/init.d/zookeeper/etc/rc5.d/k30zookeeper

Ln-s/etc/init.d/zookeeper/etc/rc5.d/s70zookeeper

Add execute permissions for all users

Chmod-f 777/etc/init.d/zookeeper
Chmod-f 777/etc/rc3.d/s70zookeeper

Verify:

Service Zookeeper Start

Service Zookeeper Stop

Service Zookeeper Status

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.