Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux environment Duplex (multi-machine) automatic mutual backup scheme     - ELKstack log analysis platform (Server)

- Vim useful plugin: vundle (Linux)

- Linux upgrade GCC 4.8.1 clear and concise tutorials (Ubuntu 12.04 64-bit version as an example) (Linux)

- Redis-- persistence articles (Database)

- The Zabbix2.4.5 source compiler installation under Ubuntu 14.04 (Server)

- Help you enhance Python programming languages 27 (Programming)

- ThinkPad X201i installation notes Debian 7.5 (Linux)

- MySQL event table to achieve timing build a small note (Database)

- Grub2 Boots the openSUSE installation image (Linux)

- systemctl Command Complete Guide (Linux)

- Sort search algorithm Java - application examples with recursive dichotomy (Programming)

- How to implement Linux host Telnet SSH password Free (Server)

- Oracle Automatic Diagnostic Repository (Automatic Diagnostic Repository, ADR) (Database)

- The Java development environment to build under Ubuntu 14.04 (Linux)

- MySQL flip-flop (Database)

- Modify Linux terminal prompt path length (Linux)

- Terminal fun: 6 interesting Linux command-line tools (Linux)

- Ubuntu study notes and related problem solving (Linux)

- Linux installed xdotool simulate keystrokes and mouse movements (Linux)

- Linux kernel RCU (Read Copy Update) lock Brief (Linux)

 
         
  Linux environment Duplex (multi-machine) automatic mutual backup scheme
     
  Add Date : 2018-11-21      
         
         
         
  Problem: Our company has two Linux servers, each with only one hard disk. So the question is especially important backup. We equipped with mysql database. Of course, but also to solve the problem mysql backups.

Purpose: host machine (all backups are in their final stay on backup) ship machine (host machine to save the backup)

Method: through shell scripts, packaged document to back up. Then operate via ftp download, upload complete solutions.

Both machines have the script in the root crontab by each machine timer.

Recommendation host every morning 3:00

Recommendation ship every morning 6:00

be careful:

The best time of two server systems differ not more than one hour.

This script is a weekly 6 weeks to perform the backup. Of course, you can also modify a monthly or daily backups.

Of course, you can also be modified to an incremental backup script.

Specific script:

The following is the host machine script

# ////////////// Host machine script ///////////////

#! / Bin / sh

HOST = "abc.com"

USER = "backup_use" #ship user machine backup_use

PASSWORD = "backup_use" #ship machine corresponding to the user's password

BACKUPDIR = "/ home / backup_use / ship" #host machine backup_use user directory

BACKUPDIR2 = "/ home / backup_use / host" #host machine backup_use user directory

MYSQLPASS = "abc" #ship machine mysql root user password

PATH = / usr / local / bin: / usr / bin: / bin: / usr / local / nusphere / mysql / bin

DOW = `date +% a`

DM = `date +% Y% b% d`

FILE1 = ship-virtual- $ DM.tar.gz

FILE2 = ship-mysqldata- $ DM.tar.gz

FILE3 = ship-szeasy- $ DM.tar.gz

FILE4 = ship-other- $ DM.tar.gz

#

FIL1 = $ BACKUPDIR2 / host-main- $ DM.tar.gz

FIL2 = $ BACKUPDIR2 / host-mysqldata- $ DM.tar.gz

FIL3 = $ BACKUPDIR2 / host-other- $ DM.tar.gz

#

DIRECTORIE1 = "/ www / home / jjd" directory to back up # 1

DIRECTORIE2 = "/ etc / var / named / usr / local / nusphere / apache / conf" directory to back up # 2

#

if [$ DOW = "Sat"]; then # full backup every Saturday

tar -zcpf $ FIL1 $ DIRECTORIE1

tar -zcpf $ FIL3 $ DIRECTORIE2

mysqldump --all-databases -q -uroot -p $ MYSQLPASS | gzip> $ FIL2

ftp -i -n < $ BACKUPDIR / $ COMPUTER-mysqldata- $ DM.tar.gz

fi

################################################## ######################
     
         
         
         
  More:      
 
- Linux POST fstab configuration file read-only variable can not be modified problem (Linux)
- Sort sql MySQL 5.6 upgrade slow Cause Analysis (Database)
- Multipath configuration under Linux (Linux)
- Oracle database online redo logs are several methods of recovery of deleted (Database)
- How to download GOG games in Linux command line (Linux)
- Oracle JDK installation under Ubuntu Linux (Linux)
- To setup a ftp server under Linux (Server)
- Android development environment to build under Fedora 13 (Linux)
- Linux nice program origin of the name (Linux)
- Download Google Android source code under Ubuntu 4.4 (Linux)
- ActiveMQ configuration Getting Started Tutorial (Server)
- Linux find command usage practices (Linux)
- Android memory optimization of the disk cache (Linux)
- Linux itself disguised illusion strengthen security (Linux)
- DupeGuru- find and remove duplicate files (Linux)
- Linux System Administrator Network Security Experience (Linux)
- CentOS6 5 source compiler installation Hadoop2.5.1 (Server)
- Python class of operator overloading (Programming)
- Security: set limits on password (Linux)
- Eight kinds of techniques to solve hard problems Linux (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.