热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

自动部署Ambari到集群的自动化脚本

TodeployyourHadoopinstance,youneedtoprepareyourdeploymentenvironment:•SetupPas

To deploy your Hadoop instance, you need to prepare your deployment environment:

• Set up Password-less SSH

On the master host


#/bin/sh


#Set Up Password-less SSH

master="zchxa1.eng.platformlab.ibm.com"

agents="zchxa2.eng.platformlab.ibm.com zchxa3.eng.platformlab.ibm.com"

all_hosts="$master $agents"

#On the master host

ssh-keygen -t rsa

cat id_rsa.pub >> authorized_keys

chmod 700 ~/.ssh

chmod 600 ~/.ssh/authorized_keys

tar -zcvf ~/ssh.tar.gz ~/.ssh

for host in $agents

do

  scp ~/ssh.tar.gz $host:/root/ssh.tar.gz

  ssh $host "tar -zxvf /root/ssh.tar.gz -C /; cat /root/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; chmod 700 ~/.ssh; chmod 600 ~/.ssh/authorized_keys; rm -rf /root/ssh.tar.gz"

done

rm -rf ~/ssh.tar.gz

  

2. Prepare the NTP

#/bin/sh


#Set Up Password-less SSH

master="zchxa1.eng.platformlab.ibm.com"

agents="zchxa2.eng.platformlab.ibm.com zchxa3.eng.platformlab.ibm.com"

all_hosts="$master $agents"

for host in $all_hosts

do

    #RHEL/CentOS/Oracle 6

    ssh $host "chkconfig --list ntpd &”

    #RHEL/CentOS/Oracle 7

    #ssh $host "systemctl is-enabled ntpd"

    #To set the NTP service to auto-start on boot, run the following command on each host:

    #RHEL/CentOS/Oracle 6

    ssh $host "chkconfig ntpd on"

    #RHEL/CentOS/Oracle 7

    #ssh $host "systemctl enable ntpd"

    #To start the NTP service, run the following command on each host:

    #RHEL/CentOS/Oracle 6

    ssh $host "service ntpd start"

    #RHEL/CentOS/Oracle 7

    #ssh $host "systemctl start ntpd"

    

    #Configuring iptables

    #RHEL/CentOS/Oracle Linux 6

    ssh $host "chkconfig iptables off"

    ssh $host "/etc/init.d/iptables stop"

    #RHEL/CentOS/Oracle Linux 7

    #ssh $host "systemctl disable firewalld"

    #ssh $host "service firewalld stop"


    #Disable SELinux and PackageKit and check the umask Value

    #/etc/yum/pluginconf.d/refresh-packagekit.conf

    ssh $host "setenforce 0"

    echo never > /sys/kernel/mm/transparent_hugepage/enabled;

    echo never > /sys/kernel/mm/transparent_hugepage/defrag;

    /etc/init.d/iptables stop

    chkconfig iptables off

    ssh $host "echo 'umask 0022' >> /etc/profile"

done



3. Getting Started Setting Up a Local Repository

yum install -y httpd

chkconfig httpd on

service httpd start

yum install -y yum-utils createrepo

mkdir -p /var/www/html/

# For RHEL and CentOS 7:

#yum install yum-plugin-priorities

# For RHEL and CentOS 6:

yum install -y yum-plugin-priorities

cd /var/www/html

tar -zxvf /media/sf_Hadoop/ambari-2.2.2.0-centos6.tar.gz -C /var/www/html

tar -zxvf /media/sf_Hadoop/HDP-2.2.0.0-centos6-rpm.tar.gz -C /var/www/html/

tar -zxvf /media/sf_Hadoop/HDP-UTILS-1.1.0.20-centos6.tar.gz -C /var/www/html/



cd ambari-2.2.2.0/centos6

cd /var/www/html

mkdir -p ambari/centos6

cd ambari/centos6

reposync -r Updates-ambari-2.2.2.0

cd /var/www/html

mkdir -p hdp/centos6

cd hdp/HDP/centos6

reposync -r HDP-2.2.2.0

reposync -r HDP-UTILS-1.1.0.20


Repository Base URL

Ambari Base URL http://192.168.1.6/ambari-2.2.2.0/centos6

HDP Base URL http://192.168.1.6/hdp/HDP/centos6/2.x/updates/2.2.2.0

HDP-UTILS Base URL http://192.168.1.6/hdp/HDP-UTILS-1.1.0.20/repos/centos

4. Generate the repository metadata

For Ambari:

createrepo /var/www/html/ambari/centos6/Updatesambari-2.2.2.0

createrepo /var/www/html/AMBARI-2.2.2.0/centos6

createrepo  /var/www/html/Updatesambari-2.2.2.0

For HDP Stack Repositories:

createrepo /var/www/html/hdp/centos6/HDP-2.2.2.0

createrepo /var/www/html/hdp/centos6/HDP-UTILS-1.1.0.20

Or

#/bin/sh


#Set Up Password-less SSH

master="szw1"

agents="szw2 szw3"

all_hosts="$master $agents"

wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.2.2.0/ambari.repo -O /etc/yum.repos.d/ambari.repo

