cPanel constantly appends 3 distinct values in modified /etc/my.cnf

fevangelou

Member
Oct 10, 2010
24
5
53
Athens, Greece
cPanel Access Level
DataCenter Provider
Twitter
I've assembled (in collaboration with Percona in the past) an optimized /etc/my.cnf for cPanel servers:
Optimized MySQL configuration for cPanel servers (updated July 2017)
gist.github.com/fevangelou/0da9941e67a9c9bb2596

It's one that a lot of cPanel admins use (most find it through the optimization guides I've written in the Engintron Wiki).

What I've noticed (and also had reports about) is that cPanel will constantly append 3 distinct variables under the [mysqld] section (in my.cnf) EVEN if these values are already set:

Code:
innodb_buffer_pool_size=134217728
max_allowed_packet=268435456
open_files_limit=10000
In my optimized my.cnf file I use hyphens instead of underscores. Even if I change that preference to use underscores, if I recall correctly at least "max_allowed_packet" will re-appear if you have a saner value set. So a regex is probably run in that file by cPanel and these 3 variables can be appended when you have a modified my.cnf.

This really doesn't make any sense for 2 reasons.
a) Why constantly patch my.cnf? If an admin has changed it, they probably know what they are doing.
b) Even if they don't, the variables being appended are literally "whatever". innodb_buffer_pool_size is basically set to 128M which is pretty low, open_files_limit can be safely set at least 3 times that value & max_allowed_packet is set to 256M which is too high.

I'd love some feedback/insights on this from the cPanel team.

Thank you.
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello @fevangelou,

This is controlled with the following options under the "SQL" tab in "WHM >> Tweak Settings":

Allow cPanel & WHM to determine the best value for your MySQL open_files_limit configuration?
Allow cPanel & WHM to determine the best value for your MySQL max_allowed_packet configuration?
Allow cPanel & WHM to determine the best value for your MySQL innodb_buffer_pool_size configuration?

You can set these options to "Off" if you want to ensure they are not added to the /etc/my.cnf file upon each MySQL restart. Note that when enabled, these configuration values are added with underscores in the /etc/my.cnf file, and will take precedence over the existing values with hyphens.

Thank you.
 

fevangelou

Member
Oct 10, 2010
24
5
53
Athens, Greece
cPanel Access Level
DataCenter Provider
Twitter
And being inside "Tweak Settings" means it can be programmatically configured as well :)

Thank you @cPanelMichael!