I have contacted Mysql to know that it is a database. Many users know how to use Mysql database, but little is known about the optimization of Mysql runtime environment. If you want to master Mysql Database, the optimization of Mysql runtime environment should also understand some, the following small series will introduce you to the Linux optimization Mysql operating environment.
First, modify the default Linux IO scheduling algorithm.
The default IO scheduling algorithm for linux is cfq, which needs to be modified to dealine. If it is an SSD or PCIe-SSD device, it needs to be modified to noop. You can use the following two modifications.
1. Online dynamic modification, restart failure.
echo “deadline” 》 /sys/block/sda/queue/scheduler
tips: The sda here represents the hard drive you need to modify, modify it according to your actual situation.
2. Modify /etc/grub.conf to take effect permanently.
Modify the /etc/grub.conf configuration file and add a configuration to the kernel line, for example:
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID= E01d6bb4-bd74-404f-855a-0f700fad4de0 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun1
6 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM elevator=deadline rhgb quiet
Mainly concerned about the parameter of the elevator, if you set the kernel, you need to restart the system to take effect.
Finally, you can observe the difference between pre-modification and post-modification by cat /sys/block/sda/queue/scheduler.
Second, expand the file descriptor
This is a frequently modified parameter, high-concurrency programs will be modified.
1, dynamic modification, restart failure, can only use root, and the current session is valid.
ulimit -n 51200
2. Modify the configuration file to take effect permanently.
Add a line to the /etc/security/limits.conf configuration file
* hard nofile 51200
Expand the number of open processes nprocess /etc/security/limits.conf
Add a line to the /etc/security/limits.conf configuration file
* hard nproc 51200
Finally modify the /etc/pam.d/login file to add
session required /lib64/security/pam_limits.so
After rebooting the system, use the ulimit -a command to check whether it takes effect.
Third, disable the numa feature
The next-generation architecture of NUMA is not suitable for running the database, it is intended to improve memory utilization, but the actual effect is not good, but may lead to a CPU memory is still There is a surplus, but the other one is not enough, and the swap problem occurs, so it is recommended to turn off or modify the scheduling mechanism of NUMA.
1. Modify /etc/grub.conf to close NUMA and take effect after reboot.
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=e01d6bb4-bd74-404f-855a-0f700fad4de0 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun1
6 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM elevator=deadline numa=off rhgb quiet
2. Modify the /etc/init.d/mysql or mysqld_safe script to set the mysqld process to start. NUMA scheduling mechanism, for example.
The following content is included in the new mysqld_safe script, so you don't need to add it. You can check if your mysqld_safe script has the following content.
if true && test $numa_interleave -eq 1
then
# Locate numactl, ensure it exists.
if ! My_which numactl 》 /dev/null 2》&1
then
log_error “numactl command not found, required for –numa-interleave”
exit 1< Br>
# Attempt to run a command, ensure it works.
elif ! Numactl –interleave=all true
then
log_error “numactl failed, check if numactl is properly installed"
fi
# Launch mysqld with Numactl.
cmd=”$cmd numactl –interleave=all”
elif test $numa_interleave -eq 1
then
log_error “ –numa-interleave is not supported on this platform"
exit 1
fi
Previous12Next Total 2 Pages
The Linux system itself is an open source system, so the Linux version is also being improved at any
After installing the Ubuntu system, the system default screen resolution is too low. The 1280*1024 d
The Ubuntu source command is used to make the configuration information set in the
I have learned Linux commands, the find command can be used to find directory files. Today, Xiaobian
How to modify the image name in batches under Linux
How to remove old kernels from Linux system
How to use the web page editor CKEditor under Linux
Linux statistical data software WhatPulse User Guide
How to create and use XFS system in Linux system
How to solve the problem that the WeChat public platform webpage cannot play audio under Linux?
Using Linux routing and forwarding function to share the Internet
What if the Linux partition read-only causes the database to stop writing data?
How Linux uses Sysdig to troubleshoot system faults
Usage of Dmidecode Commands for Linux System
The problem of installing sql 2008 in win server 2008 is
Win10 how to remove the shortcut small arrow
Win7 use Youku to watch video appear card screen phenomenon how to solve
Win7 can not safely remove the mobile hard disk solution
Linux system command make, clean usage explain
The reason why the computer game is not smooth is
How can the Windows 7 system quickly cancel the power-on login password?
Easy to create a familiar Windows traditional desktop environment for Win8
Win7 direct free upgrade win10 (can enjoy free upgrade for life)