How to remotely clean up expired MySQL on 48 sets of MySQLDBServer in Production

Source: Internet
Author: User
How to remotely clean up expired backup bitsCN.com on 48 sets of MySQLDBServer in Production

How to remotely clean up expired backups on 48 MySQL DB servers in Production

How to remotely clean up expired backups on 48 groups of MySQL DB servers! At first, I thought of entering ssh from the control machine one by one, rm drop, then exit, and then ssh through the control machine, and rm then exit. in this case, I would not need to perform ssh and exit 48 times, 48 servers are acceptable. what if there are 480 and 4800 servers? any way?

OK, I thought of it. write a shell script and remotely execute the ssh command on the control machine. you do not need to ssh to a specific single database, as shown in the following figure: clean. sh

[Html]

Ssh aaaaaaaaa048xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa047xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa046xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa045xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa044xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa043xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa042xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa041xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa040xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa039xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa038xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa037xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa036xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa035xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa034xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa033xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa032xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa031xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa030xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa029xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa028xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa027xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa026xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa025xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa024xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa023xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa022xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa021xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa020xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa019xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa018xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa017xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa016xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa015xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa014xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa013xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa012xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa011xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa010xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa009xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa008xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaa007xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa006xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaa005xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaa004xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa003xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa002xxxxxx "sudo-u mysql du-sh/mysqlback /*";

Ssh aaaaaaaaa001xxxxxx "sudo-u mysql du-sh/mysqlback /*";

PS:

1 ssh aaaaaaaaa001xxxxxx "sudo-u mysql du-sh/mysqlback/*"; this instructs you to check whether the backup has been deleted. you can check du-sh/mysqlback /*"; if you change to rm-rf, the file cleanup function is enabled.

2 Here I ssh without a password, if your ssh also need to enter a password for verification, please try: ssh pass-p 'password' sshroot@xx.com "command" command

Run the clean script. here, ssh to aaaaaaaaaaa001xxxxxx does not require a password, and the database server also needs to switch to the mysql account. otherwise, rm cannot operate the files of the mysql User Group. Sudo-u mysql prefix is used in the remote command.

BitsCN.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.