【问题标题】:cassandra too many open filescassandra 打开的文件太多
【发布时间】:2012-01-30 02:09:14
【问题描述】:

我在两节点(AB)集群上使用了 cassandra 0.6.5。
Hector 用于客户端。

一个节点A在运行一段时间后总是有too many open files exception
我在节点上运行netstat
它显示了很多CLOSE_WAIT tcp 连接。

这是异常的罪魁祸首。
但是,是什么导致了这么多 CLOSE_WAIT 连接,
是客户端Hector 的问题吗?
为什么其他节点B没有这个问题?

【问题讨论】:

    标签: file sockets cassandra


    【解决方案1】:

    尝试使用lsof -n | grep java,而不是使用netstat。那里列出了多少个文件描述符(您可以使用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
    

    我还强烈建议您升级到更新版本的 Cassandra。

    【讨论】:

    • 我已经将 ulimit 设置为 20,000。 lsof 显示有超过 20,000 个文件描述符。
    • 其中有多少是网络连接? lsof -n -i | grep java | wc -l
    • 第二次升级到更高版本 - Cassandra 现在是 1.0.7
    • 我刚刚检查过了。我早上重新启动机器。现在lsof 显示有 7029 个打开的文件。从netstat,有6865 个CLOSE_WAIT TCP 连接。它将不断增加,直到达到 20,000 的阈值
    • 如果您要坚持使用 0.6,至少升级到该系列的最新版本 (0.6.13)。如果在早期的 0.6 版本中存在压缩的 fd 泄漏,我不会感到惊讶......但是,请注意,此时 0.6 已过时,并且许多较新的文档不适用于那里。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-08
    • 1970-01-01
    • 2012-05-09
    • 2011-07-18
    • 2019-10-30
    • 2011-01-03
    相关资源
    最近更新 更多