In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1: binary log
Binary logging records all DDL (data definition language) and DML (data manipulation language) statements, but does not record statements including data queries. Statement is saved in the form of "event", which describes the process of changing the data, and this log plays an extremely important role in data recovery in the event of a disaster.
2: location and format of the log
When started with the-log-bin [= file_name] option, mysqld writes the SQL command containing all updated data to the log file. If no file_ name is given, the default name is hostname followed by _ bin. If a file name is given, but no road strength is included, the file is written to the directory specified by parameter DATADIR (data directory) by default.
3: log reading
Since logs are stored in binary format and cannot be read directly, you need to use the mysqlbinlog tool to view them. The syntax is as follows:
# mysqlbinlog log_file
4: delete the log
For the busy OLTP system, due to the large amount of production logs every day, if these logs are not cleaned for a long time, it will bring a great waste of disk space. Therefore, deleting logs regularly is an important part of DBA's maintenance of MySQL database. Here are several common ways to delete logs.
(1):
Execute the "reset master;" command, which deletes all binary logs, with the new log number starting at "000001", as follows
Mysql > reset master
(2):
Execute the "Purge master logs to 'mysql-bin.*'" command, which deletes all logs before the "*" number, and deletes all logs numbered before "mysql-bin.000001" in the following
Mysql > purge master logs to 'mysql-bin.000015
From the results, it is found that all logs before number 000015 have been deleted.
(3):
Execute the "purge master logs before 'yyyy-mm-dd hh34:min:ss'" command, which deletes all logs generated before the date "yyyy-mm-dd hh34:mi:ss". All logs with dates before "2010-05-22 01:00:00" are deleted in the following
Mysql > purge master logs before '2010-05-22 01purse 0000mm'
(4):
Set the parameter-expire_logs_days=# (days), which means to set the number of days for the log to expire. After the specified number of days, the log will be automatically deleted, which will help reduce the workload of DBA to manage logs.
# vi / etc/my.cnf [mysqld]-- expire_logs_days=3
In this way, the logs of 3 days ago will be deleted and the system will delete them automatically.
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.