ambari安装指南

时间:2022-04-22
本文章向大家介绍ambari安装指南,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

(一)准备工作 1、准备几台机器 10.1.51.100 ambariserver 本地mirrorserver及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=yesNETWORKING_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(以下操作先在mirrorserver上传一个本地的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. 选择一个集群内的或者可以接入集群的一台机器作为mirrorserver,操作系统必须是被支持的,我们这里选用ambariserver Enable network accessfrom all hostsin yourcluster to the mirrorserver. 使集群中所有主机都能访问mirrorserver Ensure the mirrorserver has a package manager installed such asyum (RHEL/ CentOS / Oracle Linux),zypper (SLES), or apt-get (Ubuntu). Optional: Ifyour repository hastemporaryInternet access, and you are using RHEL/CentOS/Oracle Linux asyour OS, install yum utilities: sudo yum install yum-utilscreaterepo 1.Create an HTTP server. sudo yum install httpd 设置为开机启动 sudo chkconfig --level 0356 httpd on 2.On your mirrorserver,create a directoryforyour 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 TemporaryInternet 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 repositorycontentsto your mirrorserver(把远程仓库的软件包同步到mirrorserver) 同步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 thatyou can browse to the newlycreated repository 确认你可以浏览到新创建的存储库(网页上看见即可) //sudo yum install yum-plugin-priorities 3、Prepare the Ambari repositoryconfiguration file(在要安装ambari-server的机器上配置Ambari repository的yum源) 注意:只需要在ambari-server上配置ambari.repo,名字都不用变,其他节点不需要。 因为我这里mirrorserver及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-serversetup 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,selecty. 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 specifythe location of the JDBC driver JAR file. -g (or --debug) -v(or --verbose) 配置文件在/etc/ambari-server/conf下