搭建Ambari

搭建Ambari

三月 12, 2020

部署Ambari
搭建:
XX.XX.XX.34
XX.XX.XX.189

环境:

Hosts
Hostname
.ssh/
Java
mysql
mysql-connector-java.jar
ntp

双机免密(06上生成秘钥推送到08上,共用同一个秘钥,因为后面web安装组件需要)

[root@VM_0_6_centos ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:DB/XXXXXXXX root@VM_0_6_centos
The key’s randomart image is:
+—[RSA 2048]—-+
| . |
| o . . |
| B . . . o |
| B B * = o o o o |
|+ * B B S . * = |
|o E = o o + . |
| .+ O . . . . |
|.o o . . |
|..o. |
+—-[SHA256]—–+
[root@VM_0_6_centos ~]# vim .ssh/
authorized_keys id_rsa id_rsa.pub
[root@VM_0_6_centos ~]# vim .ssh/authorized_keys
[root@VM_0_6_centos ~]# cat .ssh/
authorized_keys id_rsa id_rsa.pub
[root@VM_0_6_centos ~]# cat .ssh/id_rsa.pub
ssh-rsa AAAAXXXXXXX root@VM_0_6_centos

Hosts(启动服务器时发现注释掉127启动服务会失败,所以先打开注释启动服务后安装组件时再注释,注释的原因是因为127会导致组件之间通信失败)

[root@VM_0_8_centos ~]# vim /etc/hosts
[root@VM_0_8_centos ~]# cat /etc/hosts
#127.0.0.1 VM_0_8_centos VM_0_8_centos
#127.0.0.1 localhost.localdomain localhost
#127.0.0.1 localhost4.localdomain4 localhost4
#::1 VM_0_8_centos VM_0_8_centos
#::1 localhost.localdomain localhost
#::1 localhost6.localdomain6 localhost6
172.16.0.6 master
172.16.0.8 slave
[root@VM_0_6_centos ~]# vim /etc/hosts
[root@VM_0_6_centos ~]# cat /etc/hosts
#127.0.0.1 VM_0_6_centos VM_0_6_centos
#127.0.0.1 localhost.localdomain localhost
#127.0.0.1 localhost4.localdomain4 localhost4
#
#::1 VM_0_6_centos VM_0_6_centos
#::1 localhost.localdomain localhost
#::1 localhost6.localdomain6 localhost6
172.16.0.6 master
172.16.0.8 slave
(一定要改名字,否则后面web添加主机无法通过)
[root@VM_0_6_centos ~]# hostnamectl set-hostname master
[root@VM_0_8_centos ~]# hostnamectl set-hostname slave

Selinux

[root@VM_0_6_centos softwore]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@VM_0_6_centos softwore]# sestatus
SELinux status: disabled

Java

[root@VM_0_6_centos ~]# mkdir /usr/lib/jvm/
[root@VM_0_6_centos ~]# tar -xzvf jdk-8u181-linux-x64.tar.gz -C /usr/lib/jvm/
[root@VM_0_6_centos ~]# echo “export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_181”>>/etc/profile
[root@VM_0_6_centos ~]# echo ‘export JRE_HOME=${JAVA_HOME}/jre’>>/etc/profile
[root@VM_0_6_centos ~]# echo ‘export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib’>>/etc/profile
[root@VM_0_6_centos ~]# echo ‘export PATH=${JAVA_HOME}/bin:$PATH’>>/etc/profile
[root@VM_0_6_centos ~]# sh -c “echo umask 0022 >> /etc/profile”
[root@VM_0_6_centos ~]# source /etc/profile
[root@VM_0_6_centos ~]# java -version
java version “1.8.0_181”
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
[root@VM_0_8_centos ~]# mkdir /usr/lib/jvm/
[root@VM_0_8_centos ~]# tar -xzvf jdk-8u181-linux-x64.tar.gz -C /usr/lib/jvm/
[root@VM_0_8_centos ~]# echo “export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_181”>>/etc/profile
[root@VM_0_8_centos ~]# echo ‘export JRE_HOME=${JAVA_HOME}/jre’>>/etc/profile
[root@VM_0_8_centos ~]# echo ‘export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib’>>/etc/profile
[root@VM_0_8_centos ~]# echo ‘export PATH=${JAVA_HOME}/bin:$PATH’>>/etc/profile
[root@VM_0_8_centos ~]# sh -c “echo umask 0022 >> /etc/profile”
[root@VM_0_8_centos ~]# source /etc/profile
[root@VM_0_8_centos ~]# java -version
java version “1.8.0_181”
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

