1.设置三台服务器的hostname
ctticData1.ctticsh.cn
ctticData2.ctticsh.cn
ctticData3.ctticsh.cn
2.设置三台服务器的hosts
三个节点添加
10.10.10.156 ctticData1.ctticsh.cn
10.10.10.157 ctticData2.ctticsh.cn
10.10.10.158 ctticData3.ctticsh.cn
3.三台关闭SELinux
编辑:/etc/sysconfig/selinux
4.三台关闭防火墙
systemctl stop firewalld.service
设置开机不启动:systemctl disable firewalld.service
5.安装时间同步服务(ntp)
三个节点安装服务:yum -y install ntp
主节点配置 /etc/ntp.conf
server 127.127.1.0
fudge 127.127.1.0 stratum 8
子节点:
三个节点启动ntp,并设置为开机自起
systemctl start ntpd.service
systemctl enable ntpd.service
6.配置ssh免登陆
三个节点执行 ssh-keygen -t rsa 一直回车
节点ctticData2.ctticsh.cn执行:
scp /root/.ssh/id_rsa.pub ctticData1.ctticsh.cn:/root/.ssh/id_rsa.pub2
节点ctticData3.ctticsh.cn执行:
scp /root/.ssh/id_rsa.pub ctticData1.ctticsh.cn:/root/.ssh/id_rsa.pub3
主节点ctticData1.ctticsh.cn执行:
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
cat /root/.ssh/id_rsa.pub2 >> /root/.ssh/authorized_keys
cat /root/.ssh/id_rsa.pub3 >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
scp /root/.ssh/authorized_keys ctticData2.ctticsh.cn:/root/.ssh/
scp /root/.ssh/authorized_keys ctticData3.ctticsh.cn:/root/.ssh/
其他两个节点执行:
chmod 600 /root/.ssh/authorized_keys
7.三个节点安装jdk
rpm -ivh jdk-8u221-linux-x64.rpm
配置环境变量
vim /etc/profile
# 末尾追加以下内容
export JAVA_HOME=/usr/java/default
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
生效指令:source /etc/profile
8.主节点安装mysql
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
开启并设置开机自启
systemctl start mysqld.service # 启动mysql
systemctl status mysqld.service # 查看mysql状态
systemctl enable mysqld.service # 开机自启
打印初始密码:grep “password” /var/log/mysqld.log
登录:mysql -uroot -p
输入原始密码,回车
修改初始密码:
set global validate_password_policy=0;
set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
(执行:yum -y remove mysql57-community-release-el7-10.noarch
卸载yum,防止自动更新)
配置mysql编码,字符格式:vim /etc/my.cnf
在[mysqld]下添加
collation_server=utf8_general_ci
character_set_server=utf8
default-storage-engine=INNODB
在[client]下添加(如果没有[client],则创建)
default_character-set=utf8
重启mysql:systemctl restart mysqld.service
创建ambari库和用户
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
mysql> create database ambari character set utf8;
mysql> CREATE USER 'ambari'@'%'IDENTIFIED BY '123456';
mysql> GRANT ALL PRIVILEGES ON ambari.* TO 'ambari'@'%';
mysql> FLUSH PRIVILEGES;
创建hive库和用户
mysql> create database hive character set utf8;
mysql> CREATE USER 'hive'@'%'IDENTIFIED BY '123456';
mysql> GRANT ALL PRIVILEGES ON hive.* TO 'hive'@'%';
mysql> FLUSH PRIVILEGES;
安装:
yum install mysql-connector-java
配置允许远程访问,使用root登录
set global validate_password_policy=0;
set global validate_password_length=1;
GRANT ALL PRIVILEGES ON ambari.* TO 'ambari'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON ambari.* TO 'ambari'@'%' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;
初始化数据库数据,使用ambari登录
use ambari;
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
9.安装apache,解压ambari的资源包
yum install httpd -y
创建和解压ambari相关的压缩文件
mkdir /var/www/html/ambari
mkdir /var/www/html/hdp
mkdir /var/www/html/hdp/HDP-UTILS-1.1.0.22
tar -zxvf ambari-2.7.3.0-centos7.tar.gz -C /var/www/html/ambari/
tar -zxvf HDP-3.1.0.0-centos7-rpm.tar.gz -C /var/www/html/hdp/
tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/hdp/HDP-UTILS-1.1.0.22/
systemctl start httpd # 启动httpd
systemctl status httpd # 查看httpd状态
systemctl enable httpd # 设置httpd开机自启
10.配置本地repo
主节点
创建:etc/yum.repos.d/ambari.repo
编辑ambari.repo
#VERSION_NUMBER=2.7.3.0-139
[ambari-2.7.3.0]
#json.url = http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json
name=ambari Version - ambari-2.7.3.0
baseurl=http://10.10.10.156/ambari/ambari/centos7/2.7.3.0-139
gpgcheck=1
gpgkey=http://10.10.10.156/ambari/ambari/centos7/2.7.3.0-139/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
创建:HDP.repo
编辑
#VERSION_NUMBER=3.1.0.0-78
[HDP-3.1.0.0]
name=HDP Version - HDP-3.1.0.0
baseurl=http://10.10.10.156/hdp/HDP/centos7/3.1.0.0-78
gpgcheck=1
gpgkey=http://10.10.10.156/hdp/HDP/centos7/3.1.0.0-78/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-UTILS-1.1.0.22]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.22
baseurl=http://10.10.10.156/hdp/HDP-UTILS-1.1.0.22/HDP-UTILS/centos7/1.1.0.22
gpgcheck=1
gpgkey=http://10.10.10.156/hdp/HDP-UTILS-1.1.0.22/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
分发到其他两个子节点
生成本地源:
createrepo /var/www/html/hdp/HDP/centos7/
createrepo /var/www/html/hdp/HDP-UTILS-1.1.0.22/
11.安装ambari
主节点:yum install ambari-server
初始化ambari: ambari-server setup
所有节点:yum -y install ambari-agent
启动ambari:
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
ambari-server start