標籤:串連池 讀寫分離 maxscale
現象:
程式會不定時的出現串連錯誤,問題bug的異常資訊如下:
The last packet successfully received from the server was 116 milliseconds ago. The last packet sent successfully to the server was 115 milliseconds ago.
java.sql.SQLException: No database selected
但通過用戶端sqlyog/navicat串連均為正常。
----------------------------------------------------------------------
另:maxscale1.4.3有時還會出現掛起現象,4006連接埠直接關閉。後我們用了watch命令後台跑監控。
watch -d /bin/bash /root/sh/restart_maxsacle.sh
#!/bin/bashnetstat -ntlp | grep maxscale | grep 4006 > /dev/null 2>&1if [ $? -eq 1 ];then/etc/init.d/maxscale startfi
解決:5.6以下可以直接在url上配置:autoReconnect=true
對於5.6以上的只能在jdbc的連結池裡設定:
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/89/C7/wKiom1gcJ8eRZd5cAABCHLTCyQg422.png" title="圖片1.png" alt="wKiom1gcJ8eRZd5cAABCHLTCyQg422.png" />
第一個設定成ture,逾時自動連結,對於mysql要把第二個設定成false,不啟用緩衝。
以上是開發需要注意的都是一些基本的配置。
其目的為:每次歸還串連時執行select ‘x‘檢測串連是否有效。
本文出自 “賀春暘的技術專欄” 部落格,請務必保留此出處http://hcymysql.blog.51cto.com/5223301/1869414
MaxScale2.0.1結合Java Druid串連池實現讀寫分離注意事項