Mysql(此处使用单节点mysql测试)

[root@VM_0_8_centos ~]# mkdir softwore
[root@VM_0_8_centos ~]# cd softwore/
[root@VM_0_8_centos softwore]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
–2020-03-10 10:59:21– http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
正在解析主机 repo.mysql.com (repo.mysql.com)… 23.199.77.25
正在连接 repo.mysql.com (repo.mysql.com)|23.199.77.25|:80… 已连接。
已发出 HTTP 请求,正在等待回应… 200 OK
长度:6140 (6.0K) [application/x-redhat-package-manager]
正在保存至: “mysql-community-release-el7-5.noarch.rpm”
100%[========================================================>] 6,140 –.-K/s 用时 0s
2020-03-10 10:59:22 (547 MB/s) - 已保存 “mysql-community-release-el7-5.noarch.rpm” [6140/6140])
[root@VM_0_6_centos softwore]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
准备中… ################################# [100%]
正在升级/安装…
1:mysql-community-release-el7-5 ################################# [100%]
[root@VM_0_6_centos softwore]# yum install mysql-server
[root@VM_0_6_centos softwore]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@VM_0_6_centos softwore]# service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Community Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since 二 2020-03-10 11:16:00 CST; 16s ago
Process: 14420 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 14342 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 14419 (mysqld_safe)
CGroup: /system.slice/mysqld.service
├─14419 /bin/sh /usr/bin/mysqld_safe –basedir=/usr
└─14586 /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/l…
3月 10 11:15:59 VM_0_6_centos mysql-systemd-start[14342]: http://www.mysql.com
3月 10 11:15:59 VM_0_6_centos mysql-systemd-start[14342]: Support MySQL by buying support/lic…m
3月 10 11:15:59 VM_0_6_centos mysql-systemd-start[14342]: Note: new default config file not c….
3月 10 11:15:59 VM_0_6_centos mysql-systemd-start[14342]: Please make sure your config file i…t
3月 10 11:15:59 VM_0_6_centos mysql-systemd-start[14342]: WARNING: Default config file /etc/m…m
3月 10 11:15:59 VM_0_6_centos mysql-systemd-start[14342]: This file will be read by default b…r
3月 10 11:15:59 VM_0_6_centos mysql-systemd-start[14342]: If you do not want to use this, eit…e
3月 10 11:15:59 VM_0_6_centos mysqld_safe[14419]: 200310 11:15:59 mysqld_safe Logging to ‘/v…’.
3月 10 11:15:59 VM_0_6_centos mysqld_safe[14419]: 200310 11:15:59 mysqld_safe Starting mysql…ql
3月 10 11:16:00 VM_0_6_centos systemd[1]: Started MySQL Community Server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@VM_0_6_centos softwore]# mysqladmin -uroot password XXXXXXX2020XXXX
Warning: Using a password on the command line interface can be insecure.
[root@VM_0_6_centos softwore]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.47 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> select user,host from mysql.user;
+——+——————+
| user | host |
+——+——————+
| root | % |
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| | vm_0_8_centos |
| root | vm_0_8_centos |
+——+——————+
6 rows in set (0.00 sec)

时钟同步ntp

[root@VM_0_6_centos softwore]# yum -y install ntp
[root@VM_0_6_centos softwore]# vim /etc/ntp.conf
restrict 192.168.0.0 mask 255.255.255.0
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
[root@VM_0_6_centos softwore]# systemctl start ntpd
[root@VM_0_6_centos softwore]# systemctl status ntpd
[root@VM_0_8_centos softwore]# yum -y install ntp
[root@VM_0_8_centos ~]# systemctl start ntpd
[root@VM_0_8_centos ~]# systemctl status ntpd
[root@VM_0_6_centos softwore]# crontab -e
crontab: installing new crontab
[root@VM_0_6_centos softwore]# crontab -l
*/5 * * * * /usr/sbin/ntpdate ntp.ksyun.cn
[root@VM_0_8_centos ~]# crontab -e
crontab: installing new crontab
[root@VM_0_8_centos ~]# crontab -l
*/5 * * * * /usr/sbin/ntpdate ntp.ksyun.cn

