Ambari 2.1.0安装经验分享
江左梅郎2017/03/17         
一、准备工作
1、准备几台机器
10.1.51.100 ambariserver 本地mirror server及ambari server都在这一台机器
10.1.51.10 master
10.1.51.11 slave1
10.1.51.12 slave2
2、都创建管理用户hadoop
3、做ssh免密码登录(ambariserver到其他机器的,hadoop用户)
需要文档的朋友请自行下载文后附件。
ssh-keygen cd .ssh
cat id_rsa.pub >> authorized_keys chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
注意,免密码一定要互相登陆一次,让他记住密码
4、设置sudo免密码(hadoop用户)---后续所有操作都在hadoop用户下去做在各节点上进入root:
visudo
加入如下内容: hadoop ALL=(ALL) NOPASSWD: ALL
5、Maximum Open File Descriptors(10000)
检查语句 ulimit -Sn ulimit -Hn
sudo vi /etc/security/limits.conf @hadoop soft nproc 262144 @hadoop hard nproc 262144 @hadoop soft nofile 262144 @hadoop hard nofile 262144
sudo vi /etc/security/limits.d/90-nproc.conf @hadoop soft nproc 262144
以上改动重启才能生效,最好同时执行ulimit -u 10240 命令,是其立即生效。(ulimit 命令很多啊)
6、Check Existing Package Versions
7、Set up Service User Accounts(设置服务用户账户)
http://docs.hortonworks.com/HDPDocuments/Ambari-2.0.0.0/Ambari_Doc_Suite/ADS_v200.html#ref-70627b43-7d78-4cbb-8df8-e3f43cbd8422
hdp的各个服务运行在不同的linux账户下,如果你创建了这些账户,ambari就会直接用,否则他会自动创建,但是自动创建的用户不知道密码是什么,但是还是可以 sudo su hdfs进入到这些用户下,不过这样就不方便了。
比较好的办法是自己创建的账户,使用ambari安装组件时选择自定义账户即可(UID >= 1000)。8、Enable NTP on the Cluster and on the Browser Host
集群各节点,包括安装ambari webui的机器都得开启ntp服务已同步时间,如果有条件,局域网应该有ntp服务器
To check that the NTP service is on, run the following command on each host: chkconfig --list ntpd
To set the NTP service to start on reboot, run the following command on each host: chkconfig ntpd on
To turn on the NTP service, run the following command on each host: service ntpd start
9、Check DNS(可以选择10)
集群所有机器必须配置正向和反向DNS,如果条件不允许,就设置/etc/hosts文件,每个节点都得改
10、/etc/hosts
1.2.3.4 <fully.qualified.domain.name> //一行一个注意:这两行千万不要删除
127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6
vi /etc/sysconfig/network
NETWORKING=yes NETWORKING_IPV6=yes HOSTNAME=<fully.qualified.domain.name> 11、关闭防火墙
12、Disable SELinux and PackageKit and check the umask Value set SELINUX=disabled in /etc/selinux/config
sudo vi /etc/yum/pluginconf.d/refresh-packagekit.conf 设置:enabled=0
Ambari supports a umask value of 022 or 027
如果你是centos,且使用非root账户时,一定要改一下
sudo vi /etc/profile
将
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002
else umask 022 fi
改为:
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then umask 022
else umask 022 fi
http://baike.baidu.com/link?url=y6Bqna573QbDtjR6lxjFPXWGexQ8eTTHzNl-R8S_mM2outIS7BLvBbC2JKaGtEPpTYeiyMXD-zzr5F6xiGOlfq
-----------------------------------------------------前面的全部是准备性工作--------------------------------------------------------------------
二、Using a Local Repository(以下操作先在mirror server上传一个本地的ambari和hdp的仓库,然后在准备安装ambari-server的机器上去下载本地仓库的配置文件) 1、Obtain the repositories(获取存储库)
a、Ambari Repositories
b、HDP Stack Repositories
我们获取两个库一个是Ambari,一个是HDP Stack,如果你没有有网络访问权限则下载打包好的软件包拷贝进来: wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/ambari-2.0.0-centos6.tar.gz
wget -nv http://public-repo-1.hortonworks.com/HDP/centos6/HDP-2.2.4.2-centos6-rpm.tar.gz
wget -nv http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6/HDP-UTILS-1.1.0.20-centos6.tar.gz
如果有网,那就下载ambari.repo,把远程库的软件同步到本地:(不建议使用这种方式) cd /etc/yum.repos.d/
sudo wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.0.0/ambari.repo
http://s3.amazonaws.com/dev.hortonworks.com/ambari/centos6/2.x/BUILDS/2.1.0-1409/ambaribn.repo
http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/
sudo wget -nv http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.2.4.2/hdp.repo -O /etc/yum.repos.d/HDP.repo
2、Set up a local repository having(建立一个本地库) a、Getting Started Setting Up a Local Repository(一些准备工作)
Select an existing server in, or accessible to the cluster, that runs a supported operating system.
选择一个集群内的或者可以接入集群的一台机器作为mirror server,操作系统必须是被支持的,我们这里选用ambariserver Enable network access from all hosts in your cluster to the mirror server.
使集群中所有主机都能访问mirror server
Ensure the mirror server has a package manager installed such as yum (RHEL / CentOS / Oracle Linux), zypper (SLES), or apt-get (Ubuntu). Optional: If your repository has temporary Internet access, and you are using RHEL/CentOS/Oracle Linux as your OS, install yum utilities: sudo yum install yum-utils createrepo
1.Create an HTTP server. sudo yum install httpd
设置为开机启动
sudo chkconfig --level 0356 httpd on
2.On your mirror server, create a directory for your web server. mkdir -p /var/www/html/
b、下面的根据有无网络进行选择(跳过)
选项1、Setting Up a Local Repository with No Internet Access(无网络访问权限)
选项2、Setting Up a Local Repository with Temporary Internet Access(临时可以上网) 1、把repo下载到/etc/yum.repos.d/下
cd /etc/yum.repos.d/
sudo wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.1.0/ambari.repo
sudo wget -nv http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.0.0/hdp.repo -O /etc/yum.repos.d/HDP.repo
2、Confirm availability of the repositories(确定仓库的可用性) yum repolist
3、Synchronize the repository contents to your mirror server(把远程仓库的软件包同步到mirror server) 同步ambari的软件包: cd /var/www/html
sudo mkdir -p ambari/centos6 cd ambari/centos6
sudo reposync -r Updates-ambari-2.1.0
同步HDP的软件包: cd /var/www/html
sudo mkdir -p hdp/centos6 cd hdp/centos6
sudo reposync -r HDP-2.3.0.0
sudo reposync -r HDP-UTILS-1.1.0.20
4、Generate the repository metadata.(生成仓库元数据)
sudo createrepo /var/www/html/ambari/centos6/Updates-ambari-2.1.0 sudo createrepo /var/www/html/hdp/centos6/HDP-2.3.0.0
sudo createrepo /var/www/html/hdp/centos6/HDP-UTILS-1.1.0.20
5、Confirm that you can browse to the newly created repository
确认你可以浏览到新创建的存储库(网页上看见即可)
//sudo yum install yum-plugin-priorities
3、Prepare the Ambari repository configuration file(在要安装ambari-server的机器上配置Ambari repository的yum源)
注意:只需要在ambari-server上配置ambari.repo,名字都不用变,其他节点不需要。
因为我这里mirror server及ambari server都在这一台机器,所以只要把之前那个ambari.repo改一下即可(当你从外网同步软件包时得把这个文件改回去) cd /etc/yum.repos.d/
vi ambari.repo
加入如下内容指向刚刚创建的本地ambari库: [Updates-ambari-2.1.0] name=ambari-2.0.0 - Updates
baseurl=http://10.128.7.101/ambari/centos6/Updates-ambari-2.1.0 gpgcheck=0
enabled=1
以下操作在Ambari Server上进行三、Download the Ambari Repo
检查仓库是否可用: yum repolist
安装:
sudo yum install ambari-server
四、Set Up the Ambari Server
输入以下命令开始配置: sudo ambari-server setup
1、如果你没禁用selinx,请按照提示输入y
2、这时会提示你是否指定一个用户来运行ambari-server,如果你要保持默认的root请选择n,输入y,然后再输入一个用户名就能指定其他用户,这里我们指定 hadoop 3、如果你没禁用防火墙,请按照提示输入y
4、选择jdk(自定义jdk一定要注意权限,要保证所有用户都能执行java) 5、如果选择下载jdk则要Accept the Oracle JDK license when prompted 6、选择ambari-server数据库的输入库输入n则使用默认内置的PostgreSQL database for Ambari。
默认的数据库名是ambari,默认用户名密码是ambari/bigdata命令 Otherwise, to use an existing PostgreSQL, MySQL or Oracle database with Ambari, select y.
http://docs.hortonworks.com/HDPDocuments/Ambari-2.0.0.0/Ambari_Doc_Suite/ADS_v200.html#ref-3df6a0bd-d91a-40d1-bbd0-079485e283e4 7、At Proceed with configuring remote database connection properties [y/n] choose y //允许远程连接
Setup Options:---基本无用
-j (or --java-home) --jdbc-driver
--jdbc-db指定数据库,Valid values are: [postgres | mysql | oracle] Use this option with the --jdbc-driver option to specify the location of the JDBC driver JAR file.
-g (or --debug) -v (or --verbose)
配置文件在/etc/ambari-server/conf下
五、Start the Ambari Server sudo ambari-server start sudo ambari-server status sudo ambari-server stop
如果你想在Hive和Oozie中使用已经存在的数据库,那你在安装hadoop集群之前就应该先执行以下操作:
http://docs.hortonworks.com/HDPDocuments/Ambari-2.0.0.0/Ambari_Doc_Suite/ADS_v200.html#ref-fa206f19-8c72-4bd5-9115-540e5e623be1 http://docs.hortonworks.com/HDPDocuments/Ambari-2.0.0.0/Ambari_Doc_Suite/ADS_v200.html#ref-62537b31-e625-45c3-aa15-ff0cf0f4251e
六、Install, Configure and Deploy a HDP Cluster a、Log In to Apache Ambari http://ambariserver:8080/
default user name/password: admin/admin,后面可以修改用户名密码
由于是新的集群,这时会显示欢迎页面
b、Name Your Cluster
From the Ambari Welcome page, choose Launch Install Wizard
从欢迎页面选择启动安装向导,这时会要求输入几个集群名称:我选择输入OneAPM c、Select Stack
选择HDP2.2
Advanced Repository Options :调整到本地库 http://ambariserver/hdp/centos6/HDP-2.2.4.2 http://ambariserver/hdp/centos6/HDP-UTILS-1.1.0.20 d、Install Options
Target Hosts:
输入集群各个节点的主机名,一行一个,当然也可以使用表达式,例如host01.domain --- host10.domain use host[01-10].domain 注意:If you are deploying on EC2, use the internal Private DNS host names.
Host Registration Information:
如果想自动安装ambari agent,请选择Provide your SSH Private Key to automatically register hosts ,并指定ambari-server的私钥(.ssh/id_rsa)
SSH User Account :选择hadoop
e、Confirm Hosts
这一步会去各节点安装ambari agent,这里需要注意的是:如果是centos6会有个bug,必须升级openssl才能安装完成。 sudo yum upgrade openssl
同时他会检查各节点的环境,比如jdk是否安装,依赖的包是否安装等扥。
f、Choose Services
选择需要在集群中安装哪些组件,也可以后面再添加组件g、Assign Masters
选择各个软件的master安装到那个主机
h、Assign Slaves and Clients
选择各个组件的slave安装到哪些主机
i、Customize Services
定制服务,也就是配置各个服务
j、Review
回顾一下之前的配置
k、Install, Start and Test
等待自动安装
l、Complete
可以修改端口号
在/etc/ambari-server/conf/ambari.properties文件增加
client.api.port=<port_number>
ambari安装-2.1.0.doc 资源大小: 58KB