当前位置:网站首页>Common cluster scripts
Common cluster scripts
2022-06-25 06:41:00 【BigData_ LYT】
Clusters often use group scripts
Take three nodes as an example
First of all to enter /root/bin Under the table of contents
cd /root/bin
View all nodes java process (jpsall)
establish jpsal file
vim jpsall
Enter the following
#!/bin/bash
for host in master node1 node2
do
echo =============== $host ===============
ssh $host jps
done
to jpsall File permissions
chmod 777 jpsall
Run with the following command
jasall
Restart all nodes (reboot.sh)
establish reboot.sh file
vim reboot.sh
Enter the following
#!/bin/bash
for i in node2 node1 master
do
echo ============== $i restart =============
ssh $i "sudo reboot"
sleep 1s;
done
to reboot.sh File permissions
chmod 777 reboot.sh
Run with the following command
reboot.sh
Close all nodes (shutdown.sh)
establish shutdown.sh file
vim shutdown.sh
Enter the following
#!/bin/bash
for i in node2 node1 master
do
echo ============= $i To turn it off =============
ssh $i "sudo shutdown -h now"
sleep 1s;
done
to shutdown.sh File permissions
chmod 777 shutdown.sh
Run with the following command
shutdown.sh
Synchronize files to other nodes (xsync)
establish xsync file
vim xsync
Enter the following
#!/bin/bash
#1. Judge the number of parameters
if [ $# -lt 1 ]
then
echo Not Enough Arguement!
exit;
fi
#2. Traverse all machines in the cluster
for host in master node1 node2
do
echo ==================== $host ====================
#3. Traverse all directories , Send... One by one
for file in [email protected]
do
#4. Judge whether the file exists
if [ -e $file ]
then
#5. Get parent directory
pdir=$(cd -P $(dirname $file); pwd)
#6. Get the name of the current file
fname=$(basename $file)
ssh $host "mkdir -p $pdir"
rsync -av $pdir/$fname $host:$pdir
else
echo $file does not exists!
fi
done
done
to xsync File permissions
chmod 777 xsync
Run with the following command
xsync File path
ZooKeeper Cluster startup 、 Off and status (zk.sh)
establish zk.sh file
vim zk.sh
Enter the following
#!/bin/bash
if [ $# -lt 1 ]
then
echo "NO Args Input Error!!!"
exit
fi
case $1 in
"start") {
for i in master node1 node2
do
echo ============= zookeeper $i start-up =============
ssh $i "source /etc/profile;/usr/local/soft/zookeeper-3.4.6/bin/zkServer.sh start"
done
}
;;
"stop") {
for i in master node1 node2
do
echo ============= zookeeper $i stop it =============
ssh $i "source /etc/profile;/usr/local/soft/zookeeper-3.4.6/bin/zkServer.sh stop"
done
}
;;
"status") {
for i in master node1 node2
do
echo ============= zookeeper $i state =============
ssh $i "source /etc/profile;/usr/local/soft/zookeeper-3.4.6/bin/zkServer.sh status"
done
}
;;
*)
echo "Input args Error!!"
;;
esac
to zk.sh File permissions
chmod 777 zk.sh
Run with the following command
zk.sh start
zk.sh status
zk.sh stop
kafka Startup and shutdown of cluster (kk.sh)
establish kk.sh file
vim kk.sh
Enter the following
#!/bin/bash
case $1 in
"start"){
for i in master node1 node2
do
echo ========$i start-up kafka========
ssh $i "source /etc/profile;/usr/local/soft/kafka_2.11-1.0.0/bin/kafka-server-start.sh -daemon /usr/local/soft/kafka_2.11-1.0.0/config/server.properties"
done
};;
"stop"){
for i in master node1 node2
do
echo ========$i stop it kafka========
ssh $i "source /etc/profile;/usr/local/soft/kafka_2.11-1.0.0/bin/kafka-server-stop.sh stop"
done
};;
esac
to kk.sh File permissions
chmod 777 kk.sh
Run with the following command
kk.sh start
kk.sh stop
边栏推荐
- Cs8683 (120W mono class D power amplifier IC)
- joda.time获取日期总结
- 【ROS2】为什么要使用ROS2?《ROS2系统特性介绍》
- Arm register (cortex-a), coprocessor and pipeline
- R & D thinking 07 - embedded intelligent product safety certification required
- Sophomores majoring in mechanics build a manipulator by hand -- full of compromise
- Cs4344/ht5010 stereo d/a digital to analog converter
- 原子Alpha开发板--SD卡和emmc烧录工具
- Why can't GC () free memory- Why does gc() not free memory?
- JSON. toJSONString(object, SerializerFeature.WriteMapNullValue); Second parameter action
猜你喜欢

From file system to distributed file system

Flask 的入门级使用

Understand what MTU is

Ht513 I2S input 2.8W mono class D audio power amplifier IC

How to realize hierarchical management of application and hardware in embedded projects

【ROS2】为什么要使用ROS2?《ROS2系统特性介绍》

@Detailed explanation of valid annotation usage

After unplugging the network cable, does the original TCP connection still exist?

Wan Yin revealed that he was rejected by MIT in this way: "the department doesn't like you". He confronted the principal and realized

JS dynamic table creation
随机推荐
Zero foundation wants to learn web security, how to get started?
JSON. toJSONString(object, SerializerFeature.WriteMapNullValue); Second parameter action
In depth inventory: 23 vscode plug-in artifacts that improve development efficiency and aesthetics
Preliminary practice of niuke.com (summary)
ASP. Net core - Safety of asynclocal in asp NET Core
How do I turn off word wrap in iterm2- How to turn off word wrap in iTerm2?
原子Alpha开发板--SD卡和emmc烧录工具
十大券商公司哪个佣金最低,最安全可靠?有知道的吗
BigDecimal. Summary of setscale usage
cos(a-b)=cosa*cosb+sina*sinb的推导过程
DataX tutorial (10) - hot plug principle of dataX plug-in
Streaming a large file using PHP
Are these old system codes written by pigs?
Explain @builder usage
百度地图——入门教程
Single lithium battery 3.7V power supply 2x12w stereo boost audio power amplifier IC combination solution
Sophomores majoring in mechanics build a manipulator by hand -- full of compromise
Power representation in go language
You can see the classification of SQL injection. SQL injection point /sql injection type /sql injection has several /sql injection point classifications
keil debug查看变量提示not in scope