This topic describes how to limit the number of processes by configuring the limits.conf file.
If you are an individual user, you can skip this topic. If you are an enterprise user, we recommend that you configure the limits.conf file.
You can modify the limit on resources by using the following two methods:
Modify the limit at the session level when OceanBase Database is started.
Modify the limit globally by using the
limits.conffile in the/etc/security/directory.
OceanBase Database processes can be limited in terms of the following parameters: Stack, Open Files, and Core File Size. Here, Stack refers to the maximum stack size, Open Files refers to the maximum number of file handles, and Core File Size refers to the maximum size of core files.
Modify parameters
Note
You must perform this operation on each server.
The following example shows how to set the value of the session-level Stack parameter to unlimited, the Open Files parameter to 655350, and the Core File Size parameter to unlimited.
Run the following command to open the limits.conf file in the /etc/security/ directory:
sudo vim /etc/security/limits.conf
Add the following content to the /limits.conf file in the /etc/security/ directory:
root soft nofile 655350
root hard nofile 655350
* 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
You must check for the nproc configuration in the 20-nproc.conf file under the /etc/security/limits.d directory. If the nproc configuration exists, you must modify the value of nproc in the file as well.
View parameters
Log off from the session and log on again. Run the following command to check whether the configuration has taken effect:
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
In the previous output:
core file sizeindicates the maximum size of core files, and the unit is block. The parameter corresponds to thecoreparameter in thelimits.confconfiguration file. Check whether the value isunlimited.open filesindicates the maximum number of open file descriptors. The parameter corresponds to thenofileparameter in thelimits.confconfiguration file. Check whether the value is655350.stack sizeindicates the stack size in kilobytes. The parameter corresponds to thestackparameter in thelimits.confconfiguration file. Check whether the value isunlimited.max user processesindicates the maximum number of user processes. The parameter corresponds to thenprocparameter in thelimits.confconfiguration file. Check whether the value is655360.