mysql5.6的my.cnf文件优化

centos6
mysql5.6

cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]
max_connections=1000
wait_timeout=10

key_buffer_size = 16M
max_allowed_packet = 8M
#table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
performance_schema_max_table_instances=600
table_definition_cache=400
table_open_cache=256 #将该值调为256后,
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/home/mysql_3306/mysql
socket=/home/mysql_3306/run/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
character-set-server=utf8
collation-server=utf8_general_ci
server-id=8
log-bin=mysql-bin
binlog_format=ROW


skip-name-resolve

[mysqld_safe]
log-error=/home/mysql_3306/logs/mysqld.log
pid-file=/home/mysql_3306/run/mysqld.pid


#skip-grant-tables
ps -ef | grep 3306
root     14342     1  0 10:13 pts/1    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/home/mysql_3306/mysql --socket=/home/mysql_3306/run/mysql.sock --pid-file=/home/mysql_3306/run/mysqld.pid --basedir=/usr --user=mysql
mysql    14775 14342  0 10:13 pts/1    00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/home/mysql_3306/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/home/mysql_3306/logs/mysqld.log --pid-file=/home/mysql_3306/run/mysqld.pid --socket=/home/mysql_3306/run/mysql.sock
root     15916  4184  0 10:22 pts/1    00:00:00 grep --color=auto 3306

table_open_cache=256 #将该值调为256后,前后mysql占用内存查询
在这里插入图片描述
mysql5.6的my.cnf文件优化_第1张图片

** 下午看的时候系统的used内存还在增加

mysql5.6的my.cnf文件优化_第2张图片

执行 echo 3 > /proc/sys/vm/drop_caches
发现used下降
mysql5.6的my.cnf文件优化_第3张图片

atop查看
used一直在增加,但实际的cache/buffer并没太大的变化
mysql5.6的my.cnf文件优化_第4张图片

mysql5.6的my.cnf文件优化_第5张图片

你可能感兴趣的:(docker,容器,运维)