目录
1、服务器环境说明
2、防火墙设置
3、禁用selinux
4、配置jdk和mysql驱动
5、安装Mysql
6、mysql密码操作
7、安装httpd服务
8、安装ntp
9、ntp配置
10、时钟同步
11、安装yum
12、上传ambari和hdp
13、创建repo文件
14、分发repo文件
15、生成yum源
16、在mysql中创建ambari用户
17、初始化ambari数据库
18、安装ambari
19、ambari配置
20、启动ambari
我的环境如下:
192.168.8.105 my-hdp1
192.168.8.106 my-hdp2
192.168.8.107 my-hdp3
说明:使用root用户
三台节点均执行
#查看防火墙状态
systemctl status firewalld
#关闭防火墙
systemctl stop firewalld
#设置防火墙服务开机不自启
systemctl disable firewalld
#再次查看防火墙检查防火墙是否关闭
systemctl status firewalld
三台节点均执行
vim /etc/selinux.config
把SELINUX=enforcing修改为SELINUX=disabled
三台节点均执行
#创建目录
mkdir /usr/share/java
#该目录在后面需要用的,可以被其他用户访问的,如果是普通用户则不行,建议按这个配置
#上传java
tar -zxf jdk-8u144-linux-x64.tar.gz
#查看java环境
java -version
#将驱动上传到该路径
在my-hdp1上执行
#mysql安装包
rw-rw-r--. 1 sweet sweet 26460548 4月 7 18:30 mysql-community-client5.7.32-1.el7.x86_64.rpm
-rw-rw-r--. 1 sweet sweet 314936 4月 7 18:30 mysql-community-common5.7.32-1.el7.x86_64.rpm
-rw-rw-r--. 1 sweet sweet 2457204 4月 7 18:30 mysql-community-libs5.7.32-1.el7.x86_64.rpm
-rw-rw-r--. 1 sweet sweet 1260336 4月 7 18:30 mysql-community-libscompat-5.7.32-1.el7.x86_64.rpm
-rw-rw-r--. 1 sweet sweet 181712536 4月 7 18:30 mysql-community-server5.7.32-1.el7.x86_64.rpm
#将安装包放在一个目录下,可以一键安装
yum install *
#mysql启动
systemctl start mysqld.service
#mysql开机自启
systemctl status mysqld.service
#mysql状态
systemctl enable mysqld.service
在my-hdp1上执行
#获取初始化密码
grep "password" /var/log/mysqld.log
#mysql登录
mysql -uroot -pfeEa8F53kn(m
#设置mysql密码安全强度为0
set global validate_password_policy=0;
#设置mysql密码最低长度为1
set global validate_password_length=1;
#修改root用户密码
alter user 'root'@'localhost' identified by 'root';
#授权root用户所有权限并设置本地登录
grant all privileges on *.* to 'root'@'localhost' identified by 'root';
#授权root用户所有权限并设置远程登录
grant all privileges on *.* to 'root'@'%' identified by 'root';
#刷新权限
flush privileges;
在my-hdp1上执行
#安装
yum install httpd
#开机自启动
systemctl enable httpd.service
#启动httpd服务
systemctl start httpd.service
#查看httpd服务状态
systemctl staus httpd.service
#说明,安装完之后,会生成/var/www/html目录
三台节点均执行
#安装
yum install ntp
#开机自启动
systemctl enable ntpd
#启动ntp服务
systemctl start ntpd
#查看ntpd服务状态
systemctl status ntpd
在my-hdp1上执行
vim /etc/ntp.conf
#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
#表示ntp主服务器是与自身的系统时钟同步
server 127.127.1.0
#指定阶层编号为10,降低优先度
fudge 127.127.1.0 stratum 10
在my-hdp2、my-hdp3上执行
#my-hdp2、my-hdp3执行以下操作
vim /etc/ntp.conf
#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
#表示ntp主服务器是与自身的系统时钟同步
server 127.127.1.0
#指定阶层编号为10,降低优先度
fudge 127.127.1.0 stratum 10
#配置时间服务器为本地的时间服务器
server my-hdp1
#允许上层时间服务器主动修改本机时间
restrict my-hdp1 nomodify notrap noquery
三台节点均执行
yum install wget
yum install createrepo
yum install yum-utils
yum repolist
在my-hdp1上执行
#在my-hdp1上执行
#将安装包上传到/var/www/html
ambari-2.6.2.2-centos7.tar.gz
HDP-2.6.5.0-centos7-rpm.tar.gz
HDP-UTILS-1.1.0.22-centos7.tar.gz
#解压
tar -zxf 上面的包
在my-hdp1上执行
#进入/etc/yum.repo.d/
cd /etc/yum.repo.d/
#新建ambari.repo文件
vim ambari.repo
#添加以下内容
[ambari]
name=ambari
baseurl=http://my-hdp1/ambari/centos7/2.6.2.2-1
enabled=1
gpgcheck=0
#新建HDP.repo
vim HDP.repo
#添加以下内容
[HDP]
name=HDP
baseurl=http://my-hdp1/HDP/centos7/2.6.5.0-292
path=/
enabled=1
gpgcheck=0
#新建HDP-UTILS.repo
vim HDP-UTILS.repo
#添加以下内容
[HDP-UTILS]
name=HDP-UTILS
baseurl=http://my-hdp1/HDP-UTILS/centos7/1.1.0.22
path=/
enabled=1
gpgcheck=0
在my-hdp1上执行
#分发文件到my-hdp2、my-hdp3,使用分发的方式避免文件出错
#分发ambari.repo
scp ambari.repo root@my-hdp2:/etc/yum.repo.d
scp ambari.repo root@my-hdp3:/etc/yum.repo.d
#分发HDP.repo
scp HDP.repo root@my-hdp2:/etc/yum.repo.d
scp HDP.repo root@my-hdp3:/etc/yum.repo.d
#分发HDP-UTILS.repo
scp HDP-UTILS.repo root@my-hdp2:/etc/yum.repo.d
scp HDP-UTILS.repo root@my-hdp3:/etc/yum.repo.d
在my-hdp1上执行
#在/var/www/html下有三个文件夹
drwxr-xr-x. 3 root root 21 4月 7 14:58 ambari
drwxr-xr-x. 3 1001 users 21 5月 15 2018 HDP
drwxr-xr-x. 3 1001 users 21 8月 13 2018 HDP-UTILS
#分别进入以下目录查看是否有repodata目录
#ambari目录
/var/www/html/ambari/centos7/2.6.2.2-1
#HDP目录
/var/www/html/HDP/centos7/2.6.5.0-292
#HDP-UTILS目录
/var/www/html/HDP-UTILS/centos7/1.1.0.22
#如果上面的目录中没有repodata,则在上面的路径下执行
createrepo .
在my-hdp1上执行
#登录mysql
mysql -uroot -proot
#创建ambari用户
create user 'ambari'@'%' identified by 'ambari';
#授权ambari用户所有权限并设置本地登录
grant all privileges on *.* to 'ambari'@'localhost' identified by 'ambari';
#授权ambari用户所有权限并设置远程登录
grant all privileges on *.* to 'ambari'@'%' identified by 'ambari';
#刷新权限
flush privileges;
#退出登录
exit;
#使用ambari用户登录,检查ambari是否可以登录
mysql -uambari -pambari
#使用ambari用户登录并创建数据库
create database ambari;
在my-hdp1上执行
#使用amabri用户登录Mysql
mysql -uambari -pambari
#切换数据库
use ambari;
#初始化ambari数据库
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
在my-hdp1上执行
安装ambari-server
yum install ambari-server
#修改ambari.properties
vim /etc/ambari-server/conf/ambari.properties
#在ambari.properties文件末尾添加mysql-connector-java驱动
server.jdbc.driver.path=/var/share/java/mysql-connector-java-5.1.27-bin.jar
#ambari-server初始化配置
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java-5.1.27-bin.jar
在my-hdp1上执行
[root@my-hdp1 java]# ambari-server setup
Using python /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'permissive'
WARNING: SELinux is set to 'permissive' mode and temporarily disabled.
OK to continue [y/n] (y)? y
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (sweet):root
Adjusting ambari-server permissions and ownership...
Checking firewall status...
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
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:
Property cannot be blank.
Path to JAVA_HOME: /home/sweet/jdk1.8.0_144
Validating JDK on Ambari Server...done.
Checking GPL software agreement...
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? y
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL / MariaDB
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
[7] - BDB
==============================================================================
Enter choice (3): 3
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (ambari):
Configuring ambari database...
Configuring remote database connection properties...
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)? n
WARNING: Remote database setup aborted.
Ambari Server 'setup' completed with warnings.
[root@my-hdp1 java]# ambari-server setup
Using python /usr/bin/python
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'permissive'
WARNING: SELinux is set to 'permissive' mode and temporarily disabled.
OK to continue [y/n] (y)? y
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (sweet):root
Adjusting ambari-server permissions and ownership...
Checking firewall status...
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
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: /home/sweet/jdk1.8.0_144
Validating JDK on Ambari Server...done.
Checking GPL software agreement...
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? y
Configuring database...
==============================================================================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL / MariaDB
[4] - PostgreSQL
[5] - Microsoft SQL Server (Tech Preview)
[6] - SQL Anywhere
[7] - BDB
==============================================================================
Enter choice (3): 3
Hostname (localhost):
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (ambari):
Configuring ambari database...
Configuring remote database connection properties...
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)? y
Extracting system views...
ambari-admin-2.6.2.2.1.jar
...........
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
#启动ambari
ambari-server start
#启动成功后
在windows浏览器地址栏中输入
http://my-hdp1:8080/