Hadoop环境配置(zookeeper环境搭建)
2021/12/19 23:28:17
本文主要是介绍Hadoop环境配置(zookeeper环境搭建),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
注:安装之前关闭防火墙
1、关闭防火墙
(1)、防火墙状态的查看
命令:systemctl status firewalld
(2)、关闭防火墙
命令:systemctl stop firewalld
(3)、设置开机防火墙不启动
命令:systemctl disable firewalld
2、将zookeeper安装包拉到/opt/software/文件夹中
安装包版本:apache-zookeeper-3.5.7-bin.tar.gz
3、解压zookeeper安装包到/opt/module/文件夹下
命令:
cd /opt/software/
tar -zxvf 安装包名 -C /opt/module/
4、在解压后的zookeeper文件下,创建log文件夹和data文件夹
命令:cd /opt/module/apache-zookeeper-3.5.7-bin/
创建命令:
mkdir data
mkdir log
4、 拷贝配置文件,命令:
cd /opt/module/apache-zookeeper-3.5.7-bin/conf/
cp zoo_sample.cfg zoo.cfg
在此路径下,将zoo_sample.cfg文件拷贝一份并重命名为zoo.cfg
5、进行配置文件更改,命令:
vi zoo.cfg
在页面中添加如下内容
# 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.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/opt/module/apache-zookeeper-3.5.7-bin/data
dataLogDir=/opt/module/apache-zookeeper-3.5.7-bin/log
# 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
server.0=192.168.1.100:2888:3888
server.1=192.168.1.101:2888:3888
server.2=192.168.1.102:2888:3888
6、创建服务器myid
命令:
cd /opt/module/apache-zookeeper-3.5.7-bin/data/
touch myid
7、集群拷贝
命令:
scp -r /opt/module/apache-zookeeper-3.5.7-bin root@hadoop101:/opt/module/apache-zookeeper-3.5.7-bin
将Hadoop100/opt/module/apache-zookeeper-3.5.7-bin里面的文件拷贝到Hadoop101/opt/module/apache-zookeeper-3.5.7-bin里面
scp -r /opt/module/apache-zookeeper-3.5.7-bin root@hadoop102:/opt/module/apache-zookeeper-3.5.7-bin
将Hadoop100/opt/module/apache-zookeeper-3.5.7-bin里面的文件拷贝到Hadoop102/opt/module/apache-zookeeper-3.5.7-bin里面
8、集群myid更改
进入每个节点进行更改:
命令:cd /opt/module/apache-zookeeper-3.5.7-bin/data/
Hadoop100的myid,改成0
命令:touch myid
Hadoop101的myid,改成1
Hadoop102的myid,改成2
9、添加系统环境变量
命令:vi /etc/profile
在页面中添加如下内容
export ZOOKEEPER_HOME=/opt/module/apache-zookeeper-3.5.7-bin
export PATH=$PATH:$ZOOKEEPER_HOME/bin
10、zookeeper集群启动,每个节点都要启动
命令:cd /opt/module/apache-zookeeper-3.5.7-bin
启动命令:(在100、101、102里面都要启动)
zkServer.sh start
zkServer.sh status
依次启动
11、zkCli连接验证
命令:zkCli.sh -server hadoop100:2181
按Ctrl+Z停止运行
用jps查看出现ZooKeeperMain进程
出现QuorumPeerMain则说明zookeeper启动成功
这篇关于Hadoop环境配置(zookeeper环境搭建)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2023-05-13Windows下hadoop环境搭建之NameNode启动报错
- 2023-04-14hadoop伪分布式集群的安装(不是单机版)
- 2022-12-05Hadoop生态系统—数据仓库Hive的安装
- 2022-11-02Win10搭建Hadoop环境
- 2022-10-19Hadoop生态系统(数据仓库Hive的安装)
- 2022-10-03Hadoop、storm和Spark Streaming简单介绍
- 2022-10-03胖虎的Hadoop笔记——Hadoop的伪分布式部署
- 2022-09-11Ubuntu搭建全分布式Hadoop
- 2022-09-11Ubuntu搭建全分布式Hadoop
- 2022-09-09Ubuntu下安装伪分布式HADOOP遇到的一些问题