[root@z01 bin]# cat hadoop.sh
#!/bin/bash
if(($#==0));then
echo "no args";
exit;
fi
echo $1 hadoop;
$1-dfs.sh;
$1-yarn.sh;
ssh z02 "source /etc/profile; yarn-daemon.sh $1 resourcemanager";
ssh z03 "source /etc/profile; yarn-daemon.sh $1 resourcemanager";
ssh z01 "source /etc/profile; mr-jobhistory-daemon.sh $1 historyserver";
[root@z01 bin]# cat zk.sh
#!/bin/sh
echo "start zookeeper server..."
if(($#==0));then
echo "don't have arguements";
exit;
fi
hosts="z01 z02 z03"
for host in $hosts
do
ssh $host "source /etc/profile; /opt/module/zookeeper-3.4.5-cdh5.3.6/bin/zkServer.sh $1"
done