xsync脚本
#!/bin/bash
#1 获取输入参数个数,如果没有参数,直接退出
pcount=$#
if((pcount==0)); then
echo no args;
exit;
fi
#2 获取文件名称
p1=$1
fname=`basename $p1`
echo fname=$fname
#3 获取上级目录到绝对路径
pdir=`cd -P $(dirname $p1); pwd`
echo pdir=$pdir
#4 获取当前用户名称
user=`whoami`
#5 循环
for((host=103; host<105; host++)); do
echo ------------------- hadoop$host --------------
rsync -av $pdir/$fname $user@hadoop$host:$pdir
done
免密配置
ssh-keygen -t rsa
ssh-copy-id hadoop102
其他配置
vim /etc/hosts
172.17.138.24 hadoop102 hadoop102
172.17.138.25 hadoop103 hadoop103
172.17.138.23 hadoop104 hadoop104
#关闭SELINUX
vim /etc/selinux/config
#将SELINUX=enforcing 改为SELINUX=disabled
#安装jdk
tar -zxvf jdk-8u144-linux-x64.tar.gz -C /usr/java/
#修改环境变量
vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_144
export PATH=$PATH:$JAVA_HOME/bin
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
/usr/share/cmf/schema/scm_prepare_database.sh mysql scm root 123456
yum -y install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
yum -y install cloudera-manager-agent cloudera-manager-daemons
vim /etc/cloudera-scm-agent/config.ini
/usr/share/cmf/schema/scm_prepare_database.sh mysql scm root 123456
/etc/rc.d/init.d/cloudera-scm-server start
/etc/rc.d/init.d/cloudera-scm-agent restart
UPDATE user SET Password=PASSWORD('root') where USER='root';
grant all privileges on *.* to 'root' @'%' identified by 'root';
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm root root
/opt/cm-5.13.0/share/cmf/schema/scm_prepare_database.sh -hd001 -P3306 --scm-host d001 --force mysql cdh root root
mysql依赖处理
https://www.jianshu.com/p/7b8c4dea6829