目錄
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
1、服務器環境說明
- 集群三臺節點
- 可以互相訪問
- 使用root用戶
- 配置免密
- centos7
- ambari-2.6.2.2
- hdp-2.6.5
- 在windows的hosts檔案中添加環境資訊
我的環境如下:
192.168.8.105 my-hdp1
192.168.8.106 my-hdp2
192.168.8.107 my-hdp3
說明:使用root用戶
2、防火墻設定
三臺節點均執行
#查看防火墻狀態
systemctl status firewalld
#關閉防火墻
systemctl stop firewalld
#設定防火墻服務開機不自啟
systemctl disable firewalld
#再次查看防火墻檢查防火墻是否關閉
systemctl status firewalld
3、禁用selinux
三臺節點均執行
vim /etc/selinux.config
把SELINUX=enforcing修改為SELINUX=disabled
4、配置jdk和mysql驅動
三臺節點均執行
#創建目錄
mkdir /usr/share/java
#該目錄在后面需要用的,可以被其他用戶訪問的,如果是普通用戶則不行,建議按這個配置
#上傳java
tar -zxf jdk-8u144-linux-x64.tar.gz
#查看java環境
java -version
#將驅動上傳到該路徑
5、安裝Mysql
在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
6、mysql密碼操作
在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;
7、安裝httpd服務
在my-hdp1上執行
#安裝
yum install httpd
#開機自啟動
systemctl enable httpd.service
#啟動httpd服務
systemctl start httpd.service
#查看httpd服務狀態
systemctl staus httpd.service
#說明,安裝完之后,會生成/var/www/html目錄
8、安裝ntp
三臺節點均執行
#安裝
yum install ntp
#開機自啟動
systemctl enable ntpd
#啟動ntp服務
systemctl start ntpd
#查看ntpd服務狀態
systemctl status ntpd
9、ntp配置
在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
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
11、安裝yum
三臺節點均執行
yum install wget
yum install createrepo
yum install yum-utils
yum repolist
12、上傳ambari和hdp
在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 上面的包
13、創建repo檔案
在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
14、分發repo檔案
在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
15、生成yum源
在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 .
16、在mysql中創建ambari用戶
在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;
17、初始化ambari資料庫
在my-hdp1上執行
#使用amabri用戶登錄Mysql
mysql -uambari -pambari
#切換資料庫
use ambari;
#初始化ambari資料庫
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
18、安裝ambari
在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
19、ambari配置
在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.
20、啟動ambari
#啟動ambari
ambari-server start
#啟動成功后
在windows瀏覽器地址欄中輸入
http://my-hdp1:8080/
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/282291.html
標籤:其他
上一篇:阿里一二三面、HR面面經-后臺
