1. 程式人生 > >CDH安裝指令碼(可用但不完善不適小白)——來自我的QQ空間

CDH安裝指令碼(可用但不完善不適小白)——來自我的QQ空間

#! /bin/bash

10.2.45.81    cdh1

10.2.45.82    cdh2

10.2.45.83    cdh3

echo -e "\033[32m =======close iptables ====== \033[0m"

for client in $ALL_CLIENTS

do

    echo -e "\033[34m ======close iptables at $client====== \033[0m"

     #停止firewall  #禁止firewall開機啟動 #檢視預設防火牆狀態(關閉後顯示notrunning,開啟後顯示running)

    ssh $client "systemctl stop firewalld.service && systemctl disable firewalld.service && firewall-cmd --state"

done

echo -e "\033[32m ==========禁用SELinux========== \033[0m"

for client in $ALL_CLIENTS

do

    echo -e "\033[34m ======禁用SELinux at $client====== \033[0m"

    ssh $client "sed -i -e 's|SELINUX=enforcing|SELINUX=disabled|' /etc/selinux/config"

done

echo -e "\033[32m ==========NTP時間同步========== \033[0m"

for client in $ALL_CLIENTS

do

    echo -e "\033[34m ======NTP at $client====== \033[0m"

    ssh $client "yum -y install ntp && chkconfig ntpd on && service ntpd start"

    ssh $client "ntpdate $ip_NTP"

done

echo -e "\033[32m =============關閉THP============== \033[0m"

for client in $ALL_CLIENTS

do

    ssh $client "echo 'if test -f /sys/kernel/mm/transparent_hugepage/enabled; then

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

 fi

 if test -f /sys/kernel/mm/transparent_hugepage/defrag; then

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

 fi ' >> /etc/rc.d/rc.local"

done

echo 0 > /proc/sys/vm/swappiness

echo never > /sys/kernel/mm/transparent_hugepage/defrag && echo never > /sys/kernel/mm/transparent_hugepage/enabled

# echo -e "\033[32m ==========install mysql5.7 ========== \033[0m"

yum remove mariadb-libs

tar -xvf mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar

yum -y install mysql-community-libs-5.7.20-1.el7.x86_64.rpm 

yum -y localinstall mysql-community-common-5.7.20-1.el7.x86_64.rpm mysql-community-libs-compat-5.7.20-1.el7.x86_64.rpm mysql-community-client-5.7.20-1.el7.x86_64.rpm mysql-community-server-5.7.20-1.el7.x86_64.rpm 

# # 初始化

# mysqld --initialize --user=mysql

# # 啟動mysql

# systemctl start mysqld.service

#檢視初始密碼 grep 'temporary password' /var/log/mysqld.log

# #改密碼

# ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

# 許可權問題

# GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

cp mysql-connector-java-5.1.45-bin.jar cm-5.13.1/share/cmf/lib/

/opt/cm-5.13.1/share/cmf/schema/scm_prepare_database.sh mysql -hlocalhost -uroot -p123456 --scm-host localhost scm scm scm

useradd --system --home=/opt/cm-5.13.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm

/opt/cm-5.13.1/etc/init.d/cloudera-scm-server start

/opt/cm-5.13.1/etc/init.d/cloudera-scm-agent start

# oozie

opt/cloudera/parcels/CDH/lib/oozie/libtools