CentOS中配置CDH版本的ZooKeeper

三台CentOS:Host0,Host1,Host2

在三台中分别安装zookeeper-server

yum install zookeeper-server -y

修改zookeeper的配置文件(/etc/zookeeper/conf/zoo.cfg)

因为zookeeper集群共有3个节点,所以在配置文件中添加server.0,server.1,server.2

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

maxClientCnxns=50
# 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=/var/lib/zookeeper
# the port at which the clients will connect
clientPort=2181
# the directory where the transaction logs are stored.
dataLogDir=/var/lib/zookeeper
#server
server.0 = Host0:2888:3888
server.1 = Host1:2888:3888
server.2 = Host2:2888:3888

在各个Host中添加myid文件,并修改文件所属用户。

echo "0" > /var/lib/zookeeper/myidchown zookeeper:zookeeper /var/lib/zookeeper/myid

注意,三个主机的/var/lib/zookeeper/myid文件内容不能相同,且与之间的server.0,server.1,server.2的0,1,2相对应。

初始化zookeeper,并启动zookeeper

service zookeeper-server init
service zookeeper-server start

查看zookeeper节点状态

[[email protected] ~]# zookeeper-server status
JMX enabled by default
Using config: /etc/zookeeper/conf/zoo.cfg
Mode: follower

[[email protected] ~]# zookeeper-server status
JMX enabled by default
Using config: /etc/zookeeper/conf/zoo.cfg
Mode: leader

[[email protected] ~]# zookeeper-server status
JMX enabled by default
Using config: /etc/zookeeper/conf/zoo.cfg
Mode: follower

可得Host1是leader,Host0和Host2是follower

时间: 2024-08-03 16:00:56

CentOS中配置CDH版本的ZooKeeper的相关文章

怎样在Centos中配置gcc、g++、和gdb?

linux中使用gcc来编译C程序,使用g++来编译C++程序,使用GDB来调试程序,这些使用工具都需要自己进行安装,那么应该怎样配置这些工具呢? 首先,在命令行中输入vi查看一下vim的信息如下: 然后,输入ls -a查看是否存在.vimrc和.viminfo这样的配置文件,结果如下: 1.配置gcc.g++ Centos中使用yum来配置gcc和g++,若要安装gcc,则在命令行中输入:yum -y install gcc,按回车键就能够进行gcc的安装,若要安装g++,则需要在命令行中输入

CentOS中配置xrdp,通过微软远程桌面访问CentOS桌面

环境:CentOS 6.4 1.安装相关软件 yum groupinstall "Desktop" (已安装桌面的就可以缺略这条命令) yum install xrdp yum install tigervnc-server 2.启动xrdp服务 service xrdp restart 3.配置iptables防火墙 在xrdp使用是3389端口,所以在iptables中也要开放相应的端口,否则无法访问 iptables -A INPUT -p tcp --dport 3389 -j

CentOS中配置VNC Server

环境:CentOS 6.4 1.安装tigervnc-server及相关软件 首先检查系统中是否安装tigervnc-server安装包 rpm -qa tigervnc-server 如果没有就直接安装 yum install tigervnc-server* 2.修改vncserver的配置文件,配置用户及分辨率 vncserver的配置文件/etc/sysconfig/vncservers 参照最后两行注释,对应自己的设置,添加新的两行 VNCSERVERS="2:test" V

centos中配置nfs固定端口

前言:之前配置的nfs端口一直是通过rpcinfo x.x.x.x这个命令查找到需要放行的端口,然后在防火墙中放行这个端口,但是由于服务器是在一个机架上,物业那经常断电,所以每次断电重启之后,都需要我重新设置防火墙,无意中听同事说可以设置固定端口,所以尝试了一把,oh,my god,妈妈以后终于不用担心服务器重启了.以下是记录,记住所有操作都是在nfs服务器端进行操作的. 1)确定端口,必须是1024下的端口而且没有被占用,可以使用netstat命令查看下端口有没有被占用,我使用的是1012和1

CentOS 中 配置 Nginx 支持 https

一.基础设置: 1.yum -y update 2.yum -y install openssl* 3.cd /usr/local/nginx/conf 4.mkdir ./ssl 5.cd ./ssl # 在ssl目录下用openssl创建 .key 私钥文件和 .crt 证书文件 6.openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout www.ushark.net.key -out www.ushark.net.crt 7

03: centos中配置使用svn

1.1 centos7.3源码搭建svn----安装各种依赖包 1.安装zlib-1.2.8.tar.xz xz -d zlib-1.2.8.tar.xz tar xvf zlib-1.2.8.tar cd zlib-1.2.8/ ./configure --prefix=/usr/local/zlib make && make install 2.安装apr-1.5.2.tar.gz tar -zxvf apr-1.5.2.tar.gz cd apr-1.5.2/ ./configure

Unix环境高级编程 centos中配置apue编译环境

首先保证操作系统中已经安装好了gcc, 将apue.2e解压后拷贝到linux操作系统中,然后输入 [[email protected] apue.2e]# cd lib 进入apue.2e的lib文件夹,输入 [[email protected] lib]# make -f linux.mk 然后从apue.2e/lib文件夹中找到libapue.a,从apue.2e/include文件夹中找到apue.h,将两者拷贝到源代码目录(自己编写的.c文件所在目录),输入 [[email prote

centos jdk 配置及版本切换

一. 环境变量: /etc/profile JAVA_HOME=/usr/lib/jdk1.8.0_91JRE_HOME=/usr/lib/jdk1.8.0_91/jreCLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/libPATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/binexport JAVA_HOME JRE_HOME CLASS_PATH PATH 二. 切换jdk版本:

CentOS中配置php环境

1.安装apache: yum install httpd httpd-devel 2.安装mysql: yum install mysql mysql-server 3.安装php: yum install php php-devel 4.安装php的扩展: yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc 5.启动apache和mysql服务: service httpd r