规划
OS:CentOS 6.5
Ambari-yumrepo 10.10.10.20 公网
Ambari-server 10.10.10.10 内网
Hadoop-master1 10.10.10.1 内网
hadoop-master2 10.10.10.2 内网
hadoop-slave1 10.10.10.3 内网
hadoop-slave2 10.10.10.4 内网
hadoop-slave3 10.10.10.5 内网
准备工作
(1)修改主机名
-
Ambari-server、master1、master2、slave1、slave2、slave3
$
hostname
XXX &&
echo
XXX >
/etc/hostname
$
cat
>>
/etc/hosts
<< EOF
10.10.10.1 master1
10.10.10.2 master2
10.10.10.3 slave1
10.10.10.4 slave2
10.10.10.5 slave3
10.10.10.10 ambari-server
10.10.10.20 ambari-yumrepo
EOF
(2)关闭selinux和防火墙
-
Ambari-server、master1、master2、slave1、slave2、slave3
$ setenforce 0
$ service iptables stop
$ chkconfig iptables off
(3)主从节点ssh互信
-
slave1、slave2、slave3
$
echo
sshd:10.64.8.1 10.64.8.2 >>
/etc/hosts
.allow
-
master1、master2
$
ssh
-keygen -t rsa
$
ssh
-copy-
id
-i ~/.
ssh
/id_rsa
.pub root@slave1
$
ssh
-copy-
id
-i ~/.
ssh
/id_rsa
.pub root@slave2
$
ssh
-copy-
id
-i ~/.
ssh
/id_rsa
.pub root@slave3
(4)安装jdk
-
Ambari-server、master1、master2、slave1、slave2、slave3
(5)格式化硬盘
-
Ambari-server、master1、master2、slave1、slave2、slave3
$
yes
|mkfs.ext4
/dev/sdb
$
mkdir
/data
$
mount
/dev/sdb
/data
$
echo
"mount /dev/sdb /data"
>>
/etc/rc
.
local
(6)系统参数调优
-
Ambari-server、master1、master2、slave1、slave2、slave3
$
cat
>>
/etc/sysctl
.conf <<EOF
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_baklog = 8192
net.ipv4.tcp_max_tw_bukets = 5000
EOF
文件打开数
$
cat
>>
/etc/security/limits
.conf <<EOF
* soft nofile 65535* hard nofile 65535
EOF
重启
二:搭建内网yum源
注意:因为考虑到hadoop集群的机器可能是内网机器,没有公网访问权限,那么选择搭建一个内网的yum源,这个yum源的机器需要有公网权限。如果你的机器都可以出公网,也可以跳过这一步。
(1)添加yum源
-
Ambari-yumrepo
$
cd
/opt
$ wget http:
//public-repo-1
.hortonworks.com
/ambari/centos6/1
.x
/updates/1
.4.1.25
/ambari
.repo
$
cp
ambari.repo
/etc/yum
.repos.d/
(2)同步yum源的包
-
Ambari-yumrepo
$ reposync -r HDP-UTILS-1.1.0.16
$ reposync -r Updates-ambari-1.4.1.25
$ reposync -r ambari-1.x
会在当前目录生成三个目录。
(3)发布yum源
-
Ambari-yumrepo
需要一个web服务器来发布,已经安装了nginx,将上面下载包的三个目录移动到nginx发布目录下。
$ yum
install
nginx
$
mkdir
/usr/share/nginx/html/ambari
$
cp
-R ambari-1.x
/usr/share/nginx/html/ambari/
$
cp
-R HDP-UTILS-1.1.0.16
/usr/share/nginx/html/ambari/
$
cp
-R Updates-ambari-1.4.1.25
/usr/share/nginx/html/ambari/
(4)创建repo
-
Ambari-yumrepo
安装createrepo命令
$ yum
install
createrepo
$
cd
/usr/share/nginx/html/ambari/
$ createrepo ./
(5)添加HDP源
-
Ambari-yumrepo
$ vim
/etc/yum
.repos.d
/HDP
.repo
[HDP-2.0.6]
name=HDP
baseurl=http:
//public-repo-1
.hortonworks.com
/HDP/centos6/2
.x
/updates/2
.0.6.0
enabled=1
gpgcheck=0
$
mkdir
/usr/share/nginx/html/hdp
$
cd
/usr/share/nginx/html/hdp
同步网络源的包,1G左右。
$ reposync -r HDP-2.0.6
$ createrepo ./
这样就本地yum源就OK了!
(6)配置yum.repo配置文件,放在web目录下。
-
Ambari-yumrepo
注意:这个ambari.repo配置是给其他机器来使用的,不是本机的配置。
$
mkdir
/usr/share/nginx/html/hadoop
$
cd
/usr/share/nginx/html/hadoop
$ vim ambari.repo
[ambari-1.x]
name=Ambari 1.x
baseurl=http:
//10
.10.10.20
/ambari/
gpgcheck=0
enabled=1
[HDP-UTILS-1.1.0.16]
name=Hortonworks Data Platform Utils Version - HDP-UTILS-1.1.0.16
baseurl=http:
//10
.10.10.20
/ambari/
gpgcheck=0
enabled=1
[Updates-ambari-1.4.1.25]
name=ambari-1.4.1.25 - Updates
baseurl=http:
//10
.64.10.20
/ambari/
gpgcheck=
enabled=1
$ vim hdp.repo
[HDP-2.0.6]
name=HDP
baseurl=http:
//10
.10.10.20
/hdp
path=/
enabled=1
gpgcheck=0
更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2017-03/142136p2.htm