chef-cookbooks icon indicating copy to clipboard operation
chef-cookbooks copied to clipboard

[mysql] Slow Query Log disable

Open aaronsegura opened this issue 10 years ago • 2 comments

Attempting to disable slow query logs does not behave as expected. Added to the environment file a few different ways...

"mysql" : { "server": { "slow_query_log" : (0|false|"0"|"false") "log_slow_queries": (0|false|"0"|"false") } }

Chef will run and update the /etc/mysql/my.cnf file, but not in any way that actually disables mysql slow query logging. You also need to restart mysql to make it see the changes. The [reload] during the chef-client run is not enough.

I found the rpc-support cookbook has this already in it @ replication_fix.rb:

node.override["mysql"]["server"]["slow_query_log"] = false

...but...

root@577875-controller02:~# mysql -e "show global variables like '%slow%'" +---------------------+---------------------------------------------+ | Variable_name | Value | +---------------------+---------------------------------------------+ | log_slow_queries | ON | | slow_launch_time | 2 | | slow_query_log | ON | | slow_query_log_file | /var/lib/mysql/577875-controller02-slow.log | +---------------------+---------------------------------------------+

(╯° °)╯︵ ┻━┻)

aaronsegura avatar Jun 27 '14 21:06 aaronsegura

@toxick What ended up in the my.cnf that was templated by chef?

claco avatar Jun 27 '14 21:06 claco

The short answer is, the upstream mysql cookbook doesn't get it right, even the one we use in master and 4.2.3rc.

https://github.com/opscode-cookbooks/mysql/blob/b5072e6ae3bd81b0f6ebec8749f2c2d781271ed9/templates/default/deprecated/my.cnf.erb#L149

The else block should be slow_query_log = 0 and log_slow_queries is long since deprecated and ignored.

Using a newer mysql cookbook brings its own set of issues, so not sure how this will get tackled at the moment.

claco avatar Jun 27 '14 22:06 claco