码迷,mamicode.com
首页 > 其他好文 > 详细

Fpm 之 Zookeeper-3.4.6 rpm 包定制

时间:2018-06-14 18:18:22      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:end   echo   increase   doc   between   isa   you   desc   imu   

Fpm 之 Zookeeper-3.4.6 rpm 包定制

一、Zookeeper编译包安装

1.下载zookeeper编译安装包
[root@localhost software]# wget http://archive.apache.org/dist/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

2.解压到编译包,并指定解压,安装存放的目录
[root@localhost software]# tar -zxvf zookeeper-3.4.6.tar.gz -C /app/
[root@localhost app]# mv /app/zookeeper-3.4.6/ /app/zookeeper         #重命名

3.创建data与logs文件夹,存放数据
[root@localhost app]# mkdir -p /app/zookeeper/data
[root@localhost app]# mkdir -p /app/zookeeper/logs

4.修改配置文件,指定data与logs的存放位置
[root@localhost conf]# mv /app/zookeeper/conf/zoo_sample.cfg /app/zookeeper/conf/zoo.cfg
[root@localhost conf]# vi 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=/app/zookeeper/data                         #增加项
dataLogDir=/app/zookeeper/logs                    #增加项
# the port at which the clients will connect
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

5.创建自启动服务
vi /etc/init.d/zookeeper
#!/bin/bash
#chkconfig:2345 20 90
#description:zookeeper
#processname:zookeeper
#export JAVA_HOME=//usr/java/jdk1.8.0_112
case $1 in
        start) su root /app/zookeeper/bin/zkServer.sh start;;
        stop) su root /app/zookeeper/bin/zkServer.sh stop;;
        status) su root /app/zookeeper/bin/zkServer.sh status;;
        restart) su /app/zookeeper/bin/zkServer.sh restart;;
        *) echo "require start|stop|status|restart" ;;
esac

[root@localhost conf]# chmod +x /etc/init.d/zookeeper 
[root@localhost conf]# chkconfig --add zookeeper
[root@localhost conf]# chkconfig zookeeper on

6.测试是否成功
[root@localhost conf]# service zookeeper start
JMX enabled by default
Using config: /app/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost conf]# lsof -i:2181
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    26548 root   22u  IPv6 199845      0t0  TCP *:eforward (LISTEN)
[root@localhost conf]# service zookeeper stop
JMX enabled by default
Using config: /app/zookeeper/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED

二、制作fpm包的运行脚本

[root@localhost zookeeper]# mkdir -p /app/zookeeper/script
[root@localhost zookeeper]# cp /etc/init.d/zookeeper /app/zookeeper/script/
[root@localhost script]# vi /app/zookeeper/script/server.sh
#!/bin.bash

#制作自启动服务
cp /app/zookeeper/script/zookeeper /etc/init.d/
chmod +x /etc/init.d/zookeeper
chkconfig --add zookeeper
chkconfig zookeeper on

三、定制rpm包

fpm -s dir -t rpm -n zookeeper -v 3.4.6 --post-install /app/zookeeper/script/server.sh -f /app/zookeeper/

四、在客户端安装rpm包

[root@localhost ~]# yum -y localinstall zookeeper-3.4.6-1.x86_64.rpm
[root@localhost ~]# service zookeeper start
JMX enabled by default
Using config: /app/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost ~]# lsof -i:2181
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    10611 root   21u  IPv6 271570      0t0  TCP *:eforward (LISTEN)
[root@localhost ~]# service zookeeper stop
JMX enabled by default
Using config: /app/zookeeper/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@localhost ~]# ll /app/
total 16
drwxr-xr-x 12 mysql mysql 4096 Jun 13 21:02 mysql
drwxr-xr-x 12 root  root  4096 Jun 13 01:57 nginx-1.12.2
drwxr-xr-x  3 root  root  4096 Jun 14 13:39 redis
drwxr-xr-x 13 root  root  4096 Jun 14 15:15 zookeeper

Fpm 之 Zookeeper-3.4.6 rpm 包定制

标签:end   echo   increase   doc   between   isa   you   desc   imu   

原文地址:http://blog.51cto.com/12965094/2129371

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!