上传 zookeeper-3.4.10.tar.gz 到服务器

root@temple-:/usr/local/temple/jar# ll
total
drwxr-xr-x root root 8月 : ./
drwxr-xr-x root root 8月 : ../
-rw-r--r-- root root 8月 : apache-maven-3.5.-bin.tar.gz
-rw-r--r-- root root 8月 : hadoop-2.7..tar.gz
-rw-r--r-- root root 8月 : jdk-8u144-linux-x64.tar.gz
-rw-r--r-- root root 8月 : scala-2.11..tgz
-rw-r--r-- root root 8月 : spark-2.2.-bin-hadoop2..tgz
-rw-r--r-- root root 8月 : zookeeper-3.4..tar.gz

解压并重命名

root@temple-:/usr/local/temple/jar# tar zxvf zookeeper-3.4..tar.gz -C /usr/local/temple/
root@temple-:/usr/local/temple/jar# cd /usr/local/temple/
root@temple-:/usr/local/temple# ll
total
drwxr-xr-x root root 8月 : ./
drwxr-xr-x root root 8月 : ../
drwxr-xr-x root root 8月 : data/
drwxr-xr-x root root 8月 : jar/
drwxr-xr-x uucp 7月 : jdk/
drwxrwxr-x 6月 scala/
drwxr-xr-x 8月 : zookeeper/

配置,复制zoo.cfg文件, 并分别配置

root@temple-:/usr/local/temple/zookeeper/conf# ll
total
drwxr-xr-x 8月 : ./
drwxr-xr-x 8月 : ../
-rw-rw-r-- 3月 : configuration.xsl
-rw-rw-r-- 3月 : log4j.properties
-rw-r--r-- root root 8月 : zoo.cfg
-rw-r--r-- root root 8月 : zookeeper.out
-rw-rw-r-- 3月 : zoo_sample.cfg
-rw-r--r-- root root 8月 : zoo_slave01.cfg
-rw-r--r-- root root 8月 : zoo_slave02.cfg
-rw-r--r-- root root 8月 : zoo_slave03.cfg
zoo_slave01.cfg
root@temple-:/usr/local/temple/zookeeper/conf# cat zoo_slave01.cfg
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/temple/data/zk/slave01/data
dataLogDir=/usr/local/temple/data/zk/slave01/dataLog
# the port at which the clients will connect
clientPort=
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= server.=192.168.1.102::
server.=192.168.1.102::
server.=192.168.1.102::
 
zoo_slave02.cfg
root@temple-:/usr/local/temple/zookeeper/conf# cat zoo_slave02.cfg
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/temple/data/zk/slave02/data
dataLogDir=/usr/local/temple/data/zk/slave02/dataLog
# the port at which the clients will connect
clientPort=
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= server.=192.168.1.102::
server.=192.168.1.102::
server.=192.168.1.102::
zoo_slave03.cfg
root@temple-:/usr/local/temple/zookeeper/conf# cat zoo_slave03.cfg
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/temple/data/zk/slave03/data
dataLogDir=/usr/local/temple/data/zk/slave03/dataLog
# the port at which the clients will connect
clientPort=
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= server.=192.168.1.102::
server.=192.168.1.102::
server.=192.168.1.102::

分别创建上面标红的文件夹

root@temple-102:/usr/local/temple/data/zk# ll
total 20
drwxr-xr-x 5 root root 4096 8月 17 15:39 ./
drwxr-xr-x 3 root root 4096 8月 17 15:34 ../
drwxr-xr-x 4 root root 4096 8月 17 15:40 slave01/
drwxr-xr-x 4 root root 4096 8月 17 15:40 slave02/
drwxr-xr-x 4 root root 4096 8月 17 15:40 slave03/

  

分别创建myid 文件

root@temple-:/usr/local/temple/data/zk/slave01/data# pwd
/usr/local/temple/data/zk/slave01/data
root@temple-:/usr/local/temple/data/zk/slave01/data# ll
total
drwxr-xr-x root root 8月 : ./
drwxr-xr-x root root 8月 : ../
-rw-r--r-- root root 8月 : myid
drwxr-xr-x root root 8月 : version-/
root@temple-:/usr/local/temple/data/zk/slave01/data# cat myid
1
root@temple-:/usr/local/temple/data/zk/slave02/data# pwd
/usr/local/temple/data/zk/slave02/data
root@temple-:/usr/local/temple/data/zk/slave02/data# ll
total
drwxr-xr-x root root 8月 : ./
drwxr-xr-x root root 8月 : ../
-rw-r--r-- root root 8月 : myid
drwxr-xr-x root root 8月 : version-/
root@temple-:/usr/local/temple/data/zk/slave02/data# cat myid
2
root@temple-:/usr/local/temple/data/zk/slave03/data# pwd
/usr/local/temple/data/zk/slave03/data
root@temple-:/usr/local/temple/data/zk/slave03/data# ll
total
drwxr-xr-x root root 8月 : ./
drwxr-xr-x root root 8月 : ../
-rw-r--r-- root root 8月 : myid
drwxr-xr-x root root 8月 : version-/
root@temple-:/usr/local/temple/data/zk/slave03/data# cat myid
3

