Optimize or modify the maximum number of CentOS connections

Source: Internet
Author: User

Optimize or modify the maximum number of CentOS connections

System Environment: CentOS + Keepalived + HAProxy + MariaDB + Galera + MongoDB

When we set up a high-availability server environment, we will encounter a limit on the number of system-level connections, because CentOS sets a limit on the number of connections by default based on the system hardware information, this quantity is often a problem we have encountered. So today we need to modify the default value of the system to meet our requirements and solve the connection problems caused by high concurrency.

Run the following command to view the current maximum number of connections:

[Root @ HA ~] # Ulimit-n1024
Modify the following configuration file:

Edit/etc/security/limits. conf

[Root @ HA ~] # Vi/etc/security/limits. conf

* Soft nofile 65535 * hard nofile 65535 * soft noproc 65535 * hard noproc 65535
Add the preceding content to the configuration file.

Edit/etc/pam. d/login

[Root @ HA ~] # Vi/etc/pam. d/login
Session required pam_limits.so
Add the preceding content to the configuration file.

Save the above, restart the server, and then use ulimit-n
[Root @ HA ~] # Ulimit-n65535

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.