Apache Ambari + HDP 安装与配置

软件版本

软件名称版本
JDKOracle jdk1.8.0_151
MySQL5.7.35 MySQL Community Server (GPL)
Ambari2.7.5
HDP3.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号机器上的免密登录。

  1. 在四台机器上都执行ssh-keygen -t rsa后,执行cd ~/.ssh && cat id_rsa.pub >> authorized_keys && chmod 700 ~/.ssh && chmod 600 authorized_keys
  2. 在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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Bernard5

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值