脚本

同步脚本

#!/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



 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值