0 说明
本文基于本地虚拟机从零开始搭建ambari集群
1 前置条件
1.1 本地虚拟机环境
| 节点 | 角色 |
|---|---|
| ambari-1 | ambari-server ambari-agent |
| ambari-2 | ambari-agent |
| ambari-3 | ambari-agent |
1.2 安装包
1.3 修改主机名并配置hosts文件
hostnamectl set-hostname ambari-1
hostnamectl set-hostname ambari-2
hostnamectl set-hostname ambari-3
配置hosts,添加如下内容
192.168.2.51 ambari-1
192.168.2.52 ambari-2
192.168.2.53 ambari-3
1.4 配置节点间免密
所有节点执行
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
ssh-copy-id -i ~/.ssh/id_rsa.pub ambari-1
ssh-copy-id -i ~/.ssh/id_rsa.pub ambari-2
ssh-copy-id -i ~/.ssh/id_rsa.pub ambari-3
1.5 关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service

1.6 关闭selinux(所有节点)
vim /etc/sysconfig/selinux
修改
SELINUX=disabled
查看修改是否成功
sestatus -v

1.7 设置安全限制(所有节点)
vim /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
1.8 修改系统最大文件打开数(所有节点)
vim /etc/systemd/system.conf

1.9 安装pssh(非必须)
pssh基于Python编写的并发在多台服务器上批量执行命令的工具,它支持文件并行复制、远程并行执行命令、杀掉远程主机上的进程等,这里介绍安装及常用命令。
wget http://peak.telecommunity.com/dist/ez_setup.py
wget https://pypi.python.org/packages/60/9a/8035af3a7d3d1617ae2c7c174efa4f154e5bf9c24b36b623413b38be8e4a/pssh-2.3.1.tar.gz
- 解压
tar -zxvf pssh-2.3.1.tar.gz
build & install
python setup.py build
python setup.py install
- 创建nodes文件
添加需要批处理的服务器节点
ambari-1:22
ambari-2:22
ambari-3:22
- 使用示例
pssh -h /root/node.txt -i

本文详细介绍了如何在本地虚拟机环境中搭建Ambari集群,包括前置条件、安装步骤和配置细节,如设置主机名、配置防火墙、关闭selinux、安装http服务、配置离线yum源、安装jdk、Mysql以及Ambari和HDP,最后还涉及了Ambari的汉化过程。
最低0.47元/天 解锁文章
2130





