xsync脚本

  1. #!/bin/bash
  2. #1 获取输入参数个数,如果没有参数,直接退出
  3. pcount=$#
  4. if((pcount==0)); then
  5. echo no args;
  6. exit;
  7. fi
  8. #2 获取文件名称
  9. p1=$1
  10. fname=`basename $p1`
  11. echo fname=$fname
  12. #3 获取上级目录到绝对路径
  13. pdir=`cd -P $(dirname $p1); pwd`
  14. echo pdir=$pdir
  15. #4 获取当前用户名称
  16. user=`whoami`
  17. #5 循环
  18. for((host=103; host<105; host++)); do
  19. echo ------------------- hadoop$host --------------
  20. rsync -av $pdir/$fname $user@hadoop$host:$pdir
  21. done

免密配置

  1. ssh-keygen -t rsa
  2. ssh-copy-id hadoop102

其他配置

  1. vim /etc/hosts
  2. 172.17.138.24 hadoop102 hadoop102
  3. 172.17.138.25 hadoop103 hadoop103
  4. 172.17.138.23 hadoop104 hadoop104
  5. #关闭SELINUX
  6. vim /etc/selinux/config
  7. #将SELINUX=enforcing 改为SELINUX=disabled
  8. #安装jdk
  9. tar -zxvf jdk-8u144-linux-x64.tar.gz -C /usr/java/
  10. #修改环境变量
  11. vim /etc/profile
  12. export JAVA_HOME=/usr/java/jdk1.8.0_144
  13. export PATH=$PATH:$JAVA_HOME/bin
  14. CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
  15. CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
  16. CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
  17. CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
  18. CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
  19. CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
  20. /usr/share/cmf/schema/scm_prepare_database.sh mysql scm root 123456
  21. yum -y install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
  22. yum -y install cloudera-manager-agent cloudera-manager-daemons
  23. vim /etc/cloudera-scm-agent/config.ini
  24. /usr/share/cmf/schema/scm_prepare_database.sh mysql scm root 123456
  25. /etc/rc.d/init.d/cloudera-scm-server start
  26. /etc/rc.d/init.d/cloudera-scm-agent restart
  27. UPDATE user SET Password=PASSWORD('root') where USER='root';
  28. grant all privileges on *.* to 'root' @'%' identified by 'root';
  29. /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm root root
  30. /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