Httpd

[root@VM_0_6_centos softwore]# yum -y install httpd
[root@VM_0_6_centos softwore]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
[root@VM_0_6_centos softwore]# chkconfig httpd on
注意:正在将请求转发到“systemctl enable httpd.service”。
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

制作本地源仓库(安装包从官网下载或从现有服务上拷贝)

[root@VM_0_6_centos html]# pwd
/var/www/html
[root@VM_0_6_centos html]# ls
ambari HDP-GPL-3.1.0.0-centos7-gpl.tar.gz
ambari-2.7.3.0-centos7.tar.gz HDP-UTILS-1.1.0.22-centos7.tar.gz
HDP-3.1.0.0-centos7-rpm.tar.gz
[root@VM_0_6_centos html]# ls ambari
ambari HDP HDP-GPL HDP-UTILS
通过IP访问验证 http://XX.XX.XX.34/ambari/

制作本地源 (搭建本地源时安装还有后面web里填写本地源地址时使用内网IP)

[root@VM_0_6_centos html]# yum install yum-utils createrepo yum-plugin-priorities -y
[root@VM_0_6_centos html]# createrepo ./
Spawning worker 0 with 59 pkgs
Spawning worker 1 with 59 pkgs
Spawning worker 2 with 58 pkgs
Spawning worker 3 with 58 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

