In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Our website is going to go to the cloud recently, and we need to migrate the database. Among them, a business that generates website viewing logs generates a table every day, and the amount of data is about 3 million. At present, there are nearly 3 million days of data in the database, that is, 500 tables. The naming rules are as follows: MariaDB [log] > show tables. | | pvlogs_20170615 | | pvlogs_20170616 | | pvlogs_20170617 | | pvlogs_20170619 | | pvlogs_20170620 | | pvlogs_20170621 | | pvlogs_20170622 | | pvlogs_20170623 | now I am asked to dump all these tables first, and one mysqldump at a time. This is absolutely impossible, so I thought of using the shell script to complete it. | The details are as follows: [root@S143 ~] # cat mysqldumplog.sh #! / bin/bash datenum= `date +% Y%m%d-d '498 days ago' `date +% Y% m% d`while [$datenum-lt $nowdate] do mysqldump-uroot-p * log pvlogs_$datenum | gzip > / backup_mysql/mysql_143/log/pvlogs_$datenum.sql Datenum= `date-d "$datenum 1 days" + "% Y%m%d" `done Note: 1:date +% Y%m%d-d '498 days ago' takes out the date 498 days ago, and 2:date-d "$datenum 1 days" + "% Y%m%d" adds one day to the specified date. The script is simple, but it makes sense for people who are new to linux shell.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.