This topic describes how to limit the number of processes by configuring limits.conf.
If you are in a personal trial scenario, you can skip this step. If you are using it in a production environment, we recommend that you configure limits.conf.
You can modify resource limits at the global level by configuring the /etc/security/limits.conf file. The process-related limits for OceanBase Database include the maximum stack size per thread (Stack), the maximum number of open files (Open Files), and core file size (Core File Size).
Modify the configuration
Note
You must perform this operation on each server.
Set the maximum stack size at the session level to unlimited, the maximum number of open files to 655350, and the core file size to unlimited.
Run the following command to open the /etc/security/limits.conf configuration file:
[admin@test001 ~]$ sudo vim /etc/security/limits.conf
Add the following content to the /etc/security/limits.conf configuration file:
* soft nofile 655350
* hard nofile 655350
* soft stack unlimited
* hard stack unlimited
* soft nproc 655360
* hard nproc 655360
* soft core unlimited
* hard core unlimited
Note
Check if the nproc configuration exists in the
/etc/security/limits.d/20-nproc.conffile. If it does, update the nproc value in that file accordingly.The configuration in
limits.confonly takes effect for newly logged-in sessions (such as newly opened terminals, SSH connections, or newly started processes). Existing sessions or processes will not automatically inherit the new configuration; you need to log out and back in or restart the relevant service.
View the configuration
Log out of the current session and log in again. Run the following command to check if the configuration has taken effect.
[admin@test001 ~]$ ulimit -a
The output is as follows.
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 252876
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 655350
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 655360
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
From the results, you can see:
core file sizeindicates the maximum threshold for core files (in blocks), corresponding to the core parameter in thelimits.confconfiguration file. Check if the value is unlimited.open filesindicates the maximum number of open file descriptors, corresponding to the nofile parameter in thelimits.confconfiguration file. Check if the value is 655350.stack sizeindicates the stack size in kilobytes. It corresponds to the stack parameter in thelimits.confconfiguration file. Check whether its value is unlimited.max user processesindicates the maximum number of user processes. It corresponds to the nproc parameter in thelimits.confconfiguration file. Check whether its value is 655360.
