码迷,mamicode.com
首页 > 其他好文 > 详细

ansible快速部署CDH-5.6.1

时间:2018-09-14 11:04:42      阅读:349      评论:0      收藏:0      [点我收藏+]

标签:mkdir   cal   res   home   localhost   Owner   mysql连接   tail   des   

使用ansible快速部署cdh-5.6.1

本部署步骤的前提是已安装配置完成ansible,达到快速部署的目的。

1.关闭selinux

ansible mysql -m shell -a "sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config"

2.关闭防火墙

ansible mysql -m shell -a ‘chkconfig iptables off‘
ansible mysql -m shell -a ‘service iptables stop‘

3.修改hosts

ansible shyd -m shell -a "mv /etc/hosts /etc/hosts.bak1"
ansible shyd -m shell -a ‘wget -P /etc/ http://192.168.5.100/1/hosts‘

4.配置ntp服务

ansible shyd -m shell -a "mv /etc/ntp.conf /etc/ntp.conf.bak"
ansible shyd -m shell -a ‘wget -P /etc/ http://192.168.5.100/1/ntp.conf‘
ansible shyd -m shell -a "ntpdate 192.168.5.31"
ansible shyd -m shell -a "service ntpd restart"
ansible shyd -m shell -a "chkconfig ntpd on"

5.优化服务器参数

--优化所有服务器打开文件数:
ansible shyd -m shell -a "echo ‘* soft nofile 65534‘ >> /etc/security/limits.conf"
ansible shyd -m shell -a "echo ‘* hard nofile 65534‘ >> /etc/security/limits.conf"
--优化cloudera服务器vm.swappiness参数
ansible cloudera -m shell -a "echo ‘vm.swappiness = 10‘ >> /etc/sysctl.conf"

6.配置主机互信

ansible cloudera -m shell -a "cat /root/.ssh/id_rsa.pub"
ansible cloudera -m shell -a ‘wget -P /root/ http://192.168.5.100/1/authorized_keys‘
ansible cloudera -m shell -a "mv /root/"

7.配置jdk

ansible shyd -m copy -a "src=/root/jdk/ dest=/root/ owner=root group=root mode=0600"
ansible cloudera -m shell -a ‘bash +x /root/jdk/install.sh"

8.配置CM节点

#clouder-manager解压文件至/opt下
tar zxvf cloudera-manager-el6-cm5.6.1_x86_64.tar.gz -C /opt
#创建CDH本地源
mkdir -p /opt/cloudera/parcel-repo
mv CDH-5.6.1-1.cdh5.6.1.p0.3-el6.parcel* manifest.json /opt/cloudera/parcel-repo/
#拷贝mysql连接包
cp mysql-connector-java-5.1.39-bin.jar /opt/cm-5.6.1/share/cmf/lib/mysql-connector-java.jar
#添加用户:
useradd --system --home=/opt/cm-5.6.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
#安装mysql
yum -y install mysql-server mysql
#启动mysql
service mysqld start
#开机启动mysql
chkconfig mysqld on
#使用mysql登陆: 执行:
update user set password=PASSWORD("root") where user=‘root‘;
grant all privileges on *.* to root@"%" identified by "root" ;
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
FLUSH PRIVILEGES;
#初始化数据:
/opt/cm-5.6.1/share/cmf/schema/scm_prepare_database.sh mysql cm -hlocalhost -uroot -proot --scm-host localhost scm scm scm
#编辑修改cloudera-manager安装配置文件:
vi /opt/cm-5.6.1/etc/cloudera-scm-agent/config.ini
#修改如下
server_host=FX-I12-CU100
#拷贝文件至其它五个节点
#拷贝mysql-jdbc包
cp mysql-connector-java-5.1.39-bin.jar /usr/share/java/
#安装oozie报错: 则执行
cp /root/cloudera5.6.1/mysql-connector-java-5.1.39-bin.jar /var/lib/oozie/
#创建文件夹:
mkdir -p /var/lib/cloudera-scm-server
chown cloudera-scm:cloudera-scm /var/lib/cloudera-scm-server
#启动cloudera-scm-server
/opt/cm-5.6.1/etc/init.d/cloudera-scm-server start

9.配置agent节点

####其他节点
拷贝agent:
ansible cloudera -m copy -a "src=/opt/cm-5.6.1.tar dest=/root/ owner=root group=root mode=0700"
ansible cloudera -m shell -a "tar -xvf /root/cm-5.6.1.tar -C /opt"
ansible cloudera -m shell -a ‘useradd --system --home=/opt/cm-5.6.1/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm‘

#启动agent节点
/opt/cm-5.6.1/etc/init.d/cloudera-scm-agent start
/opt/cm-5.6.1/etc/init.d/cloudera-scm-agent stop
#查看启动日志
tail -f /opt/cm-5.6.1/log/cloudera-scm-agent/cloudera-scm-agent.log

10.常见报错

ansible快速部署CDH-5.6.1

标签:mkdir   cal   res   home   localhost   Owner   mysql连接   tail   des   

原文地址:https://www.cnblogs.com/sdhzdtwhm/p/9644586.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!