ambari实战 (2)ambari安装

阅读更多

ambari实战 (1)ambari介绍        http://zilongzilong.iteye.com/blog/2272263

ambari实战 (2)ambari安装        http://zilongzilong.iteye.com/blog/2272223

 

1.Ambari 的安装准备

    1.1 用VMWARE搭建三台linux虚拟机,三台机器配置免秘钥登录

        1.1.1 三台虚拟机配置如下:

hostname ip OS
hadoop1 192.168.202.132 Linux version 2.6.32-358.el6.x86_64,CentOS release 6.4 (Final)
hadoop2 192.168.202.136 Linux version 2.6.32-358.el6.x86_64,CentOS release 6.4 (Final)
hadoop3 192.168.202.173 Linux version 2.6.32-358.el6.x86_64,CentOS release 6.4 (Final)

        1.1.2配置hostname,设置主机名

         vi /etc/sysconfig/network

 

NETWORKING=yes
HOSTNAME=hadoop1

        1.1.3配置host,设置ip和主机名的映射

         vi /etc/hosts

 

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.202.132 hadoop1
192.168.202.136 hadoop2
192.168.202.173 hadoop3

        1.1.4配置SSH免密码登录

 

 

[root@hadoop1 yum.repos.d]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
62:a2:d3:40:36:c2:1d:a3:c6:d2:75:5c:4f:98:bc:2b root@hadoop1
The key's randomart image is:
+--[ RSA 2048]----+
|   o...o.o.      |
|o.o.o.. +o       |
|o==.     ..      |
|o+ .    .        |
|  . . o S.       |
|   + oE..        |
|  o .  .         |
|   .             |
|                 |
+-----------------+
[root@hadoop1 yum.repos.d]# cd /root/.ssh/
[root@hadoop1 .ssh]# ls
id_rsa  id_rsa.pub
[root@hadoop1 .ssh]# cat id_rsa.pub>>authorized_keys
[root@hadoop1 .ssh]# ls
authorized_keys  id_rsa  id_rsa.pub
[root@hadoop1 .ssh]# ssh root@hadoop2  cat /root/.ssh/id_rsa.pub>> authorized_ke                                                                                        ys
root@hadoop2's password:
[root@hadoop1 .ssh]# ssh root@hadoop3  cat /root/.ssh/id_rsa.pub>> authorized_ke                                                                                        ys
The authenticity of host 'hadoop3 (192.168.202.173)' can't be established.
RSA key fingerprint is 99:bf:9c:d2:93:3d:9d:94:1e:be:76:46:8f:83:d7:7f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop3,192.168.202.173' (RSA) to the list of known                                                                                         hosts.
root@hadoop3's password:
[root@hadoop1 .ssh]# scp -r /root/.ssh/authorized_keys root@hadoop2:/root/.ssh/                                                                                         root@hadoop2's password:
authorized_keys                                                                                                                       100% 1182     1.2KB/s   00:00
[root@hadoop1 .ssh]# scp -r /root/.ssh/authorized_keys root@hadoop3:/root/.ssh/
root@hadoop3's password:
authorized_keys                                                                                                                       100% 1182     1.2KB/s   00:00
[root@hadoop1 .ssh]# chmod 600 /root/.ssh/authorized_keys

    1.2确保 Yum 可以使用

 

     通过公共库(public repository),安装 Hadoop 这些软件,背后其实就是应用 Yum 在安装公共库里面的 rpm 包。所以这里需要您的机器都能访问 Internet。

    1.3Python安装,版本最好大于或等于2.6

 

#查看Python版本
[root@hadoop3 ~]# python -V
Python 2.6.6

 

    1.4安装ambari时候尽量用root安装

 

Ambari 的 Server 会 SSH 到 Agent 的机器,拷贝并执行一些命令。因此我们需要配置 Ambari Server 到 Agent 的 SSH 无密码登录。
Ambari 会创建一些 OS 用户。

 

 

2.Ambari安装

    2.1下载Ambari 的公共库文件(public repository)

 

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

     2.2将下载的 ambari.repo 文件拷贝到 Linux 的系统目录/etc/yum.repos.d/

 

 

mv ambari.repo /etc/yum.repos.d/ambari.repo

     2.3获取该公共库的所有的源文件列表

 

 

