1.环境信息
IP:10.1.33.47 10.1.33.48 10.1.33.49 软件版本:1-zookeeper-3.4.8.tar.gz jdk-8u201-linux-x64.tar.gz 软件存放路径:/app/java /app/zookeeper-3.4.8
2.安装JDK
解压JDK tar -xzvf jdk-8u201-linux-x64.tar.gz 配置JDK环境变量 1.进入JDK解压后的路径 pwd(JDK解压后的路径) 2.vim /etc/profile 添加 JAVA_HOME=/app/java/jdk1.8.0_201 CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME export CLASSPATH export PATH 引入配置的信息(刷新) source /etc/profile 查看 Java -version
3.安装zookeeper
1.解压zookeeper tar -xzvf 1-zookeeper-3.4.8.tar.gz zookeeper-3.4.8(解压后的名字) 2.修改zookeeper配置文件名称 [root@localhost-149 conf]# mv zoo_sample.cfg zoo.cfg 3.创建zookeeper的数据目录和日志文件 mkdir zk mkdir data/logs 路径 /app/zookeeper-3.4.8/zk/data 4.修改配置文件 vim zoo.cfg的内容 dataDir=/app/zookeeper-3.4.8/zk/data dataLogDir=/app/zookeeper-3.4.8/zk/logs 在最下面添加 #2888 选举端口 #3888 心跳端口 server.1=zk47:2888:3888 server.2=zk48:2888:3888 server.3=zk49:2888:3888 # 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-3.4.8/zk/data dataLogDir=/app/zookeeper-3.4.8/zk/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 #2888 选举端口 #3888 心跳端口 server.1=zk47:2888:3888 server.2=zk48:2888:3888 server.3=zk49:2888:3888 5.进入data目录下 创建myid ZK47 /app/zookeeper-3.4.8/zk/data/myid --1 ZK48 /app/zookeeper-3.4.8/zk/data/myid --2 ZK49 /app/zookeeper-3.4.8/zk/data/myid --3 6.修改本机的hosts vim /etc/hosts 10.1.33.47 zk47 10.1.33.48 zk48 10.1.33.49 zk49
4.集群启动测试
启动目录: /app/zookeeper-3.4.8/bin 进入bin目录下进行启动 ./zkServer.sh start 查看集群的状态 ./zkServer.sh status
1.启动防火墙 systemctl start firewalld
2.禁用防火墙 systemctl stop firewalld
3.设置开机启动 systemctl enable firewalld
4.停止并禁用开机启动 sytemctl disable firewalld
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)