在对集群做压力测试的时候,发现有节点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