关闭防火墙

root@temple-:/usr/local/temple/zookeeper/conf# ufw disable

分别启动, 建议第一次启动使用start-foreground, 方便查看启动错误

root@temple-:/usr/local/temple/zookeeper/conf# zkServer.sh start-foreground /usr/local/temple/zookeeper/conf/zoo_slave01.cfg
root@temple-:/usr/local/temple/zookeeper/conf# zkServer.sh start-foreground /usr/local/temple/zookeeper/conf/zoo_slave02.cfg
root@temple-:/usr/local/temple/zookeeper/conf# zkServer.sh start-foreground /usr/local/temple/zookeeper/conf/zoo_slave03.cfg

查看zookeeper 状态

root@temple-:/usr/local/temple/zookeeper/conf# zkServer.sh status /usr/local/temple/zookeeper/conf/zoo_slave03.cfg
ZooKeeper JMX enabled by default
Using config: /usr/local/temple/zookeeper/conf/zoo_slave03.cfg
Mode: follower

查看进程

root@temple-:/usr/local/temple/zookeeper/conf# ps -ef | grep zookeeper
root : pts/ :: /usr/local/temple/jdk/bin/java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /usr/local/temple/zookeeper/bin/../build/classes:/usr/local/temple/zookeepe/bin/../build/lib/*.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/usr/local/temple/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/temple/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/temple/zookeeper/bin/../zookeeper-3.4.10.jar:/usr/local/temple/zookeeper/bin/../src/java/lib/*.jar:/usr/local/temple/zookeeper/bin/../conf:/usr/local/temple/zookeeper/bin/../build/classes:/usr/local/temple/zookeeper/bin/../build/lib/*.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/usr/local/temple/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/temple/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/temple/zookeeper/bin/../zookeeper-3.4.10.jar:/usr/local/temple/zookeeper/bin/../src/java/lib/*.jar:/usr/local/temple/zookeeper/bin/../conf:.:/usr/local/temple/jdk/lib/dt.jar:/usr/local/temple/jdk/lib/tools.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /usr/local/temple/zookeeper/conf/zoo_slave01.cfg
root 6177 1 3 16:24 pts/0 00:00:01 /usr/local/temple/jdk/bin/java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /usr/local/temple/zookeeper/bin/../build/classes:/usr/local/temple/zookeepe/bin/../build/lib/*.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/usr/local/temple/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/temple/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/temple/zookeeper/bin/../zookeeper-3.4.10.jar:/usr/local/temple/zookeeper/bin/../src/java/lib/*.jar:/usr/local/temple/zookeeper/bin/../conf:/usr/local/temple/zookeeper/bin/../build/classes:/usr/local/temple/zookeeper/bin/../build/lib/*.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/usr/local/temple/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/temple/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/temple/zookeeper/bin/../zookeeper-3.4.10.jar:/usr/local/temple/zookeeper/bin/../src/java/lib/*.jar:/usr/local/temple/zookeeper/bin/../conf:.:/usr/local/temple/jdk/lib/dt.jar:/usr/local/temple/jdk/lib/tools.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /usr/local/temple/zookeeper/conf/zoo_slave02.cfg
root 6283 1 4 16:24 pts/0 00:00:01 /usr/local/temple/jdk/bin/java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /usr/local/temple/zookeeper/bin/../build/classes:/usr/local/temple/zookeepe/bin/../build/lib/*.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/usr/local/temple/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/temple/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/temple/zookeeper/bin/../zookeeper-3.4.10.jar:/usr/local/temple/zookeeper/bin/../src/java/lib/*.jar:/usr/local/temple/zookeeper/bin/../conf:/usr/local/temple/zookeeper/bin/../build/classes:/usr/local/temple/zookeeper/bin/../build/lib/*.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/temple/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/usr/local/temple/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/temple/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/temple/zookeeper/bin/../zookeeper-3.4.10.jar:/usr/local/temple/zookeeper/bin/../src/java/lib/*.jar:/usr/local/temple/zookeeper/bin/../conf:.:/usr/local/temple/jdk/lib/dt.jar:/usr/local/temple/jdk/lib/tools.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /usr/local/temple/zookeeper/conf/zoo_slave03.cfg
root 6435 2277 0 16:25 pts/0 00:00:00 grep --color=auto zookeeper
root@temple-102:/usr/local/temple/zookeeper/conf#

完成

 

Ubuntu16.4 zookeeper-3.4.10 单机多实例部署的更多相关文章

  1. Mysql 数据库单机多实例部署手记

        最近的研发机器需要部署多个环境,包括数据库.为了管理方便考虑将mysql数据库进行隔离,即采用单机多实例部署的方式.找了会资料发现用的人也不是太多,一般的生产环境为了充分发挥机器性能都是单机单 ...

  2. tomcat单机多实例部署

    最近在面试的过程中,一家公司在面试时提到了有关tomcat单机多实例部署的提问, 正好, 之前使用IntelliJ IDEA 13.1.4这款IDE开发web项目,在开发的过程中,因为有多个web项目 ...

  3. MYSQL 5.5.32的单机多实例部署

    Centos6.6安装并配置单机多实例的MYSQL数据库 本文介绍安装单机多实例的MYSQL数据库的环境如下: 系统平台环境:Centos6.6 Mysql软件包:Mysql-5.5.32.tar.g ...

  4. MySQL通过rpm安装及其单机多实例部署

    1. CentOS 下安装 MySQL Oracle 收购 MySQL 后,CentOS 为避免 MySQL 闭源的风险,改用 MySQL 的分支 MariaDB:MariaDB 完全兼容 MySQL ...

  5. Zk单机多实例部署

    一.环境准备 当前环境:centos7.3一台软件版本:zookeeper-3.5.2部署目录:/usr/local/zookeeper启动端口:2181,2182,2183配置文件:/usr/loc ...

  6. solr单机多实例部署文件锁冲突解决的方法

    给出一个有问题的单机多tomcat实例引用同一个solr实例部署图. 这样的部署必定造成一个问题.启动第二个tomcat实例时,一定会报索引目录文件锁已经被占用. 最初的解决的方法是.有多少个tomc ...

  7. Redis 单机和多实例部署

    作者:北京运维 1. 安装环境说明 OS 版本:CentOS 7.5.1804 Redis 版本:redis-3.2.12 Redis 下载页面:http://download.redis.io/re ...

  8. 通过Zabbix监控Tomcat单机多实例

    前面已经介绍过Tomcat单机多实例部署,接下来就在他的基础上进行下一步操作:Tomcat多实例监控! Tomcat多实例监控过程和之前的redis多实例原理一样,分为以下4步: 1.获取多实例 2. ...

  9. 聊聊 Tomcat 的单机多实例

    Tomcat 从何而来? 先说 Tomcat 这一单词解释,如果你不是一个开发者,当然它在美国口语中并非是褒义词:如果你是开发者,那你一定听过 Web 应用服务器.Sun 公司和 Tomcat .如你 ...

随机推荐

  1. [USACO12DEC] 逃跑的BarnRunning Away From…(主席树)

    [USACO12DEC]逃跑的BarnRunning Away From- 题目描述 It's milking time at Farmer John's farm, but the cows hav ...

  2. 折腾到死:matlab7.0 安装

    matlab7.0应该是2004年的东西了吧,装起来相当费劲!为什么不用更高的版本呢?其实我也想,之前安装的2013a安装包就5个多G,安装完之后就十多个G了.我习惯将软件安装到C盘,可怜我那100G ...

  3. bzoj 2929 [Poi1999]洞穴攀行 网络流

    2929: [Poi1999]洞穴攀行 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 499  Solved: 295[Submit][Status][ ...

  4. Linux iptables:规则组成

    <Linux iptables:规则原理和基础>介绍了iptables的四表五链,简单说就是不同的网络层数据包会经过哪几个挂载点,在每个挂载点可以在哪张表进行规则定义. 本篇沿着这个思路, ...

  5. [Java多线程]-ThreadLocal源码及原理的深入分析

    ThreadLocal<T>类:以空间换时间提供一种多线程更快捷访问变量的方式.这种方式不存在竞争,所以也不存在并发的安全性问题. //-------------------------- ...

  6. SpringBoot ( 八 ) :RabbitMQ 详解

    原文出处: 纯洁的微笑 RabbitMQ 即一个消息队列,主要是用来实现应用程序的异步和解耦,同时也能起到消息缓冲,消息分发的作用. 消息中间件在互联网公司的使用中越来越多,刚才还看到新闻阿里将Roc ...

  7. [LeetCode] 29. Divide Two Integers ☆☆

    Divide two integers without using multiplication, division and mod operator. If it is overflow, retu ...

  8. extjs 省市县级联

    Ext.define('State', { extend: 'Ext.data.Model', fields: [ {type: 'string', name: 'nevalue'}, {type: ...

  9. 2-sat 分类讨论 UVALIVE 3713

    蓝书326 //看看会不会爆int!数组会不会少了一维! //取物问题一定要小心先手胜利的条件 #include <bits/stdc++.h> using namespace std; ...

  10. HDU 4946 凸包

    给你n个点,具有速度,一个位置如果有其他点能够先到,则不能继续访问,求出里面这些点哪些点是能够无限移动的. 首先我们考虑到,一个速度小的和一个速度大的,速度小的必定只有固定他周围的一定区域是它先到的, ...