In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
#! / bin/bash
# sadoc.blog.51cto.com
# back up zabbix database without backing up monitoring historical data
HOST=127.0.0.1
SQL_PORT=3306
SQL_USER=zabbix
SQL_PASS=123456
DATABASE_NAME=zabbix
DUMP_PATH=/backup/mysql_backup
DATE=$ (date'+% Ymuri% mmurf% dvv% HRV% MRV% S')
DATED=$ (date'+% Ymuri% mmi% d')
[- d ${DUMP_PATH}] | | mkdir-p ${DUMP_PATH}
Cd ${DUMP_PATH}
[- d logs] | | mkdir-p logs
[- d ${DATED}] | | mkdir-p ${DATED}
Cd ${DATED}
ALL_TABLES=$ (mysql-u$ {SQL_USER}-p$ {SQL_PASS}-P$ {SQL_PORT}-h$ {HOST} ${DATABASE_NAME}-e "show tables" |\
Egrep-v "(Tables_in_zabbix | trends* | acknowledges | alerts | auditlog | events | service_alarms)")
For TABLE_NAME in ${ALL_TABLES}
Do
Mysqldump-u$ {SQL_USER}-p$ {SQL_PASS}-P$ {SQL_PORT}-h$ {HOST} ${DATABASE_NAME} ${TABLE_NAME} > ${TABLE_NAME} .sql
Sleep 10
Done
[$? = 0] & & echo "${DATE}: Backup zabbix_mysql succeed" > > ${DUMP_PATH} / logs/zabbix_dump.log
[$?! = 0] & & echo "${DATE}: Backup zabbix_mysql not succeed" > > ${DUMP_PATH} / logs/zabbix_dump_error.log
Cd ${DUMP_PATH} /
Rm-rf $(date +% Y%m%d-- date='7 days ago')
Exit 0
Import the database below:
Delete database
Drop database zabbix
Create a database
Create database zabbix character set utf8 collate utf8_bin
Use zabbix
Source / backup/mysql_backup/xxx.sql
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.