Home Database Mysql Tutorial 如何远程清理Production上48组MySQL DB Server上面的过期失效的_MySQL

如何远程清理Production上48组MySQL DB Server上面的过期失效的_MySQL

Jun 01, 2016 pm 01:34 PM
control how clean up

bitsCN.com

如何远程清理Production上48组MySQL DB Server上面的过期失效的备份

 

如何远程清理48组MySQL DB Server上面的过期实效的备份!  刚开始想到一个个从control控制机器ssh进去,rm 掉,然后exit,再通过control机器ssh进去,再rm再exit,这样的话岂不是要操作48次ssh以及exit,48台还能接受,如果是480台,4800台呢,any way ?

 

 OK,我想到了,写一个shell脚本,在control机器上面远程执行ssh命令,不需要ssh进具体的单台db了,如下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 aaaaaaaaa007xxxxxx "sudo -u mysql du -sh /mysqlback/*";  

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

ssh aaaaaaaaa005xxxxxx "sudo -u mysql du -sh /mysqlback/*";  

ssh aaaaaaaaa004xxxxxx "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/*";这个指示最后check检查备份有没有被删除的脚本你可以将du -sh /mysqlback/*";换成rm -rf就变成了自己要清理文件的功能了。

2 我这里ssh是不带密码的,如果你的ssh还要带输入密码验证的话,请试下:ssh pass -p 'password' sshroot@xx.com "command"命令

 

run 这个clean脚本, 我这里ssh 进aaaaaaaaa001xxxxxx 是不需要密码的,而且因为进去db server还需要切换到mysql帐号,否则不能rm操作mysql用户组的文件。远程命令里面用了sudo -u mysql前缀。

 

bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to effectively clean junk and cache in win7 system How to effectively clean junk and cache in win7 system Dec 27, 2023 pm 07:53 PM

When we use Win7 computers on a daily basis, a bunch of system cache garbage often accumulates over time, which requires us to clean it manually. So how to clean the garbage and cache of each system disk? Let’s take a look. How to clean up junk and cache in Windows 7 1. Find the disk you want to clean, right-click and select Properties. 2. The computer will pop up the detailed properties of the hard disk. Here we continue to click "Disk Cleanup" 3. After clicking, we select the option you want to clean here and click Clean.

Where to check win11 disk cleanup Where to check win11 disk cleanup Jun 29, 2023 pm 09:25 PM

Where can I check disk cleanup in win11? As the system is used for a long time, there will often be more than ten gigabytes or more useless junk files in the c drive or other computer disks. At this time, using the disk cleanup function that comes with win11 can help us quickly clean up these useless files. However, many users do not know where the disk cleanup function of win11 is and how to operate it. Today, the editor will bring you the steps to check the junk cleaning function that comes with Win 11, and let me explain it to you. Steps to check win11’s built-in junk cleaning function 1. First, press the [Win] key on the keyboard, or click [Start Menu] on the taskbar, and then select [Settings] under pinned applications; 2. The current path is: System >storage,

Are administrator rights required: win10 required to clean C drive Are administrator rights required: win10 required to clean C drive Jan 12, 2024 pm 03:45 PM

Many users have recently encountered the problem that when cleaning files in the C drive, a pop-up window will appear, indicating that permissions need to be granted to delete them. Click to grant permissions, but they still cannot be deleted. We only need to make a slight modification in the group policy. It can be solved. Does cleaning up the C drive in Win10 require administrator rights? Answer: Cleaning up the C drive in Win10 requires administrator rights. 1. Enter the command using the win+r shortcut key in the pop-up window, and press the Enter key. 2. Click to open----. 3. Then, on this page, change it to. 4. Similarly, set the options. 5. Finally, save the settings, close all pages, restart the computer, and then clean the C drive directly.

Nginx cache cleaning configuration to keep website content updated Nginx cache cleaning configuration to keep website content updated Jul 05, 2023 pm 10:28 PM

Nginx cache cleaning configuration to keep website content updated When building a website, we often use Nginx as a reverse proxy server to speed up website access and cache static files. However, when we update website content, we need to clear Nginx's cache in time to keep users accessing the latest content. This article will introduce how to configure Nginx cache cleaning to keep website content updated. 1. Configure the cache path. First, we need to configure the cache path of Nginx. Open Nginx configuration

How to clear cache data of QQ Browser How to clear cache data of QQ Browser Jan 29, 2024 pm 06:03 PM

How to clear QQ browser cache data? QQ Browser is a search software with a large number of users. Its excellent speed and rich functions make many users use this software regularly. We all know that after using software for a long time, it will leave a lot of cache files and other junk information. If not cleaned up in time, it will slow down the browser's response speed. At this time, we need to clean it regularly and in time. After clearing the cache, it will be more convenient to use and the response speed will be better. Let’s take a look at how to clear the cache when using QQ Browser! QQ Browser cache data cleaning method and steps are introduced. Step 1: Open QQ Browser and click the "Menu" bar in the upper right corner of the main page. Step 2: In the drop-down menu bar option, click Play

Linux server log is too large, how to solve it? Linux server log is too large, how to solve it? Jun 29, 2023 pm 11:09 PM

Common problems of too-large log files on Linux servers and their solutions. With the rapid development of the Internet and the widespread use of servers, it has become a common problem that server log files are getting larger and larger. A large amount of log data not only takes up disk space, but may also affect the performance and operational stability of the server. This article will discuss the common problem of too large log files on Linux servers and provide some solutions. 1. Common log files on Linux servers. Common log files include system logs, application logs, We

Introduction to the tutorial of cleaning and deleting hiberfil files in win10 Introduction to the tutorial of cleaning and deleting hiberfil files in win10 Mar 28, 2024 pm 03:16 PM

Many win10 users can see the hiberfil.sys file in the C drive, and this file often occupies a large amount of the system's C drive. Therefore, many users who do not have enough C drive want to delete this file. Please see the introduction below for details. . 1. View the hibernation file and remove the check mark in front of the following mark in the pop-up window. 2. Check the c drive again and find several large files, among which hiberfil.sys is the hibernation file. Open the cmd command window here. Some computers may not have administrator rights. You can find the cmd command directly in the system directory and right-click to execute it as an administrator. 3. Entering powercfg-hoff in the command window will automatically turn off the hibernation function, and the hibernation file will also automatically

How to clean up win11 hibernation files How to clean up win11 hibernation files Jun 29, 2023 am 11:35 AM

How to clean win11 hibernation files? When many friends clean up the disk of their win11 computer, they find that new junk files are generated every time they are restarted. This is the computer's hibernation file. These hibernation files are automatically generated by the system. After we clean up these hibernation files, we can reduce a very large burden on the disk. However, many friends do not know how to clean up hibernation files. Below, the editor will bring you win11 hibernation. File cleaning tutorial. Win11 hibernation file cleaning tutorial 1. Find the CMD program on the C drive. The path is as follows: C: WindowsSystem32 and then right-click: Run as administrator. 2. Enter the command: powercfg-hoff and press Enter. You will see the following:

See all articles