2012-01-29 54 views
0

我在雙節點(AB)集羣上使用cassandra 0.6.5。
Hector用於客戶端。cassandra太多打開的文件

運行一段時間後,一個節點A總是有too many open files exception
我在節點上運行netstat
它顯示了很多CLOSE_WAIT tcp連接。

這是例外的罪魁禍首。
但是,是什麼原因造成如此之多的CLOSE_WAIT連接,
是客戶端Hector問題?
爲什麼其他節點B沒有這個問題?

回答

5

而不是使用netstat,請嘗試lsof -n | grep java。這裏列出了多少個文件描述符(你可以通過lsof -n | grep java | wc -l得到一個計數)?

The datastax docs suggest you might be hitting a default file descriptor limit of 1024。您可以通過ulimit或在/etc/security/limits.conf中更改。 Datastax提出了以下變化:

echo "* soft nofile 32768" | sudo tee -a /etc/security/limits.conf 
echo "* hard nofile 32768" | sudo tee -a /etc/security/limits.conf 
echo "root soft nofile 32768" | sudo tee -a /etc/security/limits.conf 
echo "root hard nofile 32768" | sudo tee -a /etc/security/limits.conf 

Debian包設置以下值:

# Provided by the cassandra package 
cassandra - memlock unlimited 
cassandra - nofile 100000 

我也強烈建議您升級到最新版本卡桑德拉。

+0

我已經將ulimit設置爲20,000。 lsof顯示有超過20,000個文件描述符。 – chnet 2012-01-29 18:56:47

+0

有多少網絡連接? 'lsof -n -i | grep java | wc -l' – psanford 2012-01-29 20:30:16

+0

借用升級到更高版本 - Cassandra現在在1.0.7 – DNA 2012-01-29 20:31:42