大数据-Zookeeper的单机安装

一、Zookeeper单机安装


一、安装步骤

1、关闭Linux(CentOS6.X版本)的防火墙

临时关闭防火墙:service iptables stop
永久关闭防火墙:chkconfig iptables off

2、下载安装JDK  :先卸载后安装

1、先输入java -version 查看是否安装了jdk
2、如果安装了,检查下安装的路径 which java(查看JDK的安装路径) 
3、卸载 rm -rf JDK地址(卸载JDK)  rm -rf /usr/java/jdk/jdk1.8.0_172/
4、vim命令编辑文件profile  vim /etc/profile   删除配置的环境变量,至此JDK卸载完毕

       附上本人觉得写得比较好的链接:https://www.cnblogs.com/javabg/p/10332993.html

3、下载或者上传Zookeeper的安装包到指定文件夹

大数据-Zookeeper的单机安装_第1张图片

       链接:https://pan.baidu.com/s/1LO-yiezt26ePIDG4KU90sA 
              提取码:o1e1

       注意:如果链接失效,请评论我私发给你

4、上传解压Zookeeper的安装包:

利用rz命令上传,如果linux系统没有rz命令,请自行百度yum安装rz命令,yum安装需要联网
[root@hadoop01 software]# rz
z waiting to receive.**B0100000023be50

解压:
[root@hadoop01 software]#tar -xvf zookeeper-3.4.7

解压后显示:
[root@hadoop01 software]# ll
drwxr-xr-x. 10 1000 1000     4096 Nov 10  2015 zookeeper-3.4.7
-rw-r--r--.  1 root root 21816477 Aug 20 18:55 zookeeper-3.4.7.tar.gz

5、进入Zookeeper的安装目录下的子目录conf目录中:cd zookeeper-3.4.7/conf

6、将conf目录下的zoo_sample.cfg文件复制为zoo.cfg。Zookeeper在启动的时候会自动寻找zoo.cfg,根据其中的配置来启动服务:cp zoo_sample.cfg zoo.cfg

7、编辑zoo.cfg文件:vim zoo.cfg

8、修改其中的属性dataDir,指定数据的存储目录:dataDir=/home/software/zookeeper-3.4.7/tmp

9、保存并且关闭zoo.cfg

10、进入Zookeeper的安装目录下的子目录bin目录中:cd ../bin

11、执行zkServer.sh文件,来启动Zookeeper服务器端:sh zkServer.sh start

[root@hadoop01 bin]# sh zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/software/zookeeper-3.4.7/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

12、执行zkCli.sh文件,来启动进入Zookeeper客户端:sh zkCli.sh

[root@hadoop01 bin]# sh zkCli.sh
Connecting to localhost:2181
2020-08-20 19:37:25,379 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.7-1713338, built on 11/09/2015 04:32 GMT
2020-08-20 19:37:25,383 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=hadoop01
2020-08-20 19:37:25,383 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_65
2020-08-20 19:37:25,387 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2020-08-20 19:37:25,387 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/home/preSoftware/jdk1.8/jre
2020-08-20 19:37:25,387 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/home/software/zookeeper-3.4.7/bin/../build/classes:/home/software/zookeeper-3.4.7/bin/../build/lib/*.jar:/home/software/zookeeper-3.4.7/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/software/zookeeper-3.4.7/bin/../lib/slf4j-api-1.6.1.jar:/home/software/zookeeper-3.4.7/bin/../lib/netty-3.7.0.Final.jar:/home/software/zookeeper-3.4.7/bin/../lib/log4j-1.2.16.jar:/home/software/zookeeper-3.4.7/bin/../lib/jline-0.9.94.jar:/home/software/zookeeper-3.4.7/bin/../zookeeper-3.4.7.jar:/home/software/zookeeper-3.4.7/bin/../src/java/lib/*.jar:/home/software/zookeeper-3.4.7/bin/../conf:
2020-08-20 19:37:25,388 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2020-08-20 19:37:25,388 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2020-08-20 19:37:25,388 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=
2020-08-20 19:37:25,388 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2020-08-20 19:37:25,388 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2020-08-20 19:37:25,388 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-431.el6.x86_64
2020-08-20 19:37:25,389 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
2020-08-20 19:37:25,389 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
2020-08-20 19:37:25,389 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/home/software/zookeeper-3.4.7/bin
2020-08-20 19:37:25,392 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@506c589e
Welcome to ZooKeeper!
2020-08-20 19:37:25,446 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2020-08-20 19:37:25,552 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@876] - Socket connection established to localhost/127.0.0.1:2181, initiating session
[zk: localhost:2181(CONNECTING) 0] 2020-08-20 19:37:25,667 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x1740ee00e1e0000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null



按回车之后显示:
[zk: localhost:2181(CONNECTED) 0] 
[zk: localhost:2181(CONNECTED) 0] 

二、注意事项

  1. 当服务器端启动成功之后,可以执行jps命令查看是否有Zookeeper的QuorumPeer进程
[root@hadoop01 ~]# jps
3716 Jps
3652 QuorumPeerMain
3674 ZooKeeperMain
[root@hadoop01 ~]# 
  1. 或者在服务器端启动成功之后,可以执行一下命令查看服务器端状态:sh zkServer.sh status

如果出现了Standalone,说明启动成功

[root@hadoop01 bin]# pwd
/home/software/zookeeper-3.4.7/bin
[root@hadoop01 bin]# sh zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/software/zookeeper-3.4.7/bin/../conf/zoo.cfg
Mode: standalone
[root@hadoop01 bin]# 

 

你可能感兴趣的:(大数据,zookeeper,大数据)