Frage

The following configuration in my.cnf is not being followed. Max_connections go back to 151. please help as i have 16gb of dedicated ram that i would like to use properly.

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
#symbolic-links=0

#vish start
open_files_limit = 8000
max_connections = 500
#set-variable=max_connections=500
thread_concurrency = 8
#concurrent_insert=2
thread_cache_size=2000

interactive_timeout=180
wait_timeout=180

max_allowed_packet = 32M
key_buffer_size = 3000M
read_buffer_size = 16M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 256M
myisam_sort_buffer_size = 16M
myisam_max_sort_file_size = 256M
myisam_repair_threads = 1
#myisam_recover = 4
max_heap_table_size = 2048M
tmp_table_size = 1024M
table_open_cache = 2000
table_cache = 2000
sort_buffer_size = 128M 
join_buffer_size = 128M 
query_cache_size = 128M 
query_cache_limit = 128M 

#slow_query_log=1
log-slow-queries
long_query_time=2
#log_queries_not_using_indexes=1
slow_query_log_file = /var/log/mariadb/host_name-slow.log

[mysqldump]
user=root
password=*********
#max_allowed_packet = 1024M 

[myisamchk] 
key_buffer_size = 2500M 
sort_buffer_size = 1024M 
read_buffer = 32M
write_buffer = 32M

[innodb]
innodb_buffer_pool_size=3G
innodb_buffer_pool_instance=2
innodb_additional_mem_pool_size=20M
innodb_log_file_size= 512M
innodb_log_buffer_size=16M
innodb_flush_log_at_trx_commit=1
innodb_thread_concurrency=16
#innodb_read_io_threads=16
#innodb_write_io_threads=16
#innodb_io_capacity=2000
#innodb_lock_wait_timeout=120

innodb_flush_method=O_DIRECT
#vish end

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#!includedir /etc/my.cnf.d
War es hilfreich?

Lösung 4

Fixed the issue. The issue was to do with the right permissions. The right permissions on the my.cnf file should be 644 not 777.

Andere Tipps

You might find that the limit is not where you think.

I've had trouble with open file limits and that's set by Centos itself. Please see:

How to permanently raise ulimit 'open files' and MySQL 'open_files_limit'

Some key points from that link:

  • The default ulimit on open files is 1024.
  • MySQL sets its open_files_limit to whatever the system's ulimit is set to.
  • MySQL cannot set it's open_files_limit higher than ulimit.

You can raise the ulimit temporarily or permanently, globally or for specific users; see the link for details.

There are more resources like that around.

check permissions for my.cnf file - ls -l /etc/my.cnf or ls -l /etc/mysql/my.cnf

check owner and group, often when after edit my.cnf it have right for read only for root user

You can change owner to mysql:root or change cmd mask for something like 755, finally You will have:

root@monitor:~# ls -l /etc/mysql/my.cnf
-rwxr-xr-x 1 mysql root 2539 Nov 27 10:10 /etc/mysql/my.cnf
root@monitor:~#

if mysql user can not open my.cnf file - it use default values == 151

There are some other changes to /etc/security/limits.conf and some systemd settings that need to be adjusted. See this article for more details:

https://pjstrnad.com/mariadb-raise-number-of-connections/

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit dba.stackexchange
scroll top