CM Server启动脚本(start-scm-server)
sudo su
cd /bin
vi start-scm-server
脚本内容如下:
#!/bin/bash
echo "start cloudera-scm-server-------------------------------------------------"
for i in cfp-acrm-cdh-1
do
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-server start"
done
sleep 5s
echo "cloudera-scm-server status------------------------------------------------"
for i in cfp-acrm-cdh-1
do
echo ------------------- $i --------------
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-server status"
done
exit 0
设置脚本执行权限:
chmod +x start-scm-server
CM Server停止脚本(stop-scm-server)
sudo su
cd /bin
vi stop-scm-server
脚本内容如下:
#!/bin/bash
echo "stop cloudera-scm-server-------------------------------------------------"
for i in cfp-acrm-cdh-1
do
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-server stop"
done
sleep 5s
echo "cloudera-scm-server status------------------------------------------------"
for i in cfp-acrm-cdh-1
do
echo ------------------- $i --------------
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-server status"
done
exit 0
设置脚本执行权限:
chmod +x stop-scm-server
CM Server状态查看脚本(status-scm-server)
sudo su
cd /bin
vi status-scm-server
脚本内容如下:
#!/bin/bash
echo "cloudera-scm-server status------------------------------------------------"
for i in cfp-acrm-cdh-1
do
echo ------------------- $i --------------
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-server status"
done
exit 0
设置脚本执行权限:
chmod +x status-scm-server
分发(选做):
# 使用root账户分发至其他节点
scp -r /bin/*-scm-server root@cfp-acrm-cdh-2:/bin/
scp -r /bin/*-scm-server root@cfp-acrm-cdh-3:/bin/
CM Agent启动脚本(start-scm-agent)
sudo su
cd /bin
vi start-scm-agent
脚本内容如下:
#!/bin/bash
echo "start cloudera-scm-agent-------------------------------------------------"
for i in cfp-acrm-cdh-1 cfp-acrm-cdh-2 cfp-acrm-cdh-3
do
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-agent start"
done
sleep 5s
echo "cloudera-scm-agent status------------------------------------------------"
for i in cfp-acrm-cdh-1 cfp-acrm-cdh-2 cfp-acrm-cdh-3
do
echo ------------------- $i --------------
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-agent status"
done
exit 0
设置脚本执行权限:
chmod +x start-scm-agent
CM Agent停止脚本(stop-scm-agent)
sudo su
cd /bin
vi stop-scm-agent
脚本内容如下:
#!/bin/bash
echo "stop cloudera-scm-agent-------------------------------------------------"
for i in cfp-acrm-cdh-1 cfp-acrm-cdh-2 cfp-acrm-cdh-3
do
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-agent stop"
done
sleep 5s
echo "cloudera-scm-agent status------------------------------------------------"
for i in cfp-acrm-cdh-1 cfp-acrm-cdh-2 cfp-acrm-cdh-3
do
echo ------------------- $i --------------
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-agent status"
done
exit 0
设置脚本执行权限:
chmod +x stop-scm-agent
CM Agent状态查看脚本(status-scm-agent)
sudo su
cd /bin
vi status-scm-agent
脚本内容如下:
#!/bin/bash
echo "cloudera-scm-agent status------------------------------------------------"
for i in cfp-acrm-cdh-1 cfp-acrm-cdh-2 cfp-acrm-cdh-3
do
echo ------------------- $i --------------
ssh $i "source /etc/profile;/opt/cm/cm-5.8.3/etc/init.d/cloudera-scm-agent status"
done
exit 0
设置脚本执行权限:
chmod +x status-scm-agent
分发(选做):
# 使用root账户分发至其他节点
scp -r /bin/*-scm-agent root@cfp-acrm-cdh-2:/bin/
scp -r /bin/*-scm-agent root@cfp-acrm-cdh-3:/bin/