MySQL Turning



CentOS Turning


# ulimit  -u  31184  -n  65536
ulimit  -n  65536
ulimit  -n
ulimit  -a

#--- 아래 파일은 수정하지 않음
vi  /etc/security/limits.conf
    *            soft    nofile          65536
    *            hard    nofile          65536

#--- 아래 파일과 명령은 수정하지 않음
vi  /lib/systemd/system/mariadb.service
    [Service]
    LimitNOFILE=10000
# systemctl  daemon-reload

MariaDB Turning



Connections 갯수 조정

mysql  -uroot  -p  mysql
    show  variables  like  '%max_conn%';
    set  global  max_connections=1024;
    
vi  /etc/my.cnf
    max_connections = 1024
    max_connect_errors = 2048

 


기타 조정

 mysql -uroot -p mysql
     show table status from daoutest;
     show variables like 'query_cache%';
     set global query_cache_type = 'ON';
     set global query_cache_size = 32000000;
 
 mysqladmin -uroot -p extended-status
  • vi /etc/my.cnf
    • key_buffer_size+(record_buffer+sort_buffer)*max_connections < 실메모리양
    • table_cache : (MaxFileOpen-MaxConnecrion-(temporary table에 사용되는 파일핸들)) /2
    • mysqladmin -uroot -p variables
 [mysqld](mysqld.md)
 key_buffer = 256M
 max_allowed_packet = 4M
 table_cache = 512
 sort_buffer_size = 2M
 read_buffer_size = 2M
 myisam_sort_buffer_size = 64M
 thread_cache = 8
 thread_stack = 126976
 max_connections = 200
 join_buffer_size = 1M
 max_connect_errors = 1024
 wait_timeout = 30
 read_rnd_buffer_size = 8M
 thread_cache_size = 8
 query_cache_type = 1
 query_cache_size = 512M
 query_cache_limit = 16M
  • 주의 사항
    • wait_timeout이 설정되어 있는 경우, 프로그램에서 상시 연결하도록 되어 있는 연결이 끊어진다.
      • OBCon Stock에서 해당 오류가 발생함

최종 수정일: 2023-11-21 21:43:26

이전글 :
다음글 :
상단 menu
arrow_back_ios
arrow_forward_ios