Official answer丨The variables in the slow_query_log_file instance memory are inconsistent with the configuration file settings

Official answer | The variables in the slow_query_log_file instance memory are inconsistent with the settings in the configuration file.

The official answer column focuses on questions in the GreatSQL database and selects typical questions from official forums and discussion groups for in-depth answers. The content covers database installation and deployment, configuration optimization, troubleshooting, performance testing, etc.

In the article, we not only provide solutions, but also analyze the causes of the problems in depth with examples to improve readers' understanding of the GreatSQL database.

If you encounter difficult technical problems when managing and using the GreatSQL database and want to systematically learn and improve database skills, please read the official answer article. Not only can you find reliable solutions here, but you can also learn database optimization experience and ideas.

By reading the content of the official answers, you can comprehensively master the skills of GreatSQL database management and skillfully deal with various fault situations. Come and follow the official answer column and grow with us!


This question comes from the forum. The user’s database environment is roughly introduced as follows:

name Version
Operating system version BigCloud Enterprise Linux 8
Database version GreatSQL-8.0.32-25

User issues

The problem information provided by the user is as follows:

1. My.cnf configuration file slowly log file path related configuration:

slow_query_log_file = /data/GreatSQL/logs/slow.log

slow_query_log_file2. However, the variables found in the memory are inconsistent with the configuration.

mysqladmin var |grep slow_query_log_file
| slow_query_log_file  | /data/GreatSQL/logs/bclinux01.log.000001

Answer user questions

1. Why is the name of the slow log file generated on the disk (under the /data/GreatSQL directory) inconsistent with the variables queried in the memory and those set in the configuration file?

Raising a question: Have you ever modified the binlog configuration and modified slow_query_log_file by mistake?

This problem occurs when the configuration file is written asslow_query_log_file = /data/GreatSQL/logs/slow.log

show global variables like '%slow%';Display in memory/data/GreatSQL/logs/bclinux01.log

set global slow_query_log_file='/data/GreatSQL/logs/bclinux01.log'It can only be reproduced through SQL commands .

2. If you slow_query_log_file = /data/GreatSQL/logs/slow.logcomment out the configuration information in the configuration file, the file name on the disk is still bclinux01.log.000001

After commenting this parameter in the my.cnf configuration file slow_query_log_file = /data/GreatSQL/logs/slow.log, if the database instance is not restarted, set global slow_query_log_filethe parameters that have been modified before will not have any parameter variable impact; if the database instance is restarted, the slow log file name is updated to the host name-slow.log

The user asked why the slow log contains 0000001 and multiple slow.log.xxxxxx files are always generated. The reason is that the following parameters are configured. When the following parameters are configured, the database will poll to generate slow.log.xxxxxx files.

max_slowlog_size = [0 - 1073741824]
max_slowlog_files = [0 - 102400]
  • max_slowlog_size

When the size of the log reaches the set value, the server will poll the slow log. The default value is 0. If the size is limited and this feature is enabled, the server renames the slow log file to slow_query_log_file.000001

  • max_slowlog_files

This variable limits the total size of slow log files and is used together with max_slowlog_size

The server creates and adds slow logs until the upper limit of the range is reached. When the maximum is reached, the server creates a new slow log file with a higher sequence number and deletes the log file with the lowest sequence number to keep the total amount defined within the range.

Solve user problems

After passing set global slow_query_log_file = '/data/GreatSQL/slow.log'the settings, check the memory data again, and the display will be correct:

greatsql> show global variables like '%slow%';
| slow_query_log_file   | /data/GreatSQL/slow.log.000001 |

Enjoy GreatSQL :)

About GreatSQL

GreatSQL is a domestic independent open source database suitable for financial-level applications. It has many core features such as high performance, high reliability, high ease of use, and high security. It can be used as an optional replacement for MySQL or Percona Server and is used in online production environments. , completely free and compatible with MySQL or Percona Server.

Related links: GreatSQL Community Gitee GitHub Bilibili

GreatSQL Community:

image

Community reward suggestions and feedback: https://greatsql.cn/thread-54-1-1.html

Community blog prize-winning submission details: https://greatsql.cn/thread-100-1-1.html

(If you have any questions about the article or have unique insights, you can go to the official community website to ask or share them~)

Technical exchange group:

WeChat & QQ group:

QQ group: 533341697

WeChat group: Add GreatSQL Community Assistant (WeChat ID: wanlidbc) as a friend, and wait for the community assistant to add you to the group.

The pirated resources of "Qing Yu Nian 2" were uploaded to npm, causing npmmirror to have to suspend the unpkg service. Zhou Hongyi: There is not much time left for Google. I suggest that all products be open source. Please tell me, time.sleep(6) here plays a role. What does it do? Linus is the most active in "eating dog food"! The new iPad Pro uses 12GB of memory chips, but claims to have 8GB of memory. People’s Daily Online reviews office software’s matryoshka-style charging: Only by actively solving the “set” can we have a future. Flutter 3.22 and Dart 3.4 release a new development paradigm for Vue3, without the need for `ref/reactive `, no need for `ref.value` MySQL 8.4 LTS Chinese manual released: Help you master the new realm of database management Tongyi Qianwen GPT-4 level main model price reduced by 97%, 1 yuan and 2 million tokens
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/GreatSQL/blog/11184821