Get the App
SLTechnology News&Howtos  ›  Database  › 

For example, an enterprise MySQL database cloud server needs to design a script.

Shulou Source: shulou.com Published: 2022-06-01 20:51:46 10月15日 Update

This article mainly introduces an example of an enterprise MySQL database cloud server needs to design a script, which involves things, learned from the theoretical knowledge, there are many books and literature for your reference, in terms of practical significance, accumulated years of practical experience can be shared with you.

Background: an enterprise MySQL database cloud server (innodb engine) needs to be fully implemented at zero o'clock on Saturday night, and incremental backups are used from Monday to Friday and Sunday. A script needs to be designed.

The script I designed is as follows. Please post it and welcome everyone to beat the brick.

#! / bin/bash

[- f / tmp/lock] & & exit 2

Touch / tmp/lock

[- S / data/3306/mysql.sock] | | exit 1

Today=$ (date +% w)

Yesterday=$ (date +% w-d-1day)

Fullback () {

Rm-fr / backup/bak$today/ & &\

/ usr/bin/innobackupex-user=root-password=123-socket=/data/3306/mysql.sock-no-timestamp-use-memory=32M / backup/bak$today

}

Increback () {

Rm-fr / backup/bak$today/ & &\

/ usr/bin/innobackupex-user=root-password=123-incremental--socket=/data/3306/mysql.sock-incremental-basedir=/backup/bak$yesterday-no-timestamp-use-memory=32M / backup/bak$today

}

If [$today-eq 6]

Then

Fullback

Else

Increback

Fi

Rm-f / tmp/lock

Use tools: xtrabackup, physical backup is fast and efficient

Scheduled tasks use crontab

00 * / bin/bash / server/scripts/bakup_sql.sh > / dev/null 2 > & 1

Read the above introduction an example of an enterprise MySQL database server needs to design a script, hoping to give you some help in practical application. Due to the limited space in this article, there will inevitably be deficiencies and areas that need to be supplemented. You can continue to pay attention to the industry information section and will update your industry news and knowledge regularly. If you need more professional answers, you can contact us on the official website for 24-hour pre-sales and after-sales to help you answer questions at any time.

Tags: Scripts designs enterprises data databases servers services backups knowledge industries solutions specialties things books tasks available in places increments years actual Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi macOS vpn Huawei MariaDB