zookeeper安装及部署
安装及部署
一. 单机安装、配置
1、下载zookeeper二进制安装包
下载
curl -L -O http://apache.fayea.com/zookeeper/stable/zookeeper-3.4.6.tar.gz
解压
tar zxvf zookeeper-3.4.6.tar.gz
2、设置环境变量
ZOOKEEPER_HOME关键字为添加的配置项
# /etc/profile # System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc # It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates. pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$
else
PATH=$:$PATH
fi
esac
} if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`id -u`
UID=`id -ru`
fi
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi # Path manipulation
if [ "$EUID" = "" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
pathmunge /sbin after
fi HOSTNAME=`/bin/hostname >/dev/null`
HISTSIZE=
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL # By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt ] && [ "`id -gn`" = "`id -un`" ]; then
umask
else
umask
fi for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null 2>&1
fi
fi
done unset i
unset pathmunge JAVA_HOME=/usr/java/jdk1.7.0_51
#zookeeper环境变量设置
ZOOKEEPER_HOME=/usr/local/logdeal/zookeeper-3.4.6
PATH=$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$ZOOKEEPER_HOME/lib:
TOMCAT_HOME=/usr/local/tomcat7
CATALINA_HOME=/usr/local/tomcat7
export ZOOKEEPER_HOME
export JAVA_HOME
export PATH
export CLASSPATH
export TOMCAT_HOME
export CATALINA_HOME
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
3、配置
配置文件存放在$ZOOKEEPER_HOME/conf/目录下,将zoo_sample.cfd文件名称改为zoo.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=/tmp/zookeeper
# 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=
配置说明:
tickTime:这个时间是作为 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。
dataDir:顾名思义就是 Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
dataLogDir: log目录, 同样可以是任意目录. 如果没有设置该参数, 将使用和dataDir相同的设置。
clientPort:这个端口就是客户端连接 Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。
4、启动Zookeeper
当这些配置项配置好后,你现在就可以启动zookeeper了:
./zkServer.sh start #启动
netstat -tunlp|grep 2181 #查看zookeeper端口
./zkServer.sh stop #停止
二. 集群安装、配置
集群安装与配置暂时省略,下次在作补充。
参考资料:
zookeeper入门(1)在单机上实现ZooKeeper伪机群/伪集群部署
zookeeper安装及部署的更多相关文章
- Zookeeper安装和部署
Zookeeper安装和部署:ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件.它是一个为分布式应用 ...
- ZooKeeper安装、部署
一.简介 ZK的安装和配置十分简单,既可以配置成单机模式,也可以配置成集群模式,zk使用java编写的运行在java环境上,3个ZK服务进程是建议的最小进程数量,而且建议部署在不通的物理机 ...
- Hadoop的HA(ZooKeeper)安装与部署
非HA的安装步骤 https://www.cnblogs.com/live41/p/15467263.html 一.部署设定 1.服务器 c1 192.168.100.105 zk.name ...
- ZooKeeper 安装部署及hello world(转)
ZooKeeper 安装部署及hello world 先给一堆学习文档,方便以后查看官网文档地址大全:OverView(概述)http://zookeeper.apache.org/doc/r3.4 ...
- Zookeeper安装部署
Zookeeper安装 1. 安装 wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz ...
- ZooKeeper 安装部署及hello world
ZooKeeper 安装部署及hello world 先给一堆学习文档,方便以后查看官网文档地址大全: OverView(概述)http://zookeeper.apache.org/doc/r3. ...
- ZooKeeper的安装与部署
本文讲述如何安装和部署ZooKeeper. 一.系统要求 ZooKeeper可以运行在多种系统平台上面,表1展示了zk支持的系统平台,以及在该平台上是否支持开发环境或者生产环境. 表1:ZooKeep ...
- ZooKeeper的安装及部署
Zookeeper的安装部署 2.1 Zookeeper的安装 Zookeeper安装前需要安装好 JDK.配置好环境变量. 下载:zookeeper-3.4.5-cdh5.7.0.tar.gz 解压 ...
- hbase集群安装与部署
1.相关环境 centos7 hadoop2.6.5 zookeeper3.4.9 jdk1.8 hbase1.2.4 本篇文章仅涉及hbase集群的搭建,关于hadoop与zookeeper的相关部 ...
随机推荐
- json 递归查找某个节点
一段json可能有很多的子节点,需要查询到某一个节点 用到的js是 find-in-json.js 地址是:https://gist.github.com/iwek/3924925 貌似翻|||墙才能 ...
- mysql 删除重复数据保留一条
验证:mysql 5.6版本 方法一: delete a from table a left join( select (id) from table group by studentName,cla ...
- 利用GCC编译器生成动态链接库和静态链接库
转载请标明:http://www.cnblogs.com/winifred-tang94/ 1.编译过程 gcc –fPIC –c xxx.c 其中-fPIC是通知gcc编译器产生位置独立的目标代码. ...
- Python开发入门与实战9-基于vs的集成开发环境
9. 基于visual studio的Python的集成开发环境 上一章我们描述了如何安装使用Java的集成开发环境Eclipse IDE,本章我们来说明另一种集成开发环境,也是笔者多年的开发习惯使用 ...
- 复制过来的东西也不靠谱,微信公众号第三方平台的API
API:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&veri ...
- 游戏贴图中常用术语《DC》的理解
什么是DC呢? 在GDI中,DC(Device Context)是一个非常重要的概念. 有的书中,将DC翻译为设备描述表,也有的书中翻译为设备上下文. 但是这些翻译,无法在我们的头脑里有强烈的冲击,无 ...
- JS form表单图片上传
// 点击file 类型的input 触发的方法 function changesProvider(){ // fileProvider -> input中的name属性值 var f = do ...
- QUICK START GUIDE
QUICK START GUIDE This page is a guide aimed at helping anyone set up a cheap radio scanner based on ...
- webshell
webshell就是以asp.php.jsp或者cgi等网页文件形式存在的一种命令执行环境,也可以将其称做为一种网页后门.黑客在入侵了一个网站后,通常会将asp或php后门文件与网站服务器WEB目录下 ...
- GridView控件中加自动排列序号
GridView控件中加自动排列序号 为 Gridview 增加一个新的空白列,如下: <asp:BoundField HeaderText="序号"> < ...