Centos 6
在/etc/grub.conf 在kernel 添加numa=off 就行了
一、检查OS是否开启NUMA
# numactl --hardware
available: 1 nodes (0) #如果是2或多个nodes就说明numa没关掉
二、Linux OS层面禁用NUMA
1、修改 grub.conf
# vi /boot/grub/grub.conf
#/*Copyright 2010, Oracle. All rights reserved.*/default=0timeout=5hiddenmenu
foreground=000000background=ffffff
splashimage=(hd0,0)/boot/grub/oracle.xpm.gz
title Trying_C0D0_as_HD0
root (hd0,0)
kernel/boot/vmlinuz-2.6.18-128.1.16.0.1.el5 root=LABEL=DBSYS ro bootarea=dbsys rhgb quiet console=ttyS0,115200n8 console=tty1 crashkernel=128M@16M numa=off
initrd/boot/initrd-2.6.18-128.1.16.0.1.el5.img
2、重启Linux操作系统
# /sbin/reboot
3、确认OS层面禁用NUMA是否成功
# cat /proc/cmdline
root=LABEL=DBSYS ro bootarea=dbsys rhgb quiet console=ttyS0,115200n8 console=tty1 crashkernel=128M@16M numa=off
# numactl--hardware
Centos 7 mysql5.7关闭NUMA方法
登录Linux系统,修改/etc/init.d/mysqld文件,加上numactl --interleave all
vi /etc/init.d/mysqld
找到如下行
# Give extra arguments to mysqld with the my.cnf file. This script
# may be overwritten at next upgrade.
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null &wait_for_pid created"$!" "$mysqld_pid_file_path"; return_value=$?
将$bindir/mysqld_safe --datadir="$datadir"这一行修改为:
/usr/bin/numactl --interleave all $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null &wait_for_pid created"$!" "$mysqld_pid_file_path"; return_value=$?
然后重启MySQL服务
转自:
NUMA特性禁用 - zfox - 博客园 https://www.cnblogs.com/zfox2017/p/6491556.html
mysql5.7关闭NUMA方法 - formydream的博客 - CSDN博客 https://blog.csdn.net/jh993627471/article/details/79177884
针对跑MySQL的Linux优化经验-MySQL Life http://wubx.net/linux-performance-tuning-tips-mysql/