現象:html
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 60,001 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
|
『wait_timeout 過大有弊端,其體現就是 MySQL 裏大量的 SLEEP 進程沒法及時釋放,拖累系統性能,不過也不能把這個指設置的太小,不然你可能會遭遇到「MySQL has gone away」之類的問題。』『在MySQL命令行裏經過 SET來設置便可,避免服務重啓:mysql> set global wait_timeout=60;』『查有無生效,用 show global variables 查全局變量:mysql> show global variables like 'wait_timeout';單純使用 show variables 的話就等同於使用的是 show session variables,查詢的是會話變量,你會誤覺得設置沒有生效。』
『Master failure
If the master looses connection to the database or looses the exclusive lock then it immediately shuts down. If a master shuts down or fails, one of the other slaves will grab the lock and so the topology switches to the following diagram
』
『參數含義:服務器關閉非交互鏈接以前等待活動的秒數。在線程啓動時,根據全局wait_timeout值或全局interactive_timeout值初始化會話wait_timeout值,取決於客戶端類型(由mysql_real_connect()的鏈接選項CLIENT_INTERACTIVE定義)。
java參數默認值: 28800秒(8小時)』本文引自:http://www.cnblogs.com/zhengyun_ustc/archive/2012/11/10/activemq_wait_timeout.html