Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

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: 0

*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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report