介绍Ambari搭建本地仓库并部署集群。
- 操作系统:CentOS-7-x86_64-DVD-1611
硬件要求:master要6G内存,slave要4G内存,客户端要2G内存 环境准备,所有机器上都需要执行以下内容:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52/* 开机启动网卡 */
# vim /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
# service network restart // 重启网卡
# ifconfig // 查看IP
/* 修改hostname */
# hostname master.o.cn
# vim /etc/sysconfig/network // 永久修改hostname
HOSTNAME=master.o.cn // slave机器命名为slave.o.cn
/* 关闭iptables、防火墙、SELinux、PackageKit */
# service iptables stop // 暂时关闭
# chkconfig iptables off // 永久关闭
# systemctl stop firewalld.service // 关闭firewall
# systemctl disable firewalld.service // 禁止firewall开机启动
# vim /etc/selinux/config
SELINUX=disabled
# vim /etc/yum/pluginconf.d/refresh-packagekit.conf
enabled=0
/* 同步时钟 */
# yum install ntpd // 安装同步时钟
# service ntpd start // 启动
# chkconfig ntpd on // 设置开机启动
/* 重启生效 */
# reboot
# hostname
# service iptables status
# service ntpd status
# sestatus -v
/* 添加域名映射 */
# vim /etc/hosts
192.168.0.100 master.o.cn
192.168.0.101 slave01.o.cn
...
/* SSH免密码登录 */
/* master */
# ssh-keygen -t rsa // 按三次回车
# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
# scp /root/.ssh/id_rsa.pub root@slave01.o.cn:~/
/* slave */
# ssh-keygen -t rsa
# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
# cat id_rsa.pub >> /root/.ssh/authorized_keys
# scp /root/.ssh/id_rsa.pub root@master.o.cn:~/
/* master */
# cat id_rsa.pub >> /root/.ssh/authorized_keys
# ssh slave01.o.cn // 测试是否成功本地仓库搭建
在hortonworks.com下载Ambari、HDP、HDP-UTILS三个压缩包,将Ambari上传至仓库服务器的/var/www/html目录,HDP和HDP-UTILS上传至/var/www/html/hdp目录1
2
3
4
5
6
7
8
9
10
11
12/* 安装httpd */
# yum install httpd // 安装
# service httpd start // 启动
# chkconfig httpd on // 开机启动
/* 解压缩 */
# tar -zxvf /var/www/html/Ambari.tar.gz
# tar -zxvf /var/www/html/hdp/HDP.tar.gz
# tar -zxvf /var/www/html/hdp/HDP-UTILS.tar.gz
# rm -rf /var/www/html/Ambari.tar.gz
# rm -rf /var/www/html/hdp/HDP.tar.gz
# rm -rf /var/www/html/hdp/HDP-UTILS.tar.gz
在浏览器中输入以下路径可以访问资源目录:
Repo | URL |
---|---|
Ambari | http://[仓库服务器IP]/ambari/centos7 |
HDP | http://[仓库服务器IP]/hdp/HDP/centos7 |
HDP-UTILS | http://[仓库服务器IP]/hdp |
- 安装
1 | /* 编辑ambari.repo */ |
配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15// 如需使用自定义数据库,需要在配置ambari前将数据库准备完成
// 不支持MSSQL Server和SQL Anywhere数据库
# ambari-server setup
1. 如果SELinux未禁用,会跳出提示,选择y;
2. 用当前root用户运行ambari,选择n;
3. 如果iptables未禁用,会跳出提示,选择y;
4. 下载安装JDK1.8,选择1,;
5. 同意JDK协议,选择y;
6. 使用默认的PostgreSQL数据库配置(数据库ambari,用户名ambari,密码bigdata),选择n;
// 如果使用自定义数据库,选择y,并且按照下列步骤:
// Oracle:输入2;
// MySQL/MariaDB:输入3;
// PostgreSQL:输入4;
// 输入数据库服务器IP、数据库名、用户名、密码;
// 确定,选择y;启动
1
2
3
4
5
6
7
8
9# ambari-server start // 停止服务 ambari-server stop
...
Ambari Server 'start' completed successfully.
# ambari-server status
Using python /usr/bin/python
Ambari-server status
Ambari Server running
Found Ambari Server PID: 11066 at: /var/run/ambari-server/ambari-server.pid登录Apache Ambari
http://[安装Ambari的系统IP]:8080
默认:账号admin,默认admin
如果无法登录,尝试以下操作1
2
3
4
5
6# service iptables stop // 暂时关闭
# chkconfig iptables off // 永久关闭
# systemctl stop firewalld.service // 关闭firewall
# systemctl disable firewalld.service // 禁止firewall开机启动
# service iptables status // 查看防火墙状态
# vim /etc/sysconfig/selinux // 设置SELINUX=disabled启动Ambari Cluster安装向导,选择Launch Install Wizard
- 输入集群名:Tyrival;
- 选择HDP版本和软件安装仓库,centos7:
HDP:http://master.o.cn/hdp/HDP/centos7
HDP-UTILS:http://master.o.cn/hdp - 在Target Hosts输入Hosts名称,可以输入多台服务器地址,SSH Private Key中上传输入master机器的id_rsa内容;
- 下一步直到结束。
- 部署成功。