[root@hadoop1 hadoop]# cd /etc/yum.repos.d/
[root@hadoop1 yum.repos.d]# yum clean all
[root@hadoop1 ~]# yum list|grep ambari
ambari-server.noarch               2.0.1-45        @Updates-ambari-2.0.1
ambari-agent.x86_64                2.0.1-45        Updates-ambari-2.0.1
ambari-log4j.noarch                2.0.1.45-1      Updates-ambari-2.0.1
ambari-metrics-collector.x86_64    2.0.1-45        Updates-ambari-2.0.1
ambari-metrics-common.noarch       2.0.1-45        Updates-ambari-2.0.1
ambari-metrics-hadoop-sink.x86_64  2.0.1-45        Updates-ambari-2.0.1
ambari-metrics-monitor.x86_64      2.0.1-45        Updates-ambari-2.0.1
hdp_mon_ganglia_addons.noarch      2.0.1.45-1.el6  Updates-ambari-2.0.1
hdp_mon_nagios_addons.noarch       2.0.1.45-1.el6  Updates-ambari-2.0.1

 

    2.4安装 Ambari Server

 

[root@hadoop1 ambari-server]# yum install ambari-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ambari-server.noarch 0:2.0.1-45 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================
 Package             Arch     Version  Repository             Size
===========================================
Installing:
 ambari-server       noarch   2.0.1-45 Updates-ambari-2.0.1   86 M

Transaction Summary
===========================================
Install       1 Package(s)

Total download size: 86 M
Installed size: 104 M
Is this ok [y/N]: y
Downloading Packages:
ambari-server-2.0.1-45.noarch.rpm                  |  86 MB     18:34
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ambari-server-2.0.1-45.noarch       1/1
  Verifying  : ambari-server-2.0.1-45.noarch       1/1
Installed:
  ambari-server.noarch 0:2.0.1-45
Complete!
[root@hadoop1 ambari-server]#

    2.5配置 Ambari Server

[root@hadoop1 ambari-server]# ambari-server setup
Using python  /usr/bin/python2.6
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):root
Adjusting ambari-server permissions and ownership...
Checking iptables...
Checking JDK...
[1] Oracle JDK 1.7
[2] Oracle JDK 1.6
[3] - 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-7u67-linux-x64.tar.gz to /var/lib/ambari-server/resources/jdk-7u67-linux-x64.tar.gz
jdk-7u67-linux-x64.tar.gz... 100% (135.8 MB of 135.8 MB)
Successfully downloaded JDK distribution to /var/lib/ambari-server/resources/jdk-7u67-linux-x64.tar.gz
Installing JDK to /usr/jdk64/
Successfully installed JDK to /usr/jdk64/
Downloading JCE Policy archive from http://public-repo-1.hortonworks.com/ARTIFACTS/UnlimitedJCEPolicyJDK7.zip to /var/lib/ambari-server/resources/UnlimitedJCEPolicyJDK7.zip
UnlimitedJCEPolicyJDK7.zip... 100%
Successfully downloaded JCE Policy archive to /var/lib/ambari-server/resources/UnlimitedJCEPolicyJDK7.zip
Installing JCE policy...
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
[4] - PostgreSQL
=========================
Enter choice (1):
Database name (ambari):
Postgres schema (ambari):
Username (ambari):
Enter Database Password (bigdata):
Re-enter password:
Default properties detected. Using built-in database.
Configuring ambari database...
Checking PostgreSQL...
Running initdb: This may take upto a minute.
Initializing database: [  OK  ]

About to start PostgreSQL
Configuring local database...
Connecting to local database...done.
Configuring PostgreSQL...
Restarting PostgreSQL
Extracting system views...
.ambari-admin-2.0.1.45.jar
..
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
[root@hadoop1 ambari-server]#

   2.6启动 Ambari

[root@hadoop1 ambari-server]# ambari-server start
Using python  /usr/bin/python2.6
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
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....................
Ambari Server 'start' completed successfully.
[root@hadoop1 ambari-server]#

    2.7登录 Ambari server管理页面

登录URL:http://192.168.202.132:8080/,
登录账号密码:admin/admin

ambari实战 (2)ambari安装_第1张图片 ambari实战 (2)ambari安装_第2张图片

         Ambari Server 就安装完成了。

 

 

 

  • ambari实战 (2)ambari安装_第3张图片
  • 大小: 76.2 KB
  • ambari实战 (2)ambari安装_第4张图片
  • 大小: 101.6 KB
  • 查看图片附件

你可能感兴趣的:(ambari,介绍,安装)