惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
NISL@THU
NISL@THU
S
Securelist
O
OpenAI News
S
Security Affairs
Cyberwarzone
Cyberwarzone
T
Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 最新话题
C
Cisco Blogs
PCI Perspectives
PCI Perspectives
SecWiki News
SecWiki News
S
Secure Thoughts
GbyAI
GbyAI
I
Intezer
AWS News Blog
AWS News Blog
F
Fortinet All Blogs
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
Google Online Security Blog
Google Online Security Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
A
About on SuperTechFans
S
Schneier on Security
P
Proofpoint News Feed
雷峰网
雷峰网
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
小众软件
小众软件
H
Heimdal Security Blog
Microsoft Security Blog
Microsoft Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
V
V2EX
L
Lohrmann on Cybersecurity
Security Latest
Security Latest
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
H
Hacker News: Front Page
Cisco Talos Blog
Cisco Talos Blog
Webroot Blog
Webroot Blog
T
Tenable Blog
MyScale Blog
MyScale Blog
博客园 - 司徒正美
S
SegmentFault 最新的问题
Y
Y Combinator Blog
腾讯CDC
Hacker News: Ask HN
Hacker News: Ask HN
M
MIT News - Artificial intelligence
G
GRAHAM CLULEY

博客园 - 但用此心

在CentOS中使用 yum 安装MongoDB及服务器端配置 yum安装mongodb 不错的文章 windows 下,go语言 交叉编译 linux 下 安装go go http 文件下载 go练习5--生成md5 go练习4--json 序列号反序列化 go练习3 --map的操作 go练习2-go的学习资料 go练习1-翻转字符串 php 定界符 eclipse 的代码着色插件 --Eclipse Color Theme 将tomcat添加为linux系统服务 在centos linux上安装jdk7 使用excel 展现数据库内容 java 查看线程死锁 linux 配置 java 环境变量 win7 安装windows 服务 报错 System.Security.SecurityException 解决方法 An exception occurred during the Install phase. System.Security.SecurityException: The so
mysql 修改默认配置 提高性能
但用此心 · 2014-02-19 · via 博客园 - 但用此心

解决问题 

 Lost connection to MySQL server at ‘reading authorization packet’, system error: 0  

通过修改 connect_timeout 的值来解决 

http://hi.baidu.com/279713119/blog/item/d7cdd7533ba9c82e42a75b0f.html

參考了一篇:『Fixing Poor MySQL Default Configuration Values』,裡面提到了四個 MySQL 預設值相當沒有意義,所以 Jeremy Zawodny 提出了修改,也解釋了為什麼這四個會降低 MySQL 的效能。

1. max_connect_errors:
當使用者連接 MySQL 出現錯誤,伺服器就會根據 connect_timeout 所設定時間之後,而放棄等待,放棄之後會有 counter 來紀錄連接失敗的次數,當達到 max_connect_errors 設定值,伺服器就會 locked out client 端,這會衍生一個問題,那就是可以惡搞同一台網站,把 MySQL 搞爛,造成封鎖,不過解決方法就是把 max_connect_errors 設定成 (max_connect_errors=1844674407370954751)

2. connect_timeout:
這跟上面 max_connect_errors 是有相當大的關係,MySQL 預設 connect_timeout 是五秒,可是在網路繁忙的時候,也許需要花費比較多的時間來做連接, 但是預設值是五秒的話,這樣會一直 time out,造成 counter 持續增加,屆時會超過 max_connect_errors 設定值,所以必須把 connect_timeout 設定提高到 15 or 20,這樣就可以了 (connect_timeout = 20)

3. skip-name-resolve:
在每次的 MySQL 連線,伺服器端會偵測 Client 的 DNS 反解,這步驟真的有點多餘

綜合上面結論,請加入 my.cnf 一些設定

max_connections = 6000
wait_timeout = 5
max_connect_errors = 1844674407370954751
connect_timeout = 20
skip-name-resolve
slave_net_timeout = 30

無論如何都應該修改的 MySQL 預設值
線 上環境的 MySQL 預設值修改(Jeremy 建議)