ambari2.6.2安装详解

一、环境准备

1准备三台机器centos6.5

Servernode-1192.168.80.137

Agentnode-2192.168.80.138),node-3192.168.80.139

注:以下操作如无特殊说明,均需在3台机器上进行

 

2设置FQDN

修改/etc/hosts文件,设置fqdn

vi /etc/hosts

192.168.80.137 IOP137.ambari.com IOP137

192.168.80.138 IOP138.ambari.com IOP138

192.168.80.139 IOP139.ambari.com IOP139

验证fqdn设置是否正确(注:以server节点为例):

hostname -f

IOP137.ambari.com

 

3设置SSH免密登录

利用Ambari安装大数据集群,需要保证server节点能无密码远程登录agent节点。所以,该操作仅需在server节点进行。

(1)登录主机(server)节点

(2)用 ssh-keygen 命令在server节点上生成公钥和密钥

ssh-keygen -t rsa

(3)用 ssh-copy-id 命令把公钥从server节点拷贝到agent节点上

ssh-copy-id -i ~/.ssh/id_rsa.pub root@node-1

ssh-copy-id -i ~/.ssh/id_rsa.pub root@node-2

ssh-copy-id -i ~/.ssh/id_rsa.pub root@node-3(注意:若server节点也安装大数据服务,必须建立server节点自身的ssh无密码登录;否则,无需进行该步操作)

验证

 

4禁用selinux

vi /etc/selinux/config

SELINUX=disabled

 

5禁用防火墙

systemctl disable firewalld.service

systemctl stop firewalld.service

重启服务器,使得设置生效

 

6安装JDK

设置环境变量

vi /etc/profile

export JAVA_HOME=/usr/local/jdk/

export JRE_HOME=$JAVA_HOME/jre

export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$JAVA_HOME:$PATH

 执行source /etc/profile

 

7安装ntpdata

利用ambari安装大数据集群时候,要求各个节点之间的时间同步

yum install ntpdate

#网络同步时间

ntpdate cn.pool.ntp.org

 

8搭建本地源

Ambari的安装,默认使用的是网络源,故而安装过程中极易受到网速的影响,从而导致安装失败。为了安装的顺利,搭建本地源,此处将该操作在server节点进行。

为了搭建本地源,需要安装httpd

yum -y install httpd.x86_64

systemctl enable httpd.service

systemctl start httpd.service

需要将网络源涉及到的安装包同步到本地

yum -y install wget.x86_64

cd /etc/yum.repos.d/

wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.6.2.0/ambari.repo

yum repolist

ambari2.6.2安装详解_第1张图片

(本地源搭建比较麻烦,如果网络比较好,可以不搭建,后面会补全如何搭建本地源)

9、安装MySql

Yum在线安装

yum install mysql mysql-server mysql-devel

完成后,用  /etc/init.d/mysqld start    启动mysql

启动mysql控制台:

mysql

mysql>; USE mysql;

mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';

mysql>; FLUSH PRIVILEGES;

允许远程登录

mysql -u root -p

Enter Password:

mysql>GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

完成后就能远程管理mysql了。

mysql服务名字   service  mysqld start

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

 

设置root用户密码为root,新增ambari用户并设置权限:

mysql -uroot -proot

CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambari';

GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%';

CREATE USER 'ambari'@'localhost' IDENTIFIED BY 'ambari';

GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'localhost';

CREATE USER 'ambari'@'IOP137' IDENTIFIED BY 'ambari';

GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'IOP137'; //本地主机名

FLUSH PRIVILEGES;

 

使用ambari用户登录,创建ambari数据库

mysql -uambari -pambari

create database ambari

 

一、ambari安装详解

1、server节点安装Ambari Server

1)安装

yum -y install ambari-server

ambari2.6.2安装详解_第2张图片

ambari2.6.2安装详解_第3张图片

配置

ambari-server setup

