Ambari安装
一、前期准备
CentOS应该使用英文版本
1、网络
修改/etc/sysconfig/network-scripts/ifcfg-em1,使网络开机时自动连接
即设置:ONBOOT=yes
2、系统文件
修改/etc/hosts和/etc/sysconfig/network
3、跟新openssl
查看openssl版本:
openssl version –a
和
rpm -qa | grep openssl
结果是:
openssl-1.0.1e-15.el6.x86_64
这个版本比较旧,需要对它进行升级
升级命令:
yum upgrade openssl
以上操作此详细过程:
[root@slave1szx]# rpm -qa | grep openssl
openssl-1.0.1e-15.el6.x86_64
[root@slave1szx]# yum upgrade openssl
……
[root@slave1szx]# rpm -qa | grep openssl
openssl-1.0.1e-48.el6_8.3.x86_64
4、禁用SELinux
可以选择临时性和永久性的禁用。
临时性,使用命令:
setenforce 0
SELINUX=disabled
SELINUXTYPE=targeted
5、禁用iptables
service iptables stop
如下:
[root@masterszx]# service iptables stop
iptables:Setting chains to policy ACCEPT: filter[ OK ]
iptables:Flushing firewall rules:[ OK ]
iptables:Unloading modules:[ OK ]
[root@masterszx]#
6、安装SSH
Root用户下启动服务:
service sshd restart
在普通户下操作
登录本机,检查是否成功,此时,需要密码:ssh master
cd ~/.ssh/
ssh-keygen -t rsa
有提示,一直按回车
cat id_rsa.pub >> authorized_keys
在root用户下操作
修改权限
chmod 700 authorized_keys
修改SSH配置文件"/etc/ssh/sshd_config"的下面内容
vim /etc/ssh/sshd_config
###############
RSAAuthentication yes # 启用 RSA 认证
PubkeyAuthentication yes # 启用公钥私钥配对认证方式
AuthorizedKeysFile .ssh/authorized_keys # 公钥文件路径(和上面生成的文件相同)
###############
重启SSH
service sshd restart
在普通用户下操作
登录本机,此时不需要密码
ssh master
在slave1和slave2上进行相同操作
将公钥id_rsa.pub分别拷贝到authorized_keys
cat id_rsa.pub >>authorized_keys
7、root下设置ssh
Root下的ssh和普通用户下的ssh
Root下的目录
[root@master.ssh]# pwd
/root/.ssh
普通用户下的目录
[szx@slave2.ssh]$ pwd
/home/szx/.ssh
它们的目录不同
8、Java更新
暂时不进行更新操作
9、Python
保证Python版本大于2.6
10、关闭Linux的THP服务
#centos6
vi/etc/grub.conf,添加transparent_hugepage=never
#centos7:
vi/etc/default/grub
在有CMDLINE一行添加 transparent_hugepage=never
grub2-mkconfig-o /boot/grub2/grub.cfg
systemctldisable tuned
重启之后,用下面的命令检查:
cat/sys/kernel/mm/redhat_transparent_hugepage/enabled
有 [never]则表示THP被禁用
11、启动ntpd
/etc/init.d/ntpd start
否则,会出现ntpd Not running on 3 hosts问题
12、禁止PackageKit
这个步骤每台都需要做,因为在使用yum安装期间有可能导致yum被锁,安装过程报错。agent会用到yum安装hadoop及上层组件,而server也要用yum安装ambari。
vi/etc/yum/pluginconf.d/refresh-packagekit.conf 修改其中配置将enabled后面数值置0。
二、安装过程
1、下载Ambari的公共库文件
首先需要获取Ambari的公共库文件(public repository),登录到Linux主机并执行下面的命令(也可以自己手工下载):
旧:
wgethttp://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.0.1/ambari.repo
新:
wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.4.0.1/ambari.repo
或:
wget -nvhttp://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.4.0.1/ambari.repo-O /etc/yum.repos.d/ambari.repo
(不用拷贝)
2、拷贝到Linux的系统目录/etc/yum.repos.d/
将下载的ambari.repo文件拷贝到Linux的系统目录/etc/yum.repos.d/,拷贝完后,我们需要获取该公共库的所有的源文件列表。
3、查看
yum clean all
yum list|grep ambari
如果可以看到Ambari的对应版本的安装包列表,说明公共库已配置成功。然后就可以安装Ambari的package了。
4、安装
yum install ambari-server
5、配置
ambari-server setup
在这个交互式的设置中,采用默认配置即可。Ambari会使用Postgres数据库,默认会安装并使用Oracle的JDK。默认设置了Ambari GUI的登录用户为admin/admin。并且指定Ambari Server的运行用户为root。
备注(详细的设置过程):
旧:
[root@master~]# amari-server setup
bash:amari-server: command not found
[root@master~]# ambari-server setup
Usingpython /usr/bin/python2.6
Setupambari-server
CheckingSELinux...
SELinuxstatus is 'enabled'
SELinuxmode is 'permissive'
WARNING:SELinux is set to 'permissive' mode and temporarily disabled.
OK tocontinue [y/n] (y)? y
Customizeuser account for ambari-server daemon [y/n] (n)? y
Enteruser account for ambari-server daemon (root):
Adjustingambari-server permissions and ownership...
Checkingiptables...
CheckingJDK...
[1]Oracle JDK 1.7
[2]Oracle JDK 1.6
[3] -Custom JDK
==============================================================================
Enterchoice (1):
To downloadthe Oracle JDK and the Java Cryptography Extension (JCE) Policy Files you mustaccept the license terms found athttp://www.oracle.com/technetwork/java/javase/terms/license/index.html and notaccepting will cancel the Ambari Server setup and you must install the JDK andJCE files manually.
Doyou accept the Oracle Binary Code License Agreement [y/n] (y)?
DownloadingJDK fromhttp://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)
Successfullydownloaded JDK distribution to/var/lib/ambari-server/resources/jdk-7u67-linux-x64.tar.gz
InstallingJDK to /usr/jdk64/
Successfullyinstalled JDK to /usr/jdk64/
DownloadingJCE Policy archive fromhttp://public-repo-1.hortonworks.com/ARTIFACTS/UnlimitedJCEPolicyJDK7.zip to/var/lib/ambari-server/resources/UnlimitedJCEPolicyJDK7.zip
UnlimitedJCEPolicyJDK7.zip...100%
Successfullydownloaded JCE Policy archive to /var/lib/ambari-server/resources/UnlimitedJCEPolicyJDK7.zip
InstallingJCE policy...
Completingsetup...
Configuringdatabase...
Enteradvanced database configuration [y/n] (n)?
Configuringdatabase...
Defaultproperties detected. Using built-in database.
Configuringambari database...
CheckingPostgresql...
Runninginitdb: This may take upto a minute.
Initializingdatabase: [ OK ]
Aboutto start Postgresql
Configuringlocal database...
Connectingto local database...done.
ConfiguringPostgresql...
RestartingPostgresql
Extractingsystem views...
.ambari-admin-2.0.1.45.jar
..
Adjustingambari-server permissions and ownership...
AmbariServer 'setup' completed successfully.
[root@master~]#
新:
[root@masterszx]# ambari-server setup
Usingpython /usr/bin/python
Setupambari-server
CheckingSELinux...
SELinuxstatus is 'disabled'
Customizeuser account for ambari-server daemon [y/n] (n)? y
Enteruser account for ambari-server daemon (szx):admin
Adjustingambari-server permissions and ownership...
Checkingfirewall status...
CheckingJDK...
[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
==============================================================================
Enterchoice (1): 1
Todownload the Oracle JDK and the Java Cryptography Extension (JCE) Policy Filesyou must accept the license terms found athttp://www.oracle.com/technetwork/java/javase/terms/license/index.html and notaccepting will cancel the Ambari Server setup and you must install the JDK andJCE files manually.
Doyou accept the Oracle Binary Code License Agreement [y/n] (y)? y
DownloadingJDK fromhttp://public-repo-1.hortonworks.com/ARTIFACTS/jdk-8u77-linux-x64.tar.gz to/var/lib/ambari-server/resources/jdk-8u77-linux-x64.tar.gz
jdk-8u77-linux-x64.tar.gz...100% (173.0 MB of 173.0 MB)
Successfullydownloaded JDK distribution to/var/lib/ambari-server/resources/jdk-8u77-linux-x64.tar.gz
InstallingJDK to /usr/jdk64/
Successfullyinstalled JDK to /usr/jdk64/
DownloadingJCE Policy archive fromhttp://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-8.zip to /var/lib/ambari-server/resources/jce_policy-8.zip
Successfullydownloaded JCE Policy archive to/var/lib/ambari-server/resources/jce_policy-8.zip
InstallingJCE policy...
Completingsetup...
Configuringdatabase...
Enteradvanced database configuration [y/n] (n)? y
Configuringdatabase...
==============================================================================
ChooSEOne 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
==============================================================================
Enterchoice (1):
Databasename (ambari):
Postgresschema (ambari):
Username(ambari):
EnterDatabase Password (bigdata):
Defaultproperties detected. Using built-in database.
Configuringambari database...
CheckingPostgresql...
Runninginitdb: This may take up to a minute.
Initializingdatabase: [ OK ]
Aboutto start Postgresql
Configuringlocal database...
Connectingto local database...done.
ConfiguringPostgresql...
RestartingPostgresql
Extractingsystem views...
....ambari-admin-2.4.0.1.1.jar
.......
Adjustingambari-server permissions and ownership...
AmbariServer 'setup' completed successfully.
[root@masterszx]#
6、说明
上个过程,对JDK进行了更新
7、启动
ambari-server start
三、网页配置
参照教程:
Ambari 2.1安装HDP2.3.2 之 六、安装部署HDP集群 详细步骤
http://blog.csdn.net/sinat_28224453/article/details/51538449
http://blog.csdn.net/wang_zhenwei
Ambari和HDP升级:
http://www.jb51.cc/article/p-cjyfevlo-bew.html
附录:如果master安装成功,但是slave1和slave2安装失败,并提示镜像不可用,可以尝试,yum clean all。