jueves, 21 de junio de 2018

MySQL open_files_limit - No se puede mover

MySQL open_files_limit

Tenemos la necesidad de cambiar la variable de open_files_limit:



Primero revisar en my.cnf:

open_files_limit = 100000

En el servidor

/etc/security/limits.conf:


Verificamos que el cambio sea aceptado:
 ulimit -Hn -Sn
open files                      (-n) 100000
open files                      (-n) 100000


Con el usuario "mysql" de linux

su mysql

bash-4.2$ ulimit -Hn -Sn
open files                      (-n) 100000
open files                      (-n) 100000


Revisamos el status del servicio de MySQL

service mysql status

Redirecting to /bin/systemctl status  mysql.service
mysqld.service - MySQL Community Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
   Active: active (running) since Wed 2014-12-24 10:41:09 EST; 40min ago
  Process: 2982 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 2970 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2981 (mysqld_safe)
   CGroup: /system.slice/mysqld.service
           ââ2981 /bin/sh /usr/bin/mysqld_safe
           ââ3268 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --open-files-limit=100000 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/my...

Dec 24 10:41:08 mack systemd[1]: Starting MySQL Community Server...
Dec 24 10:41:09 mack mysqld_safe[2981]: 141224 10:41:09 mysqld_safe Logging to '/var/log/mysqld.log'.
Dec 24 10:41:09 mack mysqld_safe[2981]: 141224 10:41:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Dec 24 10:41:09 mack systemd[1]: Started MySQL Community Server.


Verificamos que se haya realizado el cambio:

mysql> show global variables like 'open%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| open_files_limit | 1024  |
+------------------+-------+
1 row in set (0.00 sec)


Estaremos cambiando otro my.cnf en otra ruta:
grep -r "open_files_limit" /etc
/etc/my.cnf:open_files_limit = 100000
/etc/my.cnf:open_files_limit = 100000
[root@mack ~]# grep -r "open_files_limit" /var
[root@mack ~]# grep -r "open_files_limit" /usr
/usr/share/vim/vim74/syntax/ora.vim:syn keyword oraKeywordUnd     _number_cached_attributes _offline_rollback_segments _open_files_limit
Binary file /usr/sbin/mysqld matches
Binary file /usr/sbin/mysqld-debug matches
Binary file /usr/bin/mysqlbinlog matches
/usr/bin/mysqld_safe:      --open_files_limit=*) open_files="$val" ;;



Si aun no se ve reflejado el cambio tenemos que editar el archivo /usr/lib/systemd/system/mysqld.service

LimitNOFILE=infinity
LimitMEMLOCK=infinity

Despues ejecutamos
systemctl daemon-reload y systemctl restart  mysql.service


Ya debe funcionar




No hay comentarios.:

Publicar un comentario