待安装完成后,便需要对 Ambari Server做一个简单的配置。执行下面的命令

1. [root@master .ssh]# ambari-server  setup

如果还没有关闭SELinux,执行这个命令的过程中会提示,选择y,即可临时关闭。

[root@master ~]# ambari-server setup

Usingpython  /usr/bin/python

Setupambari-server

CheckingSELinux...

SELinuxstatus is 'disabled'

Customizeuser account for ambari-server daemon [y/n] (n)? y

Enter useraccount for ambari-server daemon (root):

Adjustingambari-server permissions and ownership...

Checkingfirewall status...

CheckingJDK...

[1] OracleJDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8

[2] OracleJDK 1.7 + Java Cryptography Extension (JCE) Policy Files 7

[3] CustomJDK

==============================================================================

Enter choice(1): 3

WARNING: JDKmust be installed on all hosts and JAVA_HOME must be valid on all hosts.

WARNING: JCEPolicy files are required for configuring Kerberos security. If you plan to useKerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files arevalid on all hosts.

Path toJAVA_HOME: /usr/java/jdk1.8.0_121

ValidatingJDK on Ambari Server...done.

Completingsetup...

2.设置数据库,Ambari默认使用的是PostgreSQL,改为mysql数据库Configuringdatabase...

Enteradvanced database configuration [y/n] (n)? y

Configuringdatabase...

==============================================================================

Choose oneof the following options:

[1] -PostgreSQL (Embedded)

[2] - Oracle

[3] - MySQL/ MariaDB

[4] -PostgreSQL

[5] -Microsoft SQL Server (Tech Preview)

[6] - SQLAnywhere

[7] - BDB

==============================================================================

Enter choice(1): 3

Hostname(localhost): 

Port (3306):

Databasename (ambari):

Username(ambari):

EnterDatabase Password (bigdata):(自己创建的ambari的数据库密码)

Re-enterpassword:

Configuringambari database...

Copying JDBCdrivers to server resources...

Configuringremote database connection properties...

WARNING:Before starting Ambari Server, you must run the following DDL against thedatabase to create the schema:/var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

Proceed withconfiguring remote database connection properties [y/n] (y)? y

Extractingsystem views...

.....ambari-admin-2.6.2.0.155.jar

......

Adjustingambari-server permissions and ownership...

AmbariServer 'setup' completed successfully.

 

ambari2.6.2安装详解_第4张图片

ambari2.6.2安装详解_第5张图片

mysql-connector-java.jar复制到/var/lib/ambari-server/resources目录下

cp /usr/share/java/mysql-connector-java.jar /var/lib/ambari-server/resources/mysql-jdbc-driver.jar

编辑ambari.properties

vi /etc/ambari-server/conf/ambari.properties

添加server.jdbc.driver.path=/usr/share/java/mysql-connector-java.jar

将Ambari数据库脚本导入到数据库

如果使用自己定义的数据库,必须在启动Ambari服务之前导入Ambari的sql脚本

用Ambari用户(上面设置的用户)登录mysql

[root@namenode1~]# mysql -u root -p

mysql>use ambari

mysql>source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

ambari2.6.2安装详解_第6张图片

ambari2.6.2安装详解_第7张图片

设置驱动:

[root@master ~]# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java-5.1.45-bin.jar 

修改完毕后,启动Ambari Server

ambari-server start

执行命令查看Ambari Server是否运行(注:等待时间可能稍长):

netstat -ntlp | grep 8080

#或

ps -ef | grep ambari

#或者查看日志

tail -f /var/log/ambari-server/ambari-server.log

ambari2.6.2安装详解_第8张图片

server节点成功启动ambari-server服务后,登录浏览器访问http://node-1:8080,利用可视化界面部署集群。(用户名:admin密码:admin

ambari2.6.2安装详解_第9张图片


ambari2.6.2安装详解_第10张图片

至此,Ambari搭建完成。


你可能感兴趣的:(大数据,大数据专栏)