Koozali.org: home of the SME Server

adjust max_connections for Mysql

Offline Tillebeck

  • ****
  • 76
  • +0/-0
adjust max_connections for Mysql
« on: November 15, 2007, 04:22:34 PM »
Hi.
I have serached for a solution to increase the max_connectins for mysql.

I guess it should be something like:
# db configuration setprop mysqld max_connections=300

But my guess was wrong...
I could not update the max_connectinos that way.

Can anyone help with the proper way to do it?


BR. Anders

Offline waton

  • *
  • 14
  • +0/-0
    • http://www.opensynergy.org
Re: adjust max_connections for Mysql
« Reply #1 on: November 16, 2007, 03:24:05 AM »
CMIIW, you can reate templates file on /etc/e-smith/templates/etc/my.cnf that contain 'mysqld max_connections=300'

-waton-

Offline raem

  • *
  • 3,972
  • +4/-0
Re: adjust max_connections for Mysql
« Reply #2 on: November 16, 2007, 04:03:15 AM »
Tillebeck

Quote
I guess .... But my guess was wrong...

You cannot just guess new db commands, the code within the existing templates must provide for and support the command.
The db commands are there in the first place because the template code has been written to effectively create each specific db command.

Where specific commands are not catered for in the code, then you would create custom templates to specifiy the setting value you want to be placed in the corresponding config file.
...

Offline raem

  • *
  • 3,972
  • +4/-0
Re: adjust max_connections for Mysql
« Reply #3 on: November 16, 2007, 04:12:18 AM »
waton

Recommended good practise would be to create custom template fragments in
/etc/e-smith/templates-custom/etc/my.cnf

Copy existing fragments from /etc/e-smith/templates/etc/my.cnf  if they are the same or similar, and modify as required, otherwise create new fragments
...

Offline Tillebeck

  • ****
  • 76
  • +0/-0
Re: adjust max_connections for Mysql
« Reply #4 on: November 16, 2007, 12:42:21 PM »
Super!
Thank you for your posts  :-)

I did not know that the configuration was in my.cnf. But after reading your posts I was able to search for a lot more info on the forum. I have now added the extra settings the rigtht way (the custom template way).

BR. Anders
-----------------------------------
For anyone searching for this info, here is what should be the right solution. The exaples given for the template fragment are all settings I have been recommended for a dedicated webserver running several Typo3 CMS websites with fairly heavy load.

1) create a template fragment called something starting with 011:
/etc/e-smith/templates-custom/etc/my.cnf/011mysqlConfiguration

2) put your configuration into it (remove lines and edit values as suit your setup). Max_allowed_packets=16 is set as default, so no need to include that into your own template unless you want a different value:

skip-locking
concurrent_insert=1
key_buffer=56M
max_connections=300
max_connect_errors=2000000
wait_timeout=15
max_tmp_tables=200
query_cache_size=64M
query_cache_limit=10M
query_cache_type=1
read_buffer_size=8M
sort_buffer_size=8M
table_cache=1000
tmp_table_size=64M
thread_cache_size=200
  <--- it must ends with a line break. Otherwise the expand-template will fail and your mysql may not work

3) expand template and restart mysql:
# /sbin/e-smith/expand-template /etc/my.cnf
# service mysqld restart

4) Check to see if you succeded by looking into /etc/my.cnf. All your entries from your template fragment should be visiable there by now.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: adjust max_connections for Mysql
« Reply #5 on: November 16, 2007, 01:00:31 PM »
max_connect_errors=2000000
Sorry for asking but why would you set this value to such an absurd high value?
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Tillebeck

  • ****
  • 76
  • +0/-0
Re: adjust max_connections for Mysql
« Reply #6 on: November 16, 2007, 02:15:04 PM »
I am not sure if it is best practice. But the thought behind the settings are theese:

To reduce open connections the wait_timeout is reduced to only 15...
# wait_timeout=15

this will probably cause the Mysql to close a whole lot more connections. And therefore the max_connect_errors is set exstremely high.
# max_connect_errors=2000000

It is for a webserver hosting many Typo3-based websites with a fairly heavy load. And some of the code (extensions for Typo3) may not allways be optimized or may even contain code with errors here and there.


If... you have any suggestions or will share your my.cnf with a few comments on you editations or added entries please do so ;-) I am new in tuning the mysql part of the server.