I just can’t figure this out. Whenever I try to set the my.cnf in my personal DB instance to increase max connection and reduce max idle timeouts, they won’t appear when the DB is restarted. I always have to set them directly in the DB CLI. Can somebody explain to me what I’m doing wrong? I was meaning to address this sooner but seeing as how the instance was never in need of a reboot until Andrew did made forget to address this issue.
Cyberpower678 English Wikipedia Account Creation Team English Wikipedia Administrator Global User Renamer
Hi,
you do not provide much information about your environment, but this is what I can tell you from what you you tell us:
Unless you use MySQL 8.0+, the only way to persist configuration variables is on a mysqld configuration file. max_connections is a system variable configured on the [mysqld] or [server] section of the server configuration file, which typically can be found on linux on /etc/my.cnf, /etc/mysql/my.cnf $HOME/my.cnf, etc (it gets more complex, as files can include other files). You can just create one from scratch if your installation method didn't pre-create one for you (mysql server can start without a config file). You can check the current value of the server with mysql -e "SELECT @@GLOBAL.max_connection". You can check which variables will be on effect after restart with my_print_defaults mysqld. You can check which variables have been changed compared to on disk values with "pt-config-diff /etc/my.cnf h=localhost" of the percona toolkit package. Max connections defaults to 151 on 5.6: https://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_... Having it larger than 500 or so is probably not a good idea unless you have connection pooling, as scaling over 64-128 running threads is usually quite difficult unless you have a large number of cpu multi-processing unit with ramdisk or fusion-io. To kill idle connections, you can use wait_timeout and interactive_timeout, depending of the CLIENT_INTERACTIVE flag set by the client (it is set by mysql program, not by the connectors). Your application, however, should try to kill connections whenever possible to avoid hoarding resources and leaving open transactions that could affect other active connections. It is important to presist yout variables- you may need to reboot your VM, server or reload configuration that cannot be done in a hot way many times.
More info on setting system variables: https://dev.mysql.com/doc/refman/5.7/en/using-system-variables.html
On Sat, Jan 20, 2018 at 12:01 AM, Maximilian Doerr < maximilian.doerr@gmail.com> wrote:
I just can’t figure this out. Whenever I try to set the my.cnf in my personal DB instance to increase max connection and reduce max idle timeouts, they won’t appear when the DB is restarted. I always have to set them directly in the DB CLI. Can somebody explain to me what I’m doing wrong? I was meaning to address this sooner but seeing as how the instance was never in need of a reboot until Andrew did made forget to address this issue.
Cyberpower678 English Wikipedia Account Creation Team English Wikipedia Administrator Global User Renamer _______________________________________________ Wikimedia Cloud Services mailing list Cloud@lists.wikimedia.org (formerly labs-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/cloud