成功了别忘了关注一下我哈
准备3台CentOS7虚拟机【设置root密码为 123456】
(以下步骤可以先在1台机器操作,然后克隆2台,最后再修改IP)
进入安装程序:
vi etc/sysconfig/network-scripts/ifcfg-ens33
#修改配置文件
BOOTPROTO=static
ONBOOT=yes
#添加以下内容
IPADDR=192.168.222.171
NETMASK=255.255.255.0
GATEWAY=192.168.222.2
DNS1=8.8.8.8
service network restart
hostnamectl set-hostname hdp01
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=hdp01.bigdata.com(自己随便设,保证前后一致就行)
完整克隆hdp01,修改主机名hdp02,hdp03
vi /etc/hosts
192.168.222.171 hdp01.bigdata.com hdp01
192.168.222.172 hdp02.bigdata.com hdp02
192.168.222.173 hdp03.bigdata.com hdp03
#关闭防火墙
systemctl stop firewalld
#关闭防火墙开机自启
systemctl disable firewalld
#通过此命令查看防火墙状态
systemctl status firewalld
#关闭SELINUX(master node)
setenforce 0
(所有节点)
vi /etc/selinux/config
#SELINUX=enforcing修改为
SELINUX=disabled
#重启系统
shutdown -r now
#查看selinux状态
getenforce
disabled为永久关闭,permissive为临时关闭,enforcing为开启
1.上传并解压压缩包
mkdir /data/tars
tar -zxvf /data/tars/jdk-8u171-linux-x64…gz -C /opt
2.配置环境变量
vi /etc/profile
export JAVA_HOME=/opt/jdk1.8.0_171
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
3.更新配置
source /etc/profile
4.验证
[root@hdp01 ~]# java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
10.Check the Maximum Open File Descriptors(所有节点)
ulimit -Sn
ulimit -Hn
#如果以上命令显示数量小于10000,建议调成10000(公司是65535,这里是虚拟机就写少一点吧)
ulimit -n 10000
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
2.把各个主机上公钥id_rsa.pub文件内容放到各个主机authorized_keys中
#hdp01
scp ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/id_rsa.pub.hdp01
scp ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/id_rsa.pub.hdp01
#hdp02
scp ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/id_rsa.pub.hdp02
scp ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/id_rsa.pub.hdp02
#hdp03
scp ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/id_rsa.pub.hdp03
scp ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/id_rsa.pub.hdp03
#hdp01
cat ~/.ssh/id_rsa.pub.hdp02 >> ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub.hdp03 >> ~/.ssh/authorized_keys
#hdp02
cat ~/.ssh/id_rsa.pub.hdp01 >> ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub.hdp03 >> ~/.ssh/authorized_keys
#hdp03
cat ~/.ssh/id_rsa.pub.hdp02 >> ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub.hdp01 >> ~/.ssh/authorized_keys
3.测试是否可以相互SSH成功
ssh hdp01
exit
ssh hdp02
exit
ssh hdp03
exit
选一台服务器作时间服务器,这里以 hdp01 作为时间服务器,其他服务器以时间服务器时间为准。
hdp01(时间服务器)
1.安装 ntp 服务(三台均安装)
yum install -y ntp
2.修改 ntp 配置文件
vi /etc/ntp.conf
#根据自己机器的情况,设置允许 hdp02 和 hdp03 机器可以从这台机器上查询和同步时间
restrict hdp02 mask 255.255.255.0 nomodify notrap
restrict hdp03 mask 255.255.255.0 nomodify notrap
#注释以下代码
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
#添加(当该节点丢失网络连接,依然可以采用本地时间作为时间服务器为集群中的其他节点提供时间同步)
server 127.127.1.0
fudge 127.127.1.0 stratum 10
hdp02和hdp003分别加上
restrict 192.168.111.171 nomodify notrap noquert
server 192.168.111.171
3.启动ntp服务并设置开机自启
#启动ntpd服务
systemctl start ntpd
#配置ntpd服务开机自启
systemctl enable ntpd
hdp02、hdp03
1.安装 ntpdate 服务
yum install -y ntpdate
2.同步时间
ntpdate hdp01
3.定时同步时间
crontab -e
#添加如下内容
#每小时的第29分和59分同步一次时间
29,59 * * * * /usr/sbin/ntpdate hdp01
这里将 hdp01 作为 http 服务器。
#安装服务
yum -y install httpd
#启动服务
systemctl start httpd
#将httpd加入到开机自启
systemctl enable httpd
1.将Amber、HDP、HDP-UTILS文件上传到 hdp01 ,并解压
#先在/var/www/html目录下创建ambari、hdp、hdp-utils文件夹
mkdir /var/www/html/ambari
mkdir /var/www/html/hdp
mkdir /var/www/html/hdp-utils
#解压文件
tar -zxvf /data/tars/ambari-2.7.4.0-centos7.tar.gz -C /var/www/html/ambari/
tar -zxvf /data/tars/HDP-3.1.4.0-centos7-rpm.tar.gz -C /var/www/html/hdp/
tar -zxvf /data/tars/HDP-UTILS-1.1.0.22-centos7.tar.gz -C /var/www/html/hdp-utils/
2.配置ambari的yum源
vi /etc/yum.repos.d/ambari.repo
#添加以下内容
[ambari]
name=ambari
baseurl=http://192.168.174.51/ambari/ambari/centos7/2.7.4.0-118/
gpgcheck=0
3.配置hdp和hdp-utils的yum源
vi /etc/yum.repos.d/hdp.repo
#添加以下内容
[HDP-3.1]
name=HDP-3.1
baseurl=http://192.168.174.51/hdp/HDP/centos7/3.1.4.0-315/
gpgcheck=0
[HDP-UTILS-1.1.0.22]
name=HDP-UTILS-1.1.0.22
baseurl=http://192.168.174.51/hdp-utils/HDP-UTILS/centos7/1.1.0.22/
gpgcheck=0
4.验证
yum repolist
5.分发 yum 文件到 hdp02 和 hdp03
scp /etc/yum.repos.d/ambari.repo hdp02:/etc/yum.repos.d/
scp /etc/yum.repos.d/hdp.repo hdp02:/etc/yum.repos.d/
scp /etc/yum.repos.d/ambari.repo hdp03:/etc/yum.repos.d/
scp /etc/yum.repos.d/hdp.repo hdp03:/etc/yum.repos.d/
只在hdp01上安装
yum -y install wget
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
上传mysql57-community-release-el7-8.noarch.rpm文件
rpm -ivh mysql57-community-release-el7-8.noarch.rpm --nodeps --force
yum install mysql-server
service mysqld status
systemctl start mysqld
MySQL为root用户生成的随机密码通过mysqld.log文件可以查找到:
grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
mysql> Enter password: (输入刚才查询到的随机密码)
mysql> SET PASSWORD FOR 'root'@'localhost'= "Root-123";
mysql> exit
用root新密码登录:
mysql -u root -pRoot-123
配置远程登录
允许使用用户名 root 密码 Root-123456 从任何主机连接到mysql服务器
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Root-123456' WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;
mysql>exit;
创建ambari数据库及用户,登录root用户执行下面语句:
create database ambari character set utf8 ;
CREATE USER 'ambari'@'%'IDENTIFIED BY 'Ambari-123';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
FLUSH PRIVILEGES;
安装mysql jdbc 驱动
yum install mysql-connector-java
yum install yum-utils createrepo
在所有节点都要更新源
yum clean all
yum makecache
yum repolist
yum install ambari-server
ambari-server setup
JAVA_HOME:填存在的Java地址
/opt/jdk1.8.0_171
mysql -uambari –pAmbari-123
use ambari;
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
exit;
浏览器输入:http://192.168.222.171:8080
默认用户名/密码:admin/admin
删除掉除了"Redhat7"之外的其他操作系统(这里选择redhat7,因为是CentOS7系统)
填写刚才配置的repo文件中的地址
http://hdp01/hdp/HDP/centos7/3.1.4.0-315/
http://hdp01/hdp-utils/HDP-UTILS/centos7/1.1.0.22/
通过cat /root/.ssh/id_rsa查看私钥内容。
直接copy
要安装hive组件的额外操作:
具体设置hive元数据存放位置(这里新建一个库来放)
#登录数据库
mysql -uroot -pRoot-123
#创建hive元数据库
mysql> create database hive;
#创建hive用户
mysql> CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';
#授权
mysql> grant all on hive.* to hive@'%' identified by 'hive';
mysql> grant all on hive.* to hive@localhost identified by 'hive';
经常会在启动ambari的时候登录不了界面:
需要查看日志排查错误:
tail -200 /var/log/ambari-server/ambari-server.log
在网上搜索解决办法,对症解决