[root@VM_0_6_centos yum.repos.d]# cat ambari.repo
#VERSION_NUMBER=2.7.3.0-139
[ambari-2.7.3.0]
#json.url = http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json
name=ambari Version - ambari-2.7.3.0
baseurl=http://172.16.0.6/ambari/ambari/ambari/centos7/2.7.3.0-139
gpgcheck=1
gpgkey=http://172.16.0.6/ambari/ambari/ambari/centos7/2.7.3.0-139/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[root@VM_0_6_centos yum.repos.d]# cat hdp.repo
#VERSION_NUMBER=3.1.0.0-78
[HDP-3.1.0.0]
name=HDP Version - HDP-3.1.0.0
baseurl=http://172.16.0.6/ambari/HDP/HDP/centos7/3.1.0.0-78
gpgcheck=1
gpgkey=http://172.16.0.6/ambari/HDP/HDP/centos7/3.1.0.0-78/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-UTILS-1.1.0.22]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.22
baseurl=http://172.16.0.6/ambari/HDP-UTILS/HDP-UTILS/centos7/1.1.0.22
gpgcheck=1
gpgkey=http://172.16.0.6/ambari/HDP-UTILS/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[root@VM_0_6_centos ambari]# yum clean all
已加载插件:fastestmirror, langpacks, priorities
正在清理软件源: HDP-3.1.0.0 HDP-UTILS-1.1.0.22 ambari-2.7.3.0 epel extras os updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@VM_0_6_centos ambari]# yum makecache
已加载插件:fastestmirror, langpacks, priorities
Determining fastest mirrors
HDP-3.1.0.0 | 2.9 kB 00:00:00
HDP-UTILS-1.1.0.22 | 2.9 kB 00:00:00
ambari-2.7.3.0 | 2.9 kB 00:00:00
epel | 5.3 kB 00:00:00
extras | 2.9 kB 00:00:00
os | 3.6 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/26): HDP-3.1.0.0/primary_db | 89 kB 00:00:01
(2/26): HDP-3.1.0.0/other_db | 12 kB 00:00:00
(3/26): HDP-UTILS-1.1.0.22/filelists_db | 2.9 kB 00:00:00
(4/26): HDP-UTILS-1.1.0.22/primary_db | 8.5 kB 00:00:00
(5/26): HDP-UTILS-1.1.0.22/other_db | 5.5 kB 00:00:00
(6/26): ambari-2.7.3.0/primary_db | 25 kB 00:00:00
(7/26): ambari-2.7.3.0/other_db | 1.4 kB 00:00:00
(8/26): epel/7/x86_64/group_gz | 90 kB 00:00:00
(9/26): epel/7/x86_64/updateinfo | 1.0 MB 00:00:00
(10/26): epel/7/x86_64/prestodelta | 999 B 00:00:00
(11/26): epel/7/x86_64/primary_db | 6.7 MB 00:00:00
(12/26): epel/7/x86_64/other_db | 3.2 MB 00:00:00
(13/26): epel/7/x86_64/updateinfo_zck | 1.5 MB 00:00:00
(14/26): extras/7/x86_64/filelists_db | 216 kB 00:00:00
(15/26): extras/7/x86_64/primary_db | 164 kB 00:00:00
(16/26): epel/7/x86_64/filelists_db | 11 MB 00:00:01
(17/26): extras/7/x86_64/other_db | 106 kB 00:00:00
(18/26): os/7/x86_64/group_gz | 165 kB 00:00:00
(19/26): os/7/x86_64/primary_db | 6.0 MB 00:00:00
(20/26): ambari-2.7.3.0/filelists_db | 103 kB 00:00:01
(21/26): os/7/x86_64/other_db | 2.6 MB 00:00:00
(22/26): os/7/x86_64/filelists_db | 7.3 MB 00:00:00
(23/26): updates/7/x86_64/filelists_db | 4.0 MB 00:00:00
(24/26): updates/7/x86_64/other_db | 493 kB 00:00:00
(25/26): updates/7/x86_64/primary_db | 6.7 MB 00:00:00
(26/26): HDP-3.1.0.0/filelists_db | 386 kB 00:00:05
元数据缓存已建立
[root@VM_0_6_centos ambari]# yum repolist
已加载插件:fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
17 packages excluded due to repository priority protections
源标识 源名称 状态
HDP-3.1.0.0 HDP Version - HDP-3.1.0.0 201
HDP-UTILS-1.1.0.22 HDP-UTILS Version - HDP-UTILS-1.1.0.22 16
ambari-2.7.3.0 ambari Version - ambari-2.7.3.0 13
epel/7/x86_64 EPEL for redhat/centos 7 - x86_64 13,193+13
extras/7/x86_64 Qcloud centos extras - x86_64 335
os/7/x86_64 Qcloud centos os - x86_64 10,093+4
updates/7/x86_64 Qcloud centos updates - x86_64 1,487
repolist: 25,338
[root@VM_0_6_centos ambari]# cd /etc/yum.repos.d/
[root@VM_0_6_centos yum.repos.d]# ls
ambari.repo CentOS-Base.repo CentOS-Epel.repo hdp.repo
[root@VM_0_6_centos yum.repos.d]# scp ambari.repo 172.16.0.8:/etc/yum.repos.d/
ambari.repo 100% 354 1.3MB/s 00:00
[root@VM_0_6_centos yum.repos.d]# scp hdp.repo 172.16.0.8:/etc/yum.repos.d/
hdp.repo 100% 533 1.7MB/s 00:00

安装ambari(如果本地源配置没有问题会很快,发现下载包需要一个多小时的话就是本地源有问题,装包时还是走了网络源)

[root@VM_0_6_centos yum.repos.d]# yum install ambari-server

导入mysql库

CREATE DATABASE ambari;
use ambari;
CREATE USER ‘ambari’@’%’ IDENTIFIED BY ‘ambarizk123’;
GRANT ALL PRIVILEGES ON . TO ‘ambari’@’%’;
CREATE USER ‘ambari’@’localhost’ IDENTIFIED BY ‘ambarizk123’;
GRANT ALL PRIVILEGES ON . TO ‘ambari’@’localhost’;
CREATE USER ‘ambari’@’master’ IDENTIFIED BY ‘ambarizk123’;
GRANT ALL PRIVILEGES ON . TO ‘ambari’@’master’;
FLUSH PRIVILEGES;
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
show tables;
use mysql;
select Host User Password from user where user=’ambari’;
CREATE DATABASE hive;
use hive;
CREATE USER ‘hive’@’%’ IDENTIFIED BY ‘hive’;
GRANT ALL PRIVILEGES ON . TO ‘hive’@’%’;
CREATE USER ‘hive’@’localhost’ IDENTIFIED BY ‘hive’;
GRANT ALL PRIVILEGES ON . TO ‘hive’@’localhost’;
CREATE USER ‘hive’@’master’ IDENTIFIED BY ‘hive’;
GRANT ALL PRIVILEGES ON . TO ‘hive’@’master’;
FLUSH PRIVILEGES;
CREATE DATABASE oozie;
use oozie;
CREATE USER ‘oozie’@’%’ IDENTIFIED BY ‘oozie’;
GRANT ALL PRIVILEGES ON . TO ‘oozie’@’%’;
CREATE USER ‘oozie’@’localhost’ IDENTIFIED BY ‘oozie’;
GRANT ALL PRIVILEGES ON . TO ‘oozie’@’localhost’;
CREATE USER ‘oozie’@’master’ IDENTIFIED BY ‘oozie’;
GRANT ALL PRIVILEGES ON . TO ‘oozie’@’master’;
FLUSH PRIVILEGES;

