Zookeeper集群环境搭建
来源:互联网 发布:c语言memset头文件 编辑:程序博客网 时间:2024/05/16 15:27
Zookeeper集群环境搭建
准备工作
- 四台centos虚拟机,一台主机控制其他三台
- 每台虚拟需要配置JDK ,免登录,由主机统一管理配置
- 需要安装的包
- 主机httpd服务 yum install -y httpd,方便其他机器下载资源
- 主机支持expect 命令 yum -y install expect
- 支持http下载 yum install -y wget
- 关闭防火墙非常重要 sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service
开启自动部署
主机配置
- 配置了httpd服务之后 在var/www/目录下放入jdk
部署自动登录脚本
#!/bin/bashSERVERS="192.168.23.41 192.168.23.42 192.168.23.43"PASSWORD=hadoop#遍历所有的 server,配置免登录ssh_copy_id_to_all(){for SERVER in $SERVERSdo auto_ssh_copy_id $SERVERS $PASSWORDdone}ssh_copy_id_to_all#具体实现auto_ssh_copy_id(){expect -c "set timeout -1; spawn ssh_copy_id $1; expect { *(yes/no)* {send -- yes\r;exp_continue;} *assword:* {send -- $2\r;exp_continue;} eof {exit 0;} }";}#遍历serverfor SERVER in $SERVERSdo scp install.sh root@$SERVER:/rootssh root@$ERVER /root/install.shdone
自动化部署jdk 注意如果 你的jdk是32位,系统是64位需要yum install -y glibc.i686
#!/bin/bashBASE_SERVER=192.168.23.4yum install -y wget #yum install -y glibc.i686 32位jdk配置wget $BASE_SERVER/jdk-7u72-linux-i586.gz#解压文件tar zxvf jdk-7u72-linux-i586.gz -C /usr/local#配置环境变量cat >> /etc/profile << EOFexport JAVA_HOME=/usr/local/jdk1.7.0_72export PATH=\SPATH:\$JAVA_HOME/binEOF
关闭防火墙,否则报host name not find
sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service
集群配置Zookeeper
配置conf/zoo.cfg
dataDir=/root/zkData //配置数据存放的位置server.1=192.168.23.41:2888:3888//配置集群server.2=192.168.23.42:2888:3888server.3=192.168.23.43:2888:3888
在zkData下建立 myid 内容为1,三个主机都要建立,可以用脚本统一搭建
启动Zookeeper ,成功后可以看到服务器的的角色 leader or follower
bin/zkServer.sh start //启动服务器bin/zkServer.sh status //服务工作状态bin/zkServer.sh status //停止服务
0 0
- zookeeper集群环境搭建
- zookeeper 集群环境搭建
- zookeeper集群环境搭建
- zookeeper集群环境搭建
- Zookeeper集群环境搭建
- zookeeper<集群环境搭建>
- zookeeper集群环境搭建
- Zookeeper集群环境搭建实践
- Zookeeper集群环境搭建实践
- Zookeeper集群环境搭建实践
- ZooKeeper伪集群环境搭建
- Zookeeper集群环境搭建实践
- Zookeeper集群环境搭建实践
- zookeeper集群环境的搭建
- zookeeper集群环境搭建(centos)
- Zookeeper实战-集群环境搭建
- Zookeeper集群环境搭建实践
- Zookeeper集群环境搭建实践
- http协议 (详细,全面)
- Linux下搭建Jenkins持续集成
- Android界面生成流程:View的布局(Layout)
- onsubmit用来表单的提交
- 关于字节对齐
- Zookeeper集群环境搭建
- 第39级台阶,简单DFS
- 分类算法-贝叶斯网络
- 实验二 BMP2YUV文件转换
- LeetCode Algorithms 292. Nim Game 题解
- mongoc_client_command_simple
- PowerDesigner连接oracle数据库 以及连接数据库时出现的问题
- 随记
- poj 3660