最近我负责安装了学院服务器集群系统和管理大数据应用服务的Apache Ambari + HDP,分享一下过程。
目录
软件版本
软件名称 | 版本 |
---|---|
JDK | Oracle jdk1.8.0_151 |
MySQL | 5.7.35 MySQL Community Server (GPL) |
Ambari | 2.7.5 |
HDP | 3.1.5 |
修改主机名
vi /etc/hosts
******** node1
******** node2
******** node3
******** node6
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
# 禁用selinux
vi /etc/selinux/config
SELINUX=disabled
setenforce 0
安装基础组件
# 安装httpd
yum -y install httpd.x86_64
systemctl enable httpd.service
systemctl start httpd.service
# 安装wget
yum -y install wget
安装MySQL
# mysql 5.7 centos7
rpm -qa | grep mysql
# 删除相关rpm包
rpm -ev <rpm包名> --nodeps
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
yum -y install mysql57-community-release-el7-11.noarch.rpm
# 安装第一步下载的rpm文件,安装成功后/etc/yum.repos.d/目录下会增加两个文件
yum repolist enabled | grep mysql
# 查看mysql57的安装源是否可用,如不可用请自行修改配置文件(/etc/yum.repos.d/mysql-community.repo)使mysql57下面的enable=1
# 若有mysql其它版本的安装源可用,也请自行修改配置文件使其enable=0
yum install mysql-community-server
service mysqld start
# 启动mysql服务
grep "password" /var/log/mysqld.log
# 查看root密码
mysql -u root -p
# 登陆mysql
Enter password:
# 为了可以设置简单密码
set global validate_password_policy=0;
set global validate_password_length=4;
# 立即修改密码,执行其他操作报错:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('********');
# 我们创建密码为********
# 新增ambari用户并增加权限
mysql -uroot -pCentos@rjxy
CREATE USER 'ambari'@'%' IDENTIFIED BY '********';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';
CREATE USER 'ambari'@'localhost' IDENTIFIED BY '********';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost';
CREATE USER 'ambari'@'node1' IDENTIFIED BY '********';
GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'node1';
FLUSH PRIVILEGES;
# mysql -uambari -pambari
CREATE DATABASE ambari;
exit;
安装jdk
yum install java-1.8.0-openjdk
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar
mv mysql-connector-java-5.1.47.jar /usr/lib/jvm/java-1.8.0-openjdk/lib
vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/mysql-connector-java-5.1.47-bin.jar
export PATH=$JAVA_HOME/bin:${PATH}
source /etc/profile
java -version
配置免密登录
出于安全考虑,只配置1号机到2/3/6号机器上的免密登录。
- 在四台机器上都执行
ssh-keygen -t rsa
后,执行cd ~/.ssh && cat id_rsa.pub >> authorized_keys && chmod 700 ~/.ssh && chmod 600 authorized_keys
- 在1号机上执行:
cat ~/.ssh/id_rsa.pub | ssh root@node2 'cat - >> ~/.ssh/authorized_keys'
cat ~/.ssh/id_rsa.pub | ssh root@node3 'cat - >> ~/.ssh/authorized_keys'
cat ~/.ssh/id_rsa.pub | ssh root@node6 'cat - >> ~/.ssh/authorized_keys'
制作本地源
refer : https://docs.cloudera.com/HDPDocuments/Ambari-2.7.5.0/bk_ambari-installation-ppc/content/setting_up_a_local_repository_with_no_internet_access.html
[ambari]
name=ambari
baseurl=http://node1/ambari/centos7/2.7.5.0-72
enabled=1
gpgcheck=0
主节点安装Ambari
yum -y install ambari-server
cp /usr/lib/jvm/java-1.8.0-openjdk/lib/mysql-connector-java-5.1.47.jar /usr/share/java/mysql-connector-java.jar
echo server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar >> /etc/ambari-server/conf/ambari.properties
[root@node1 local]# 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)? n
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Custom JDK
==============================================================================
Enter choice (1): 8
Invalid number.
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Custom JDK
==============================================================================
Enter choice (1): 1
To download the Oracle JDK and the Java Cryptography Extension (JCE) Policy Files you must accept the license terms found at http://www.oracle.com/technetwork/java/javase/terms/license/index.html and not accepting will cancel the Ambari Server setup and you must install the JDK and JCE files manually.
Do you accept the Oracle Binary Code License Agreement [y/n] (y)? y
Downloading JDK from http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-8u112-linux-x64.tar.gz to /var/lib/ambari-server/resources/jdk-8u112-linux-x64.tar.gz
jdk-8u112-linux-x64.tar.gz... 8% (15.5 MB of 174.7 MB)^C
Aborting ... Keyboard Interrupt.
[root@node1 local]# 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)? n
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Custom JDK
==============================================================================
Enter choice (1): 2
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/lib/jvm/java-1.8.0-openjdk
Validating JDK on Ambari Server...done.
Check JDK version for Ambari Server...
JDK version found: 8
Minimum JDK version is 8 for Ambari. Skipping to setup different JDK for Ambari Server.
Checking GPL software agreement...
GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? y
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 (1): 3
Hostname (localhost): node1
Port (3306):
Database name (ambari):
Username (ambari):
Enter Database Password (bigdata):
Invalid characters in password. Use only alphanumeric or _ or - characters
Enter Database Password (bigdata):
Configuring ambari database...
Configuring remote database connection properties...
WARNING: Before starting Ambari Server, you must run the following DDL directly from the database shell 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.7.5.0.72.jar
....
Ambari repo file doesn't contain latest json url, skipping repoinfos modification
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
将 mysql-connector-java.jar 拷贝到指定目录
[root@node1 local]# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
Using python /usr/bin/python
Setup ambari-server
Copying /usr/share/java/mysql-connector-java.jar to /var/lib/ambari-server/resources/mysql-connector-java.jar
If you are updating existing jdbc driver jar for mysql with mysql-connector-java.jar. Please remove the old driver jar, from all hosts. Restarting services that need the driver, will automatically copy the new jar to the hosts.
JDBC driver was successfully initialized.
Ambari Server 'setup' completed successfully.
初始化数据库
mysql -uambari -pambari
use ambari;
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
时钟同步
[root@node1 ~]# yum install chrony
[root@node1 ~]# systemctl start chronyd
[root@node1 ~]# systemctl enable chronyd
vi /etc/chrony.conf
allow 192.168.0.0/16
chronyc sources -v