Mysql高并发优化

Mysql高并发优化

my.cnf配置如下(仅供参考):

[client]
port=3306
socket=/usr/local/mysql/mysql.sock

[mysqld]
port=3306
socket=/usr/local/mysql/mysql.sock

binlog_format=MIXED
skip-external-locking
default-storage-engine=INNODB
key_buffer_size=512M
max_allowed_packet=16M
#每个连接需要的内存
sort_buffer_size=8M
read_buffer_size=8M
read_rnd_buffer_size=32M
myisam_sort_buffer_size=32M
myisam_max_sort_file_size=64M
thread_cache_size=64
query_cache_size=256M
query_cache_type=1
query_cache_limit=2M
thread_concurrency=16
max_connections=10000
max_connect_errors=10000
max_heap_table_size=32M
tmp_table_size=32M
ft_min_word_len=1
ft_stopword_file=
delay_key_write=ALL
#内部内存临时表的最大大小。这个变量不适用于用户创建的MEMORY表。
tmp_table_size=400M
tmpdir=/usr/local/mysql/temp
skip-name-resolve
#服务器在关闭非交互式连接之前等待活动的秒数
wait_timeout=28800
#服务器在关闭交互式连接之前等待活动的秒数
interactive_timeout=28800
innodb_buffer_pool_size=20000M
innodb_log_buffer_size=16M
innodb_log_file_size=256M

log-error=/usr/local/mysql/logs/mysql_error.log
pid-file=/usr/local/mysql/mysql.pid
datadir=/data/mysql/data

log-bin-index=mysql-bin.index
log_bin_trust_function_creators=1

innodb_flush_log_at_trx_commit=2
log_slave_updates
expire_logs_days=3
long_query_time=1

[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer=256M
read_buffer=2M
write_buffer=2M
[myisamchk]
key_buffer=256M
read_buffer=2M
write_buffer=2M
[mysqlhotcopy]
interactive-timeout
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值