Building a highly available Linux server two

Source: Internet
Author: User

CentOS Optimization:

1, close the services you do not need:NTSYSV

Crond: Automatically Scheduled Tasks

Network: The Footstep service for the configured networking interface.

Sshd:openssh Server daemon.

Irqbalance: Enable the Irqbalance service to improve performance and reduce power consumption.

Syslog:linux the log system service.

Close Iptables:service iptables stop && chkconfig iptables off

Switch off selinux:vim/etc/selinux/config selinux= "enforcing" to disabled and restart. If you temporarily close Selinux,setenforce 0 (SELinux is still turned on after reboot).

2. Close the unwanted TTY

Vim/etc/inittab

1:2345:respawn:/sbin/mingetty tty1

2:2345:respawn:/sbin/mingetty Tty2

#3:2345:respawn:/sbin/mingetty tty3

#4:2345:respawn:/sbin/mingetty Tty4

#5:2345:respawn:/sbin/mingetty tty5

#6:2345:respawn:/sbin/mingetty tty6

The init q can be executed without restarting after saving.

3. Adjust the parameters of TCP/IP network

Adjusting TCP/IP network parameters can enhance the ability to resist SYN flood,

Echo ' Net.ipv4.tcp_syncookies=1 ' >>/etc/sysct.conf

Make this kernel change effective immediately

Sysctl-p

4. Change the number of history records for Shell commands

Vim/etc/profile

Find histsize=1000 instead of histsize=100 (this is subject to availability).

Do not restart the system and let it take effect: source/etc/profile

5, time to correct the timing of the server

Yum Install NTP

Edit the/etc/crontab file and add a line at the end:

* * * * root/sbin/ntpdate ntp.api.bz >>/dev/null 2 >&1

Ntp.api.bz is a set of NTP server clusters, currently has 6 servers, located in Shanghai Telecom Office. This service is the second free API service after the API.BZ http://sms.api.bz mobile fetion free SMS Send interface.

6. Stop Printing Service

/etc/rc.d/init.d/cups Stop Stop Printing service

stopping cups: [OK] stop service successful, "OK" appears

Chkconfig cups off disables automatic start of print service

Chkconfig-list Cups confirm Print Service Set status automatically

Cups0:off 1:off 2:off:3: Off 4:off 5:off 6:off

7, adjust the maximum number of files open Linux

To adjust the maximum number of open files for Linux, the performance of squid at high loads will be low

Vim/etc/security/limit.conf

On the last line add:

*soft Nofile 60000

*hard Nofile 65535

But everything was restored after the reboot. Correct practice:

Vim/etc/rc.local

Ulimit-shn 65535

8. Turn off the write disk I/O function

The Linux system has a default of 3 time files:

Atime: Access time for this file

CTime: Time when the inode for this file has changed

Mtime: Modified time for this file

To modify the file system configuration file:

Open/etc/fstab

/dev/sda5/data/pics ext3 noatime,nodiratime 0 0

This will no longer generate write disk I/O when accessing the file.

    

Building a highly available Linux server two

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.