hadoop 2.7.1 高可用安装部署
0、系统环境安装
1、同步机器时间
yum install -y ntp #安装时间服务
ntpdate us.pool.ntp.org #同步时间
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
IPADDR=192.168.8.101
NETMASK=255.255.255.0
GATEWAY=192.168.8.2
HWADDR=00:0C:29:56:63:A1
TYPE=Ethernet
UUID=ecb7f947-8a93-488c-a118-ffb011421cac
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
service network restart
ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:6C:20:2B
inet addr:192.168.8.101 Bcast:192.168.8.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe6c:202b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:777 errors:0 dropped:0 overruns:0 frame:0
TX packets:316 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:70611 (68.9 KiB) TX bytes:49955 (48.7 KiB)
rm -f /etc/udev/rules.d/70-persistent-net.rule
vim /etc/sysconfig/network-scripts/ifcfg-eth0
第三步:重启服务器
reboot
3、设置主机名
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=hadoop01
NETWORKING_IPV6=no
vi /etc/hosts
127.0.0.1 localhost
192.168.8.101 hadoop01
192.168.8.102 hadoop02
192.168.8.103 hadoop03
192.168.8.104 hadoop04
192.168.8.105 hadoop05
192.168.8.106 hadoop06
关闭ipv6
1、查看系统是否开启ipv6
a)通过网卡属性查看
命令:ifconfig
注释:有 “inet6 addr:。。。。。。。“ 的表示开启了ipv6功能
b)通过内核模块加载信息查看
命令:lsmod | grep ipv6
2、ipv6关闭方法
在/etc/modprobe.d/dist.conf结尾添加
alias net-pf-10 off
alias ipv6 off
可用vi等编辑器,也可以通过命令:
cat <<EOF>>/etc/modprobe.d/dist.conf
alias net-pf-10 off
alias ipv6 off
EOF
关闭防火墙
chkconfig iptables stop
chkconfig iptables off
改好后重启服务器:
reboot
4、安装JDK
vi /etc/proflie
export JAVA_HOME=/soft/jdk1.7.0_80/
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
source /etc/profile
5、SSH免密码登录
cd /root/.ssh
ssh-keygen -t rsa #4个回车
id_rsa id_rsa.pub
ssh-copy-id -i hadoop01
ssh-copy-id -i hadoop02
ssh-copy-id -i hadoop03
ssh-copy-id -i hadoop04
ssh-copy-id -i hadoop05
ssh-copy-id -i hadoop06
[root@hadoop01 .ssh]# ssh hadoop05
Last login: Tue Nov 10 17:43:41 2015 from 192.168.8.1
[root@hadoop05 ~]#
ssh-keygen -t rsa #4个回车
ssh-copy-id -i hadoop01
6、安装zookeeper
tar -zxvf zookeeper-3.4.6.tar.gz -C /root/soft
mv zoo.sample.cfg zoo.cfg
vi zoo.cfg
[root@hadoop04 conf]# 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=/soft/zookeeper-3.4.6/data
# 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.1=192.168.8.104:2888:3888
server.2=192.168.8.105:2888:3888
server.3=192.168.8.106:2888:3888
vi myid
bin/zkServer.sh start #启动
bin/zkServer.sh status #查看状态
[root@hadoop04 zookeeper-3.4.6]# bin/zkServer.sh status
JMX enabled by default
Using config: /soft/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: leader
[root@hadoop05 zookeeper-3.4.6]# bin/zkServer.sh status
JMX enabled by default
Using config: /soft/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
[root@hadoop06 zookeeper-3.4.6]# bin/zkServer.sh status
JMX enabled by default
Using config: /soft/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
bin/zkServer.sh stop
[root@hadoop04 zookeeper-3.4.6]# bin/zkServer.sh status
JMX enabled by default
Using config: /soft/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
[root@hadoop04 zookeeper-3.4.6]#
[root@hadoop05 zookeeper-3.4.6]# bin/zkServer.sh status
JMX enabled by default
Using config: /soft/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
[root@hadoop06 zookeeper-3.4.6]# bin/zkServer.sh status
JMX enabled by default
Using config: /soft/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: leader
7、hadoop安装
[root@hadoop01 hadoop-2.7.1]# ls
bin etc include journal lib libexec LICENSE.txt logs NOTICE.txt README.txt sbin share
7.1、添加hadoop目录到环境变量
export JAVA_HOME=/soft/jdk1.7.0_80/
export HADOOP_HOME=/soft/hadoop-2.7.1
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin
source /etc/profile
[root@hadoop01 hadoop-2.7.1]# which hadoop
/soft/hadoop-2.7.1/bin/hadoop
7.2、配置hadoop-env.sh
vim hadoop-env.sh
export JAVA_HOME=/soft/jdk1.7.0_80/
7.3、配置core-site.xml
<configuration>
<!-- 指定hdfs的nameservice为ns1 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://ns1</value>
</property>
<!-- 指定hadoop临时目录 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/soft/hadoop-2.7.1/tmp</value>
</property>
<!-- 指定zookeeper地址 -->
<property>
<name>ha.zookeeper.quorum</name>
<value>hadoop04:2181,hadoop05:2181,hadoop06:2181</value>
</property>
</configuration>
7.4、配置hdfs-site.xml
<configuration>
<!--指定hdfs的nameservice为ns1,需要和core-site.xml中的保持一致 -->
<property>
<name>dfs.nameservices</name>
<value>ns1</value>
</property>
<!-- ns1下面有两个NameNode,分别是nn1,nn2 -->
<property>
<name>dfs.ha.namenodes.ns1</name>
<value>nn1,nn2</value>
</property>
<!-- nn1的RPC通信地址 -->
<property>
<name>dfs.namenode.rpc-address.ns1.nn1</name>
<value>hadoop01:9000</value>
</property>
<!-- nn1的http通信地址 -->
<property>
<name>dfs.namenode.http-address.ns1.nn1</name>
<value>hadoop01:50070</value>
</property>
<!-- nn2的RPC通信地址 -->
<property>
<name>dfs.namenode.rpc-address.ns1.nn2</name>
<value>hadoop02:9000</value>
</property>
<!-- nn2的http通信地址 -->
<property>
<name>dfs.namenode.http-address.ns1.nn2</name>
<value>hadoop02:50070</value>
</property>
<!-- 指定NameNode的元数据在JournalNode上的存放位置 -->
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://hadoop04:8485;hadoop05:8485;hadoop06:8485/ns1</value>
</property>
<!-- 指定JournalNode在本地磁盘存放数据的位置 -->
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/soft/hadoop-2.7.1/journal</value>
</property>
<!-- 开启NameNode失败自动切换 -->
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<!-- 配置失败自动切换实现方式 -->
<property>
<name>dfs.client.failover.proxy.provider.ns1</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
<!-- 配置隔离机制 -->
<property>
<name>dfs.ha.fencing.methods</name>
<value>sshfence</value>
</property>
<!-- 使用隔离机制时需要ssh免登陆 -->
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/root/.ssh/id_rsa</value>
</property>
</configuration>
7.4、配置datanode的配置文件slaves
vi slaves
hadoop04
hadoop05
hadoop06
7.5、配置mapreduce文件mapred-site.xml
mv mapred-site.xml.example mapred-site.xml
<configuration>
<!-- 指定mr框架为yarn方式 -->
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
7.6、配置yarn-site.xml
<configuration>
<!-- 指定resourcemanager地址 -->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>hadoop03</value>
</property>
<!-- 指定nodemanager启动时加载server的方式为shuffle server -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
scp -r hadoop2.7.1 hadoop02:/soft/
scp -r hadoop2.7.1 hadoop03:/soft/
scp -r hadoop2.7.1 hadoop04:/soft/
scp -r hadoop2.7.1 hadoop05:/soft/
scp -r hadoop2.7.1 hadoop06:/soft/
7.7、启动Zookeeper服务
[root@hadoop04 zookeeper-3.4.6]# bin/zkServer.sh start
JMX enabled by default
Using config: /soft/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
7.8、在hadoop01上启动journalnode
[root@hadoop01 hadoop-2.7.1]# sbin/hadoop-daemons.sh start journalnode
[root@hadoop04 zookeeper-3.4.6]# jps
1532 JournalNode
1796 Jps
1470 QuorumPeerMain
7.9、在hadoop01上格式化hadoop
hadoop namenode -format
scp -r tmp/ hadoop02:/soft/hadoop-2.7.1/
7.10、在hadoop01上格式化ZK
hdfs zkfc -formatZK
7.11、在hadoop01上 启动HDFS
sbin/start-dfs.sh
7.12 在hadoop01上启动YARN
sbin/start-yarn.sh
8、使用hadoop集群测试
192.168.8.101 hadoop01
192.168.8.102 hadoop02
192.168.8.103 hadoop03
192.168.8.104 hadoop04
192.168.8.105 hadoop05
192.168.8.106 hadoop06
[root@hadoop01 hadoop-2.7.1]# jps
1614 NameNode
2500 Jps
1929 DFSZKFailoverController
[root@hadoop01 hadoop-2.7.1]# kill -9 1614
hadoop 2.7.1 高可用安装部署的更多相关文章
- openstack pike 集群高可用 安装 部署 目录汇总
# openstack pike 集群高可用 安装部署#安装环境 centos 7 史上最详细的openstack pike版 部署文档欢迎经验分享,欢迎笔记分享欢迎留言,或加QQ群663105353 ...
- Redis之Sentinel高可用安装部署
背景: 之前通过Redis Sentinel 高可用实现说明和Redis 复制.Sentinel的搭建和原理说明大致已经介绍了sentinel的原理和实现,本文再次做个简单的回顾.具体的信息见前面的两 ...
- hadoop高可用安装和原理详解
本篇主要从hdfs的namenode和resourcemanager的高可用进行安装和原理的阐述. 一.HA安装 1.基本环境准备 1.1.1.centos7虚拟机安装,详情见VMware安装Cent ...
- hadoop和hbase高可用模式部署
记录apache版本的hadoop和hbase的安装,并启用高可用模式. 1. 主机环境 我这里使用的操作系统是centos 6.5,安装在vmware上,共三台. 主机名 IP 操作系统 用户名 安 ...
- hadoop HA+Federation(高可用联邦)搭建配置(一)
hadoop HA+Federation(高可用联邦)搭建配置(一) 标签(空格分隔): 未分类 介绍 hadoop 集群一共有4种部署模式,详见<hadoop 生态圈介绍>. HA联邦模 ...
- Kubernetes实战(一):k8s v1.11.x v1.12.x 高可用安装
说明:部署的过程中请保证每个命令都有在相应的节点执行,并且执行成功,此文档已经帮助几十人(仅包含和我取得联系的)快速部署k8s高可用集群,文档不足之处也已更改,在部署过程中遇到问题请先检查是否遗忘某个 ...
- Centos下SFTP双机高可用环境部署记录
SFTP(SSH File Transfer Protocol),安全文件传送协议.有时也被称作 Secure File Transfer Protocol 或 SFTP.它和SCP的区别是它允许用户 ...
- Haproxy+Keepalived高可用环境部署梳理(主主和主从模式)
Nginx.LVS.HAProxy 是目前使用最广泛的三种负载均衡软件,本人都在多个项目中实施过,通常会结合Keepalive做健康检查,实现故障转移的高可用功能. 1)在四层(tcp)实现负载均衡的 ...
- LVS+Keepalived 高可用环境部署记录(主主和主从模式)
之前的文章介绍了LVS负载均衡-基础知识梳理, 下面记录下LVS+Keepalived高可用环境部署梳理(主主和主从模式)的操作流程: 一.LVS+Keepalived主从热备的高可用环境部署 1)环 ...
随机推荐
- lumen 在AppServiceProvider 使用Illuminate\Support\Facades\Redis 报错
这里需要注意 bootstrap/app.php中AppServiceProvider 和RedisServiceProvider 注入的先后顺序
- 移动端Touch事件
案例1: <!doctype html> <html lang="en"> <head> <meta charset="UTF- ...
- 你竟然在公钥中下毒!——如何在RSA公钥中添加后门
原文:http://www.hackdig.com/?01/hack-17893.htm 分享到: 当我知道它是如何运行时,我惊得下巴都掉了.这是一个非常简单的手法,但这篇文章会颠覆你之前对RSA的看 ...
- android studio实现Intent通信-------牛刀小试
概述: 本博文实现一种小程序,两个Activity单向通信,主从关系,MainActivty 页面布局一个EditText+Button,实现逻辑是单击按钮将信息发送给另外一个DisplayMessa ...
- Ad Hoc Distributed Queries的启用与关闭
启用Ad Hoc Distributed Queries: exec sp_configure 'show advanced options',1 reconfigure exec sp_config ...
- SQL存储过程相关信息查看
--1.查看所有存储过程与函数 exec sp_stored_procedures 或者 select * from dbo.sysobjects where OBJECT ...
- Oracle约束
1.非空约束 DROP TABLE member PURGE; CREATE TABLE member( mid NUMBER, name ) NOT NULL ); 2.唯一约束 DROP TABL ...
- Elasticsearch: 权威指南---基础入门
1.查看方式:GETURL:http://10.10.6.225:9200/?pretty pretty 在任意的查询字符串中增加pretty参数.会让Elasticsearch美化输出JSON结果以 ...
- tidb 记录文档
ansible-playbook stop.yml / start.yml 重启集群,在ansible目录下执行 SHOW STATS_META; 查看统计信息 重启集群:ansible-play ...
- Rookey.Frame v1.0 视频教程之三发布-框架核心思想介绍
本期发布视频: (三)Rookey.Frame v1.0框架核心思想 介绍了Rookey.Frame v1.0框架搭建的核心思想,将框架核心思想理解清楚,对框架运行就会得心应手 官方视频教程: htt ...