cassandra连接错误:无法连接到localhost:9160

时间:2014-01-15 13:08:30

标签: cassandra

我的cassandra运作良好,但突然停止工作了! 当我使用cqlsh命令时,我收到此错误:      连接错误:无法连接到localhost:9160 在output.log文件中我看到了:

    Service exit with a return value of 1
  OpenJDK Client VM warning: Insufficient space for shared memory file:
  /tmp/hsperfdata_cassandra/10963
  Try using the -Djava.io.tmpdir= option to select an alternate temp location.

 INFO 12:23:31,307 Logging initialized
 log4j:ERROR Failed to flush writer,
java.io.IOException: No space left on device
    at java.io.FileOutputStream.writeBytes(Native Method)
    at java.io.FileOutputStream.write(FileOutputStream.java:297)
    at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220)
    at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:290)
    at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:294)
    at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:140)
    at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
    at org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:59)
    at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:324)
    at org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:276)
    at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
    at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
    at      org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
    at org.apache.log4j.Category.callAppenders(Category.java:206)
    at org.apache.log4j.Category.forcedLog(Category.java:391)
    at org.apache.log4j.Category.info(Category.java:666)
    at org.apache.cassandra.service.CassandraDaemon.initLog4j(CassandraDaemon.java:118)
    at org.apache.cassandra.service.CassandraDaemon.<clinit>(CassandraDaemon.java:65)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at java.lang.Class.newInstance0(Class.java:374)
    at java.lang.Class.newInstance(Class.java:327)
    at org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:190)
 INFO 12:23:31,332 32bit JVM detected.  It is recommended to run Cassandra on a 64bit     JVM for better performance.
INFO 12:23:31,335 JVM vendor/version: OpenJDK Client VM/1.6.0_27
WARN 12:23:31,335 OpenJDK is not recommended. Please upgrade to the newest Oracle Java release
INFO 12:23:31,335 Heap size: 252641280/253689856
INFO 12:23:31,335 Classpath: /usr/share/cassandra/lib/antlr-3.2.jar:/usr/share/cassandra/lib/avro-1.4.0-fixes.jar:/usr/share/cassandra/lib/avro-1.4.0-sources-fixes.jar$
INFO 12:23:31,691 JNA mlockall successful
 INFO 12:23:31,715 Loading settings from filService exit with a return value of 1
 OpenJDK Client VM warning: Insufficient space for shared memory file:
有人能帮帮我吗? :(

1 个答案:

答案 0 :(得分:1)

主机上的/ tmp目录对于cassandra希望制作的临时文件来说还不够大。临时文件与系统中的数据量相关。由于您的数据库现在比以前更大,它之前就开始了,但它现在还没有开始。

使用df检查/ tmp目录的状态。这是我的系统

$ df /tmp
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sda6      570881944 350121276 191761552  65% /

要更改用于这些临时文件的位置,例如设置java.io.tmpdir的错误 在我的系统(Ubuntu Linux)上,可以通过编辑文件末尾/etc/cassandra/cassandra-env.sh

来完成
JVM_OPTS="$JVM_OPTS $JVM_EXTRA_OPTS -Djava.io.tmpdir=/opt"

确保新临时目录有足够的空间并且权限正确,可能允许cassandra用户的读/写就足够了