当前位置:网站首页>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
边栏推荐
- Cannot activate inspection type when SAP retail uses transaction code mm41 to create commodity master data?
- TCP BBR as rate based
- Controlling volume mixer
- Streaming a large file using PHP
- Analysis of China's food cold chain logistics, output of quick-frozen noodles and rice products and operation of major enterprises in 2021 [figure]
- 北京网上开股票账户安全吗?
- VMware virtual machine prompt: the virtual device ide1:0 cannot be connected because there is no corresponding device on the host.
- What is VLAN
- Understand what ICMP Protocol is
- How two hosts in different network segments directly connected communicate
猜你喜欢
What is cloud primordial?
2022 AI trend 8 forecast!
DataX tutorial (10) - hot plug principle of dataX plug-in
Cs4344/ht5010 stereo d/a digital to analog converter
爱情️终结者
The five minute demonstration "teaches" actors to speak foreign languages and can seamlessly switch languages. This AI dubbing company has just received a round a financing of 20million US dollars
Ht8513 single lithium battery power supply with built-in Dynamic Synchronous Boost 5W mono audio power amplifier IC solution
[200 opencv routines of youcans] 104 Motion blur degradation model
JSON. toJSONString(object, SerializerFeature.WriteMapNullValue); Second parameter action
VMware virtual machine prompt: the virtual device ide1:0 cannot be connected because there is no corresponding device on the host.
随机推荐
What is VLAN
Microsoft issued a document to celebrate Net 20th anniversary!
Message queue table structure for storing message data
Understand what MTU is
mysql 表查询json数据
CTFHub-Web-信息泄露-目录遍历
爱情️终结者
2022 biological fermentation Exhibition (Jinan), which is a must read before the exhibition. The most comprehensive exhibition strategy will take you around the "fermentation circle"
How to realize the stable output of 3.3v/3.6v (1.2-5v) voltage of lithium battery by using the voltage rise and fall chip cs5517
Your local changes to the following files would be overwritten by merge: .vs/slnx.sqlite
Ht513 I2S input 2.8W mono class D audio power amplifier IC
ARM processor operating mode
レレ / 蕾蕾
In depth inventory: 23 vscode plug-in artifacts that improve development efficiency and aesthetics
What is cloud primordial?
Acwing2013. three lines
JD 8 fleet stores search history, deletes history, clears history (not finished)
Report on development status and investment strategy recommendations of global and Chinese graphite polystyrene board industry 2022-2028
Analysis of China's food cold chain logistics, output of quick-frozen noodles and rice products and operation of major enterprises in 2021 [figure]
Leetcode 2163. Minimum difference of sum after element deletion