In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Linux how to use iptables to achieve backup and recovery operations, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
1. Iptables configuration file location: / etc/sysconfig/iptables
Master computer: that is, the machine in the operation of the business; backup machine: that is, when the master computer fails, it switches to the backup machine.
-- the operation on the main control computer
2. Set up a directory:
The code is as follows:
Mkdir-p / bak/iptables/
Mkdir / root/script/
3. Create a script in the / root/script/ directory:
The code is as follows:
Vi backup.sh
Cp / etc/sysconfig/iptables / bak/iptables/iptables_$ (date +% Y%m%d%H)
4. Customize automatic tasks:
The code is as follows:
Crontab-e
* / 10 * / usr/sbin/ntpdate 210.72.145.44
10 * sh / root/script/backup.sh
-- operate on the backup machine
5. Set up a directory:
The code is as follows:
Mkdir-p / bak/iptables/ {lt,yd} # lt directory put Unicom jump backup, yd directory put mobile jump backup
Mkdir / root/script/
6. Create a script in the / root/script/ directory:
The code is as follows:
Vi scp_lt.sh
#! / usr/bin/expect-f
Set password gst
Spawn scp-P 22 root@202.105.135.52:/etc/sysconfig/iptables / bak/iptables/lt/iptables
Set timeout 300
Expect "root@202.105.135.52's password:"
Set timeout 300
Send "$passwordr"
Set timeout 300
Send "exitr"
Expect eof
7. Create a script in the / root/script/ directory:
The code is as follows:
Vi scp_yd.sh
#! / usr/bin/expect-f
Set password gst
Spawn scp-P 22 root@183.62.178.91:/etc/sysconfig/iptables / bak/iptables/yd/iptables
Set timeout 300
Expect "root@183.62.178.91's password:"
Set timeout 300
Send "$passwordr"
Set timeout 300
Send "exitr"
Expect eof
8. Create a script in the / root/script/ directory:
The code is as follows:
Vi backup.sh
Expect / root/script/scp_lt.sh
Expect / root/script/scp_yd.sh
Sed-I's Universe 202.105.135.52 / bak/iptables/lt/iptables 183.62.178.85
Sed-I's Placement 58.251.49.18 Plus 58.250.56.154Compact g'/ bak/iptables/lt/iptables
Cp / bak/iptables/lt/iptables / etc/sysconfig/iptables
/ etc/init.d/iptables restart
/ etc/init.d/iptables save
Mv / bak/iptables/lt/iptables / bak/iptables/lt/iptables_$ (date +% Y%m%d%H)
Mv / bak/iptables/yd/iptables / bak/iptables/yd/iptables_$ (date +% Y%m%d%H)
9. Note that you need to log in remotely once on the backup machine to get the public key of RSA, and then you don't have to log in like this, otherwise the script will execute an error
10. Customize automatic tasks:
The code is as follows:
Crontab-e
* / 10 * / usr/sbin/ntpdate 210.72.145.44
20 * sh / root/script/backup.sh
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 276
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.