zookeeper启动脚本
启动脚本
#!/bin/sh
#zookeeper节点
zookeeperServers='192.168.221.102 192.168.221.103 192.168.221.104'
#启动所有zookeeper节点
for zoo in $zookeeperServers
do
ssh -T $zoo <<EOF
/usr/local/software/zookeeper/zookeeper-3.5.5/bin/zkServer.sh start
EOF
echo 从节点 $zoo 启动zookeeper...[ done ]
sleep 1
done
停止脚本
#!/bin/sh
#zookeeper节点
zookeeperServers='192.168.221.102 192.168.221.103 192.168.221.104'
#停止所有zookeeper节点
for zoo in $zookeeperServers
do
ssh -T $zoo <<EOF
/usr/local/software/zookeeper/zookeeper-3.5.5/bin/zkServer.sh stop
EOF
echo 从节点 $zoo 停止zookeeper...[ done ]
done
xsync的拷贝脚本
#!/bin/bash
#1 获取输入参数个数,如果没有参数,直接退出
pcount=$#
if((pcount==0)); then
echo no args;
exit;
fi
#2 获取文件名称
p1=$1
fname=`basename $p1`
echo fname=$fname
#3 获取上级目录到绝对路径
pdir=`cd -P $(dirname $p1); pwd`
echo pdir=$pdir
#4 获取当前用户名称
user=`whoami`
#5 循环
for((host=102; host<105; host++)); do
echo ------------------- hadoop$host --------------
rsync -rvl $pdir/$fname $user@hadoop$host:$pdir
done