同步脚本
#!/bin/bash
if [ $# -lt 1 ]
then
echo Not Enough Arguement!
exit;
fi
for file in $@
do
pdir=$(cd -P $(dirname $file); pwd)
fname=$(basename $file)
for host in mz-hadoop-01 mz-hadoop-02 mz-hadoop-03
do
echo ==================== $host ====================
scp -r $pdir/$fname $USER@$host:$pdir
done
done
xcall.sh
#! /bin/bash
for i in mz-hadoop-01 mz-hadoop-02 mz-hadoop-03
do
echo -------------- $i ---------------
ssh $i "source /etc/profile;$* | grep -v Jps"
done
kafka集群脚本
#! /bin/bash
if [ $1 ];
then
args=$1
else
echo 'need one args start or stop'
exit
fi
if [[ "$args" = "start" ]]
then
for i in mz-hadoop-01 mz-hadoop-02 mz-hadoop-03
do
echo --------------start kafka cluster $i ---------------
ssh $i '/opt/kafka_2.11-2.2.1/bin/kafka-server-start.sh -daemon /opt/kafka_2.11-2.2.1/config/server.properties'
done
elif [[ "$args" = "stop" ]]
then
for i in mz-hadoop-01 mz-hadoop-02 mz-hadoop-03
do
echo --------------stop kafka cluster $i ---------------
ssh $i '/opt/kafka_2.11-2.2.1/bin/kafka-server-stop.sh stop'
done
else echo "illegal argsments exception"
fi