MySQL并不孤单的存在—硬件环境的限制与优化
top - 14:13:24 up 214 days, 16:30, 28 users, load average: 0.61, 0.44, 0.27
Tasks: 2941 total, 1 running, 2927 sleeping, 12 stopped, 1 zombie
Cpu(s): 4.6%us, 4.2%sy, 0.0%ni, 90.3%id, 0.7%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 16335708k total, 16109152k used, 226556k free, 486544k buffers
Swap: 16777212k total, 1325068k used, 15452144k free, 4629420k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
17468 efs 20 0 20.1g 7.4g 17m S 45.8 47.6 0:16.73 java
18281 mysql 20 0 5029m 442m 7148 S 3.9 2.8 0:48.18 mysqld
[root@node1 ~]# vmstat 2 3 #每隔2秒采集一次,一共采集三次
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 99764 83536 375416 0 0 21 3 30 71 0 0 99 1 0
0 0 0 99732 83536 375416 0 0 0 0 31 65 0 0 100 0 0
0 0 0 99732 83536 375416 0 0 0 0 29 66 0 0 100 0 0
[root@node1 ~]# iostat -x 5
Linux 2.6.32-696.el6.x86_64 (node1) 07/13/2020 _x86_64_(1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
3.25 0.00 7.27 26.45 0.00 63.03
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 77.54 40.37 48.03 7.82 3332.45 385.45 66.57 4.04 72.38 9.07 461.07 5.61 31.32
scd0 0.38 0.00 0.38 0.00 3.05 0.00 8.00 0.00 0.56 0.56 0.00 0.56 0.02
scd1 0.00 0.00 0.36 0.00 2.86 0.00 8.00 0.00 1.11 1.11 0.00 1.11 0.04
vi /etc/selinux/config
查看防火墙状态:service iptables status
临时关闭防火墙:service iptables stop
永久关闭防火墙:chkconfig iptables off
查看防火墙状态:systemctl status firewalld
临时关闭防火墙:systemctl stop firewalld
永久关闭防火墙:systemctl disable firewalld
vi /etc/grub.conf
vi /etc/default/grub
grub2-mkconfig -o /etc/grub2.cfg
dmesg |grep -i numa
vi /etc/sysctl.conf
加入vm.swappiness = 10。
#执行下面命令生效
sysctl -p /etc/sysctl.conf
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535
* soft nproc 65535
* hard nproc 65535
为了方便大家交流,我建了一个微信群,大家可以在群里聊技术、聊理想、聊生活,欢迎加入!
本文分享自微信公众号 - MySQL数据库技术栈(Mysqltechnology)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。
