Change max_open_files mariadb in rocky linux 8.6

Hello all, I hope will be fine. Can I help me with this theme in rocky linux 8.6 with my mariadb server. I am trying to change the variable max_open_files and I have this error when restart mariadb

[Warning] Could not increase number of max_open_files to more than 1024 (request: 80417)

I made some changes in /etc/security/limits.conf and /etc/security/limits.d/90-nproc.conf of this way:

Added in /etc/security/limits.conf

*               soft    nofile          102400
*               hard    nofile          102400
*               soft    nproc           102400
*               hard    nproc           102400

/etc/security/limits.d/90-nproc.conf

*               soft    nofile          102400
*               hard    nofile          102400
*               soft    nproc           102400
*               hard    nproc           102400
root            soft    nproc           unlimited

The changed on the limits was susefully but when I put in /etc/my.cnf max_open_files=102400n and restart the value not change

MariaDB [(none)]> show variables like "open_files_limit";
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| open_files_limit | 1024  |
+------------------+-------+
1 row in set (0.001 sec

)

What do can don to make effective the change or I am making something wrong in the configuration process?

Rocky Linux 8.6 (Green Obsidian) in google cloud | Kernel: Linux 4.18.0-372.16.1.el8_6.cloud.x86_64 | mysql Ver 15.1 Distrib 10.3.32-MariaDB |

Add it to /etc/my.cnf.d/mariadb-server.cnf.

image

Hello @dgxa

plus what @joebeasley3 said

check the limit on the os first using
ulimit -n as it MariaDB will not exceed the limit of the operating system
check this one to increase the system limit

i guess you use systemD to start your db so thiss one would help also

hope that help and have a nice day everyone :slight_smile:

1 Like

If it’s for Mariadb only, you should not be changing those files, and anyway, are you really saying you’re going to allow 102400, and why?

Back in the real world; let’s say you want to change the limits of the Rocky 8.6 version of Mariadb from 1024 to 2048, the way to do that is using a systemd drop in (to avoid messing with the systemd service file). The systemd edit command can be used to create a drop in.

@joebeasley3 this is my /etc/my.cnf

imagen

When reestart mariadb the same result

Hi:

According to https://access.redhat.com/solutions/1257953 limits set in /etc/security/limits.conf or /etc/security/limits.d/*.conf are ignored.

From shell, execute

systemctl edit mariadb.service

and edit

[Service]
LimitNOFILE=number_of_files_required

Exit and execute

systemctl daemon-reload
systemctl restart mariadb.service

This is one of the three ways to change the open file limits and the more effective. I make this procedure and my file limits change to

show variables like “open_files_limit”;
±-----------------±------+
| Variable_name | Value |
±-----------------±------+
| open_files_limit | 70005 |
±-----------------±------+

I increment the open file limits to 800000 in /etc/systemd/system/mariadb.service.d/limitnofile.conf but variable increment to 70005. Now my doubt is why the variable not show 800000

The parameter you are trying to adjust depends on the amount of RAM available in the system.

For more details see [https://access.redhat.com/solutions/60746]

1 Like