Hadoop 发行版本 Hortonworks 安装详解(一) 准备工作 (2)

#!/usr/bin/env bash SetConfig() { #主机名 input_hostname=$1 #切换默认软件源为阿里云 tar -zcvf /etc/yum.repos.d/${starDate}_bak.tgz /etc/yum.repos.d/*.repo rm -rf /etc/yum.repos.d/*.repo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo rpm --import https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6 yum makecache #安装YUM源优先级插件 yum install -y yum-priorities echo "[info] update yum repo end." #关闭IPV6 echo "alias net-pf-10 off" >> /etc/modprobe.d/dist.conf echo "alias ipv6 off" >> /etc/modprobe.d/dist.conf echo "[info] disabled ipv6 end." #关闭桌面版网络管理程序 service NetworkManager stop chkconfig NetworkManager off echo "[info] disabled NetworkManager end." #修改ulimit echo "* soft nofile 10000" >> /etc/security/limits.conf echo "* hard nofile 32832" >> /etc/security/limits.conf echo "* soft nproc 10000" >> /etc/security/limits.conf echo "* hard nproc 32832" >> /etc/security/limits.conf sed -i 's/1024/10000/g' /etc/security/limits.d/90-nproc.conf echo "* hard nproc 32832" >> /etc/security/limits.d/90-nproc.conf echo "[info] set ulimit end." #关闭iptables chkconfig iptables off /etc/init.d/iptables stop chkconfig ip6tables off /etc/init.d/ip6tables stop echo "[info] disabled iptables end." #关闭 SELinux setenforce 0 sed -i "/^SELINUX=http://www.likecs.com/ c SELINUX=disabled" /etc/selinux/config echo "[info] disabled SELinux end." #关闭 PackageKit sed -i "/^enabled=http://www.likecs.com/ c enabled=0" /etc/yum/pluginconf.d/refresh-packagekit.conf echo "[info] disabled PackageKit end." #关闭 HUP #sed -i "s/quiet/quiet transparent_hugepage=never/" /etc/grub.conf echo "" >> /etc/rc.local echo "echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag" >> /etc/rc.local echo "echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled" >> /etc/rc.local echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.local echo "[info] disabled HUP end." #打开从节点时间同步(所有的主机都需要打开) sed -i "s/0.centos.pool.ntp.org iburst/time.pool.aliyun.com prefer/" /etc/ntp.conf chkconfig ntpd on service ntpd start echo "[info] enabled ntpd end." #设置net.core.somaxconn和vm.swappiness参数 echo "net.core.somaxconn = 32768" >> /etc/sysctl.conf echo "vm.swappiness = 0" >> /etc/sysctl.conf #修改节点HostName名称 echo "......InputHostName:${input_hostname}......" hostname ${input_hostname} sed -i "/^HOSTNAME=http://www.likecs.com/ c HOSTNAME=${input_hostname}" /etc/sysconfig/network #写入所有节点HostName到hosts文件 sed -i "1i\节点1IP地址 节点1hostname" /etc/hosts sed -i "1i\节点2IP地址 节点2hostname" /etc/hosts sed -i "1i\节点3IP地址 节点3hostname" /etc/hosts sed -i "1i\节点4IP地址 节点4hostname" /etc/hosts sed -i "1i\节点5IP地址 节点5hostname" /etc/hosts } #没有参数 if [ x$1 == x ] ; then echo "[error] please enter the parameters." exit -1 fi SetConfig $1 reboot

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpdgpw.html