今天我突然想要查看一下我的mysql的资源限制。首先 :
[root@blank ec2-user]# ps aux|grep mysql
root 3208 0.0 0.0 110284 848 pts/0 S+ 02:02 0:00 grep mysql
root 31989 0.0 0.1 115016 1672 ? S Feb04 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql 32256 0.0 8.9 684072 91100 ? Sl Feb04 0:39 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
这样可以看到我要找的mysql 的pid是32256,
再次:
[root@blank ec2-user]# cat /proc/32256/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 7843 7843 processes
Max open files 1024 4096 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 7843 7843 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
这样我们就能看到我们mysql的资源限制了。
然后我们可以修改mysql的资源限制,同时也要注意系统对软硬资源的限制,我们可以查看
[root@blank ec2-user]# cat /etc/sysctl.conf
进行资源限制,这里很多参数都是系统的优化的参数。
原文:http://blanktian.blog.51cto.com/3776453/1612244