机器 版本 主机名
10.20.12.24 CentOS Linux release 7.5.1804 (Core) master.bigdata.com
10.20.12.27 CentOS Linux release 7.5.1804 (Core) slave2.bigdata.com
10.20.12.26 CentOS Linux release 7.5.1804 (Core) slave1.bigdata.com
最好装个:
yum install -y lrzsz
修改hosts
vi /etc/hosts
设置hostname
hostnamectl set-hostname master.bigdata.com
查看hostname
hostname -f
修改network
vi /etc/sysconfig/network
添加
NETWORKING=yes
HOSTNAME=master.bigdata.com
systemctl stop firewalld.service && systemctl disable firewalld.service && systemctl list-unit-files |grep firewall*
关闭selinux:
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config && cat /etc/selinux/config
reboot
mkdir -p /opt/soft
上传的资料如下:
省略
生成ssh公司钥:
ssh-keygen
将3台机器的id_rsa.pub都放到authorized_keys,然后每台机器保留一份
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
scp -r ~/.ssh/authorized_keys slave1.bigdata.com:/root/.ssh/
scp -r ~/.ssh/authorized_keys slave2.bigdata.com:/root/.ssh
rpm:https://centos.pkgs.org/7/centos-x86_64/ntp-4.2.6p5-28.el7.centos.x86_64.rpm.html
ntp离线安装:
systemctl stop chronyd.service && systemctl disable chronyd.service
安装rpm包:
进入资料文件:
cd /opt/soft/
执行命令:
rpm -ivh ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm && rpm -ivh autogen-libopts-5.18-5.el7.x86_64.rpm && rpm -ivh ntp-4.2.6p5-28.el7.centos.x86_64.rpm
修改ntp.cnf
vi /etc/ntp.conf
服务端:
//然后添加这两行 ,意思是 允许IPV4 IPV6 查询 拒绝修改
restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify
//添加修改上层时间服务器,如果能联通外网,则不需要修改,
//server 0.rhel.pool.ntp.org iburst
//server 1.rhel.pool.ntp.org iburst
//server 2.rhel.pool.ntp.org iburst
//server 3.rhel.pool.ntp.org iburst
//如果联不通外网,则把上面几行注释,然后添加下面两行,意思是设置成时间服务器是自己
server 127.127.1.0
Fudge 127.127.1.0 stratum 8
客户端:
//配置上层server(要同步的),在这里配置的是实际的物理地址
//然后添加这两行 ,意思是 允许IPV4 IPV6 查询 拒绝修改
restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify
//允许上层进行修改本机时间
//restrict 10.173.24.27 nomodify notrap noquery
//配置上层server(要同步的),在这里配置的是实际的物理地址
server 10.20.12.24
fudge 10.20.12.24 stratum 8
启动ntpd,并开机自启:
systemctl start ntpd.service && systemctl enable ntpd.service
查看是否原有jdk:
rpm -qa | grep jdk
如果有的话使用以下命令删除:
yum -y remove java*openjdk*
安装jdk
进入jdk.rpm存放路径
cd /opt/soft
rpm -ivh jdk-8u201-linux-x64.rpm
声明外连接连接到jdk
ln -s /usr/java/jdk1.8.0_201-amd64 /usr/java/jdk1.8.0
设置环境变量
vi /etc/profile
添加环境变量
JAVA_HOME=/usr/java/jdk1.8.0
CLASS_PATH=./$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASS_PATH PATH
刷新配置文件
source /etc/profile
测试
java -version
查看是否包含了mariadb
rpm -qa |grep mariadb
如果存在的话就删除:
rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
安装mysql
mkdir -p /usr/local && tar -zxvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local
进入mysql的安装的路径
cd /usr/local
配置外连接
ln -s mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz mysql
修改mysql配置文件
vi /etc/my.cnf
添加配置:
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=/usr/local/mysql
# 设置mysql数据库的数据的存放目录
datadir=/usr/local/mysql/data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
lower_case_table_names=1
max_allowed_packet=16M
# 跳过验证,如果忘记密码使用 alter user 'root'@'localhost' identified by '123456';
#skip-grant-tables
创建mysql组,并加入mysql用户
groupadd mysql && useradd -g mysql mysql
注册服务
mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
注意初始密码:;Sw1#k*>3Y&g
复制启动文件
cp mysql/support-files/mysql.server /etc/init.d/mysqld
声明环境变量
vi /etc/profile
添加
PATH=$JAVA_HOME/bini:/usr/local/mysql/bin:$PATH
更新配置文件
source /etc/profile
开机自启
chkconfig --level 35 mysqld on
chkconfig --add mysqld
启动服务
service mysqld start
利用初始化的密码,登陆mysql,并初始化密码
初始化密码
set password =password('abc123!@#');
因为考虑内网情况,建议使用tomcat代替httpd服务:
部署tomcat略:
修改tomcat的web.xml
vi web.xml
修改tomcat的端口号,为9090.
在webapps目录下创建hdp文件夹,进入资料存储路径,将资料解压到hdp文件夹下:
tar -zxvf ambari-2.6.2.2-centos7.tar.gz -C /opt/tomcat/webapps/hdp/
tar -zxvf HDP-2.6.5.0-centos7-rpm.tar.gz -C /opt/tomcat/webapps/hdp/
tar -zxvf HDP-GPL-2.6.5.0-centos7-gpl.tar.gz -C /opt/tomcat/webapps/hdp/
tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz -C /opt/tomcat/webapps/hdp/
后台启动启动tomcat。
nohup sh bin/startup.sh &
ambari.repo
#VERSION_NUMBER=2.6.2.2-1
[ambari-2.6.2.2]
name=ambari Version - ambari-2.6.2.2
baseurl=http://10.20.12.24:9090/hdp/ambari/centos7/2.6.2.2-1/
gpgcheck=1
gpgkey=http://10.20.12.24:9090/hdp/ambari/centos7/2.6.2.2-1/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
hdp.repo
#VERSION_NUMBER=2.6.5.0-292
[HDP-2.6.5.0]
name=HDP Version - HDP-2.6.5.0
baseurl=http://10.20.12.24:9090/hdp/HDP/centos7/2.6.5.0-292
gpgcheck=1
gpgkey=http://10.20.12.24:9090/hdp/HDP/centos7/2.6.5.0-292/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.20.12.24:9090/hdp/HDP-UTILS/centos7/1.1.0.22
gpgcheck=1
gpgkey=http://10.20.12.24:9090/hdp/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
hdp-utils.repo
[HDP-UTILS-1.1.0.22]
name=Hortonworks Data Platform Utils Version - HDP-UTILS-1.1.0.22
baseurl=http://10.20.12.24:9090/hdp/HDP-UTILS/centos7/1.1.0.22/
gpgcheck=1
enabled=1
priority=1
hdp-gpl.gpl.repo
#VERSION_NUMBER=2.6.5.0-292
[HDP-GPL-2.6.5.0]
name=HDP-GPL Version - HDP-GPL-2.6.5.0
baseurl=http://10.20.12.24:9090/hdp/HDP-GPL/centos7/2.6.5.0-292
gpgcheck=1
gpgkey=http://10.20.12.24:9090/hdp/HDP-GPL/centos7/2.6.5.0-292/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
清楚一下yum的缓存
yum clean all && yum makecache && yum repolist
如果出现repo重复,这对应的去除该重复的repo。
yum install -y ambari-server;
如果是内网环境需要先手动安装这3个包。
postgresql-libs-9.2.24-1.el7_5.x86_64.rpm
postgresql-server-9.2.24-1.el7_5.x86_64.rpm
postgresql-9.2.24-1.el7_5.x86_64.rpm 安装前准备:
mysql:
开启远程访问:
grant all on *.* to 'root'@'%' identified by 'abc123!@#';
flush privileges;
执行以下建库操作:
CREATE DATABASE ambari;
use ambari;
CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
CREATE USER 'ambari'@'localhost' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost';
CREATE USER 'ambari'@'master' IDENTIFIED BY 'ambari';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'master';
FLUSH PRIVILEGES;
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
CREATE DATABASE hive;
use hive;
CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%';
CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost';
CREATE USER 'hive'@'master' IDENTIFIED BY 'hive';
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'master';
FLUSH PRIVILEGES;
建立mysql和ambari-server的连接
创建:
mkdir /usr/share/java
cp -r /opt/soft/mysql-connector-java-5.1.47.jar /usr/share/java/
cd /usr/share/java
mv mysql-connector-java-5.1.47.jar mysql-connector-java.jar
cp /usr/share/java/mysql-connector-java.jar /var/lib/ambari-server/resources/mysql-jdbc-driver.jar
将mysql的连接的jar放到该路径
更改ambari的配置文件
vi /etc/ambari-server/conf/ambari.properties
添加配置:
server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar
ambari-server安装:
执行命令:
ambari-server setup
下面是配置执行流程,按照提示操作
(1) 提示是否自定义设置。输入:y
Customize user account for ambari-server daemon [y/n] (n)? y
(2)ambari-server 账号。
Enter user account for ambari-server daemon (root):
如果直接回车就是默认选择root用户
如果输入已经创建的用户就会显示:
Enter user account for ambari-server daemon (root):ambari
Adjusting ambari-server permissions and ownership...
(3)检查防火墙是否关闭
Adjusting ambari-server permissions and ownership...
Checking firewall...
WARNING: iptables is running. Confirm the necessary Ambari ports are accessible. Refer to the Ambari documentation for more details on ports.
OK to continue [y/n] (y)?
直接回车
(4)设置JDK。输入:3
Checking JDK...
Do you want to change Oracle JDK [y/n] (n)? y
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Oracle JDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7
[3] Custom JDK
==============================================================================
Enter choice (1): 3
如果上面选择3自定义JDK,则需要设置JAVA_HOME。输入:/usr/java/jdk1.8.0_161
WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts.
WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Path to JAVA_HOME: /usr/java/jdk1.8.0_131
Validating JDK on Ambari Server...done.
Completing setup...
(5)数据库配置。选择:y
Configuring database...
Enter advanced database configuration [y/n] (n)? y
(6)选择数据库类型。输入:3
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
==============================================================================
Enter choice (3): 3
(7)设置数据库的具体配置信息,根据实际情况输入,如果和括号内相同,则可以直接回车。如果想重命名,就输入。
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):ambarizk123
Re-Enter password: ambarizk123
(8)将Ambari数据库脚本导入到数据库
WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
Proceed with configuring remote database connection properties [y/n] (y)?
启动ambari-server
ambari-server start
访问10.20.12.24:8080
设置集群名称:
省略
这个地方应该会报错,执行以下操作:
vi /etc/python/cert-verification.cfg
将原有内容改为 verify=disable
vi /etc/ambari-agent/conf/ambari-agent.ini
添加
[security]
force_https_protocol=PROTOCOL_TLSv1_2
这个地方应该会出错:
rpm --import http://10.20.12.24:9090/hdp/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
漫长等待之后,访问8080