Centos7---1708 Linux上安装ZooKeeper 以及JDK1.8安装

1.下载ZooKeeper 

地址:http://mirror.bit.edu.cn/apache/zookeeper/

 

2.上载压缩文件并解压

tar    -zxvf    zookeeper-3.4.12.tar.gz

解压后的文件

3.新建zookeeper配置文件

cd zookeeper-3.4.12   进入文件夹

cd conf 进入配置文件

vim命令 打开 zoo_sample.cfg  文件 

修改dataDir设置为实际路径

3.jdk安装

 3.1jdk下载

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

官网下载

 

3.2.利用SFTP上传到/usr/local/java

3.3.解压jdk

[root@localhost data]# tar -zxvf jdk-8u181-linux-x64.tar.gz

//如果出现 Error is not recoverable: exiting now 错误  

[root@localhost data]# tar -xvf jdk-8u181-linux-x64.tar.gz  

tar -zxvf 改为 tar -xvf  正常

3.4、修改配置文件

修改/etc/profile这个文件,修改的方法很多,可以用远程工具下载该文件到本地系统,修改后,在上载上去,也可以直接使用vim命令对该文件进行修改(这里不打算详细展开讲vim命令),不管用什么方法只要在/etc/profile文件中增加如下配置即可,增加的内容是:

 

export JAVA_HOME=/opt/java/jdk1.8.0_121

export  CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/

export  PATH=$PATH:$JAVA_HOME/bin

执行命令  source    /etc/profile回车 重新加载 profile

3.4、测试是否安装成功

          执行命令  java    -version回车

4、关闭防火墙

//CentOS6关闭防火墙使用以下命令
//临时关闭
service iptables stop
//禁止开机启动
chkconfig iptables off

//CentOS7中若使用同样的命令会报错

stop  iptables.service
  
Failed to stop iptables.service: Unit iptables.service not loaded.

这是因为CentOS7版本后防火墙默认使用firewalld,因此在CentOS7中关闭防火墙使用以下命令,

//临时关闭

systemctl stop firewalld

//禁止开机启动

systemctl disable firewalld

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

当然,安装iptables-service,就可以使用了

yum install -y iptables-services

//关闭防火墙

service iptables stop

Redirecting to /bin/systemctl stop  iptables.service

//检查防火墙状态
service iptables status

Redirecting to /bin/systemctl status  iptables.service
iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

4启动zookeeper

 

启动前  将zoo_sample.cfg配置文件 修改为默认访问的zoo.cfg  

  进入到zookeeper目录下

启动zookeeper:bin/zkServer.sh start

关闭zookeeper:bin/zkServer.sh stop

查看zookeeper状态:bin/zkServer.sh status

 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值