Ambari连接mysql

[root@VM_0_6_centos ~]# cp mysql-connector-java.jar /usr/share/java/
[root@VM_0_6_centos ~]# cp /usr/share/java/mysql-connector-java.jar /var/lib/ambari-server/resources/mysql-jdbc-driver.jar
[root@VM_0_6_centos ~]# vim /etc/ambari-server/conf/ambari.properties
server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar

设置ambari

[root@VM_0_6_centos ~]# ambari-server setup
Using python /usr/bin/python
Setup ambari-server
Checking SELinux…
SELinux status is ‘disabled’
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (root):
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): ^C
Aborting … Keyboard Interrupt.
[root@VM_0_6_centos ~]# ambari-server setup
Using python /usr/bin/python
Setup ambari-server
Checking SELinux…
SELinux status is ‘disabled’
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (root):ambari
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/jdk1.8.0_181
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):
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):
Re-enter password:
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.3.0.139.jar

Ambari repo file contains latest json url http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json, updating stacks repoinfos with it…
Adjusting ambari-server permissions and ownership…
Ambari Server ‘setup’ completed successfully.
[root@VM_0_6_centos ~]# ambari-server start
Using python /usr/bin/python
Starting ambari-server
WARNING: The hostname was not found in the reverse DNS lookup. This may result in incorrect behavior. Please check the DNS setup and fix the issue.
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources…
Ambari database consistency check started…
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start………………………..
Server started listening on 8080
DB configs consistency check: no errors and warnings were found.
Ambari Server ‘start’ completed successfully.

安装agent(修改hosts打开127.0.0.1启动成功)

[root@VM_0_8_centos ~]# ambari-agent start
Verifying Python version compatibility…
Using python /usr/bin/python
Checking for previously running Ambari Agent…
Checking ambari-common dir…
Starting ambari-agent
Verifying ambari-agent process status…
ERROR: ambari-agent start failed. For more details, see /var/log/ambari-agent/ambari-agent.out:
====================
self._cache_hardware_info()
File “/usr/lib/ambari-agent/lib/ambari_agent/Hardware.py”, line 72, in _cache_hardware_info
self._hardware.update(Facter(self.config).facterInfo())
File “/usr/lib/ambari-agent/lib/ambari_agent/Facter.py”, line 571, in facterInfo
facterInfo = super(FacterLinux, self).facterInfo()
File “/usr/lib/ambari-agent/lib/ambari_agent/Facter.py”, line 248, in facterInfo
‘ipaddress’: self.getIpAddress(),
File “/usr/lib/ambari-agent/lib/ambari_agent/Facter.py”, line 81, in getIpAddress
return socket.gethostbyname(self.getFqdn().lower())
socket.gaierror: [Errno -2] Name or service not known
====================
Agent out at: /var/log/ambari-agent/ambari-agent.out
Agent log at: /var/log/ambari-agent/ambari-agent.log
[root@VM_0_8_centos ~]# vim /etc/hosts
[root@VM_0_8_centos ~]# ambari-agent start
Verifying Python version compatibility…
Using python /usr/bin/python
Checking for previously running Ambari Agent…
Checking ambari-common dir…
Starting ambari-agent
Verifying ambari-agent process status…
Ambari Agent successfully started
Agent PID at: /run/ambari-agent/ambari-agent.pid
Agent out at: /var/log/ambari-agent/ambari-agent.out
Agent log at: /var/log/ambari-agent/ambari-agent.log

web安装(http://XX.XX.XX.34:8080/ admin/admin)

[root@VM_0_6_centos ~]# 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.