在对集群做压力测试的时候,发现有节点down机,错误信息如下。google后查明原因,由于Linux "
max user processes(nproc)"所致,我操作系统的是
CentOS 6 64bit,修改方法如下:
错误信息
ERROR [Thread-28] 2013-07-25 06:14:05,055 CassandraDaemon.java (line 175) Exception in thread Thread[Thread-28,5,main]
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:640)
at java.util.concurrent.ThreadPoolExecutor.addThread(ThreadPoolExecutor.java:681)
at java.util.concurrent.ThreadPoolExecutor.addIfUnderMaximumPoolSize(ThreadPoolExecutor.java:727)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:655)
at org.apache.cassandra.thrift.CustomTThreadPoolServer.serve(CustomTThreadPoolServer.java:113)
at org.apache.cassandra.thrift.ThriftServer$ThriftServerThread.run(ThriftServer.java:111)
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:640)
at java.util.concurrent.ThreadPoolExecutor.addThread(ThreadPoolExecutor.java:681)
at java.util.concurrent.ThreadPoolExecutor.addIfUnderMaximumPoolSize(ThreadPoolExecutor.java:727)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:655)
at org.apache.cassandra.thrift.CustomTThreadPoolServer.serve(CustomTThreadPoolServer.java:113)
at org.apache.cassandra.thrift.ThriftServer$ThriftServerThread.run(ThriftServer.java:111)
当前会话有效设置
ulimit -u # 查看nproc
ulimit -u 65535 # 设置nproc,仅当前会话有效
ulimit -u 65535 # 设置nproc,仅当前会话有效
全局有效
cat /etc/security/limits.d/90-nproc.conf
* soft nproc 1024
vi /etc/security/limits.d/90-nproc.conf
* soft nproc 65535
* soft nproc 1024
vi /etc/security/limits.d/90-nproc.conf
* soft nproc 65535
参考:
java.lang.OutOfMemoryError: unable to create new native thread
--end

本文针对在CentOS 6 64位系统上进行压力测试时遇到的Cassandra节点宕机问题进行了详细分析。问题根源在于Linux系统的maxuserprocesses(nproc)限制导致内存溢出。文中提供了具体的错误信息,并给出了临时解决方案和永久修复方法,包括调整当前会话的nproc限制和修改全局配置文件。
1763

被折叠的 条评论
为什么被折叠?