sed -i "s/public-repo-1.hortonworks.com/`hostname -f`/g" /etc/yum.repos.d/ambari.repo

cp /var/www/html/HDP/centos6/2.x/GA/2.2.0.0/hdp.repo /etc/yum.repos.d/hdp.repo

sed -i "s/public-repo-1.hortonworks.com/`hostname -f`/g" /etc/yum.repos.d/hdp.repo


for host in $all_hosts

do

    #RHEL/CentOS/Oracle 6

    scp /etc/yum.repos.d/ambari.repo $host:/etc/yum.repos.d/ambari.repo

    scp /etc/yum.repos.d/hdp.repo $host:/etc/yum.repos.d/hdp.repo

    ssh $host "yum clean all; yum makecache; yum repolist"

done

yum repolist

yum install ambari-server


ambari-server setup -j /usr/java/jdk1.8.0_65


推荐阅读
  • 树莓派Linux基础(一):查看文件系统的命令行操作
    本文介绍了在树莓派上通过SSH服务使用命令行查看文件系统的操作,包括cd命令用于变更目录、pwd命令用于显示当前目录位置、ls命令用于显示文件和目录列表。详细讲解了这些命令的使用方法和注意事项。 ... [详细]
  • 本文介绍了Oracle数据库中tnsnames.ora文件的作用和配置方法。tnsnames.ora文件在数据库启动过程中会被读取,用于解析LOCAL_LISTENER,并且与侦听无关。文章还提供了配置LOCAL_LISTENER和1522端口的示例,并展示了listener.ora文件的内容。 ... [详细]
  • 本文讨论了在数据库打开和关闭状态下,重新命名或移动数据文件和日志文件的情况。针对性能和维护原因,需要将数据库文件移动到不同的磁盘上或重新分配到新的磁盘上的情况,以及在操作系统级别移动或重命名数据文件但未在数据库层进行重命名导致报错的情况。通过三个方面进行讨论。 ... [详细]
  • 标题: ... [详细]
  • 在CentOS/RHEL 7/6,Fedora 27/26/25上安装JAVA 9的步骤和方法
    本文介绍了在CentOS/RHEL 7/6,Fedora 27/26/25上安装JAVA 9的详细步骤和方法。首先需要下载最新的Java SE Development Kit 9发行版,然后按照给出的Shell命令行方式进行安装。详细的步骤和方法请参考正文内容。 ... [详细]
  • 本文介绍了Python爬虫技术基础篇面向对象高级编程(中)中的多重继承概念。通过继承,子类可以扩展父类的功能。文章以动物类层次的设计为例,讨论了按照不同分类方式设计类层次的复杂性和多重继承的优势。最后给出了哺乳动物和鸟类的设计示例,以及能跑、能飞、宠物类和非宠物类的增加对类数量的影响。 ... [详细]
  • Oracle优化新常态的五大禁止及其性能隐患
    本文介绍了Oracle优化新常态中的五大禁止措施,包括禁止外键、禁止视图、禁止触发器、禁止存储过程和禁止JOB,并分析了这些禁止措施可能带来的性能隐患。文章还讨论了这些禁止措施在C/S架构和B/S架构中的不同应用情况,并提出了解决方案。 ... [详细]
  • 本文介绍了使用SSH免密登录的步骤,包括生成公私钥、传递公钥给被登录机、修改文件权限的操作。同时提醒用户注意私钥的传递方式,建议使用U盘等离线方式传递。 ... [详细]
  • Java学习笔记之使用反射+泛型构建通用DAO
    本文介绍了使用反射和泛型构建通用DAO的方法,通过减少代码冗余度来提高开发效率。通过示例说明了如何使用反射和泛型来实现对不同表的相同操作,从而避免重复编写相似的代码。该方法可以在Java学习中起到较大的帮助作用。 ... [详细]
  • PatchODAX8: ... [详细]
  •     这里使用自己编译的hadoop-2.7.0版本部署在windows上,记得几年前,部署hadoop需要借助于cygwin,还需要开启ssh服务,最近发现,原来不需要借助cy ... [详细]
  • hadoop1.2.1文档中这样写:Nowcheckthatyoucansshtothelocalhostwithoutapassphrase:$sshlocalhostIfyou ... [详细]
  • 现在比较流行使用静态网站生成器来搭建网站,博客产品着陆页微信转发页面等。但每次都需要对服务器进行配置,也是一个重复但繁琐的工作。使用DockerWeb,只需5分钟就能搭建一个基于D ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • imx6ull开发板驱动MT7601U无线网卡的方法和步骤详解
    本文详细介绍了在imx6ull开发板上驱动MT7601U无线网卡的方法和步骤。首先介绍了开发环境和硬件平台,然后说明了MT7601U驱动已经集成在linux内核的linux-4.x.x/drivers/net/wireless/mediatek/mt7601u文件中。接着介绍了移植mt7601u驱动的过程,包括编译内核和配置设备驱动。最后,列举了关键词和相关信息供读者参考。 ... [详细]
author-avatar
梦幻小螳螂
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有