大家好,欢迎来到IT知识分享网。
自定义环境变量
/etc/profile.d/my_env.sh
# JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_171
export JRE_HOME=$JAVA_HOME/jre
export ClASSPATH=.:$JAVA_HOME:$JRE_HOME/lib:$CLASSPATH
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
# KAFKA_HOME
export PATH=$PATH:/opt/module/kafka/bin
#ZOOKEEPER_HOME
export PATH=$PATH:/opt/module/zookeeper/bin
一、文件分发脚本
/usr/local/bin/xsync
#!/bin/bash
pdir=$(cd -P $(dirname $1); pwd)
for i in 22 23;
do
scp -r $1 root@192.168.1.$i:$pdir/;
done
示例:
xsync Copt/software/jdk-8u171-linux-x64.tar.gz
二、远程执行命令脚本
/usr/local/bin/xcall
#!/bin/bash
for i in kafka-21 kafka-22 kafka-23
do
echo "------------- $i \"$1\" ------------------"
ssh $i "$1"
done
示例:
xcall "jps -l"
三、zookeeper启停脚本
/usr/local/bin/zk
#!/bin/bash
case $1 in
"start") {
for i in kafka-21 kafka-22 kafka-23
do
echo "---------------------- start $i ------------"
ssh $i "/opt/module/zookeeper/bin/zkServer.sh start /opt/module/zookeeper/conf/zoo.cfg"
done
};;
"stop") {
for i in kafka-21 kafka-22 kafka-23
do
echo "------------------ stop $i -----------------"
ssh $i "/opt/module/zookeeper/bin/zkServer.sh stop"
done
};;
"status") {
for i in kafka-21 kafka-22 kafka-23
do
echo "----------------- status $i ------------------"
ssh $i "/opt/module/zookeeper/bin/zkServer.sh status"
done
};;
esac
四、kafka启停脚本
/usr/local/bin/kf
#!/bin/bash
case $1 in
"start") {
for i in kafka-21 kafka-22 kafka-23
do
echo "---------------------- start $i ------------"
ssh $i "/opt/module/kafka/bin/kafka-server-start.sh -daemon /opt/module/kafka/config/server.properties"
done
};;
"stop") {
for i in kafka-21 kafka-22 kafka-23
do
echo "------------------ stop $i -----------------"
ssh $i "/opt/module/kafka/bin/kafka-server-stop.sh"
done
};;
esac
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/21461.html