天天看點

Cacti的spine程序數引起的問題

 SPINE: Poller[0] FATAL: Connection Failed, Error:'1040', Message:'Too many connections' (Spine thread) 

查了下,應該是預設連接配接太少,網上搜了下,這樣改:

MYSQL資料庫安裝完成後,預設最大連接配接數是100,一般流量稍微大一點的論壇或網站這個連接配接數是遠遠不夠的,增加預設MYSQL連接配接數的方法有兩個

方法一:進入MYSQL安裝目錄 打開MYSQL配置檔案 my.ini 或 my.cnf查找 max_connections=100   修改為 max_connections=1000 服務裡重起MYSQL即可

方法二:MySQL的最大連接配接數預設是100用戶端登入:mysql -uusername -ppassword

設定新的最大連接配接數為200:mysql> set GLOBAL max_connections=200

顯示目前運作的Query:mysql> show processlist

顯示目前狀态:mysql> show status

退出用戶端:mysql> exit

檢視目前最大連接配接數:mysqladmin -uusername -ppassword variables

方法三:以centos 4.4 下面的mysql 5.0.33 手工編譯版本為例說明:

  vi /usr/local/mysql/bin/mysqld_safe

  找到safe_mysqld編輯它,找到mysqld啟動的那兩行,在後面加上參數 :

  -O max_connections=1500

  具體一點就是下面的位置:

  用紅字特别說明:

  then $NOHUP_NICENESS $ledir/$MYSQLD

  $defaults --basedir=$MY_BASEDIR_VERSION

  --datadir=$DATADIR $USER_OPTION

  --pid-file=$pid_file

  --skip-external-locking

  >> $err_log 2>&1 else

  eval "$NOHUP_NICENESS $ledir/$MYSQLD

  --skip-external-locking $args

  -O max_connections=1500 >>

  $err_log 2>&1"

  儲存。

  # service mysqld restart

  # /usr/local/mysql/bin/mysqladmin -uroot -p variables

  輸入root資料庫賬号的密碼後可看到

  max_connections 1500 即新改動已經生效。

  還有一種方法,

  修改原代碼:

  解開MySQL的原代碼,進入裡面的sql目錄修改mysqld.cc找到下面一行:

  {"max_connections", OPT_MAX_CONNECTIONS,

  "The number of simultaneous clients allowed.", (gptr*) &max_connections,

  (gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 100, 1, 16384, 0, 1,

  0},

  把它改為:

  (gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 1500, 1, 16384, 0, 1,

  存盤退出,然後./configure ;make;make install可以獲得同樣的效果。

推薦使用方法二。