我正在尝试在RHEL 6.5服务器中设置cassandra.当我启动cassandara时,我得到一个与JNA相关的错误.例外情况说找不到课程.但是,我在日志中看到jna jar被添加到类路径中.我尝试使用apache-cassandra-3.0.0和apache-cassandra-2.2.3,我在两者中都得到了相同的异常.我发现jna jar在$ CASSANDRA_HOME/lib和/ usr/share/java中都可用.安装的jna jar版本是4.0.0.任何帮助表示赞赏.以下是启动日志 -
INFO 05:57:57 Classpath: /home/cassandra-new/apache-cassandra-2.2.3/conf:/home/cassandra-new/apache-cassandra-2.2.3/build/classes/main:/home/cassandra-new/apache-cassandra-2.2.3/build/classes/thrift:/home/cassandra-new/apache-cassandra-2.2.3/lib/airline-0.6.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/antlr-runtime-3.5.2.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/apache-cassandra-2.2.3.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/apache-cassandra-clientutil-2.2.3.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/apache-cassandra-thrift-2.2.3.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/cassandra-driver-core-2.2.0-rc2-SNAPSHOT-20150617-shaded.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/commons-cli-1.1.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/commons-codec-1.2.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/commons-lang3-3.1.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/commons-math3-3.2.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/compress-lzf-0.8.4.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/concurrentlinkedhashmap-lru-1.4.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/crc32ex-0.1.1.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/disruptor-3.0.1.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/ecj-4.4.2.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/guava-16.0.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/high-scale-lib-1.0.6.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/jackson-core-asl-1.9.2.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/jackson-mapper-asl-1.9.2.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/jamm-0.3.0.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/javax.inject.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/jbcrypt-0.3m.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/jcl-over-slf4j-1.7.7.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/jna-4.0.0.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/joda-time-2.4.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/json-simple-1.1.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/libthrift-0.9.2.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/log4j-over-slf4j-1.7.7.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/logback-classic-1.1.3.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/logback-core-1.1.3.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/lz4-1.3.0.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/metrics-core-3.1.0.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/metrics-logback-3.1.0.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/netty-all-4.0.23.Final.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/ohc-core-0.3.4.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/ohc-core-j8-0.3.4.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/reporter-config3-3.0.0.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/reporter-config-base-3.0.0.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/sigar-1.6.4.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/slf4j-api-1.7.7.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/snakeyaml-1.11.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/snappy-java-1.1.1.7.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/ST4-4.0.8.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/stream-2.5.2.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/super-csv-2.1.0.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/thrift-server-0.3.7.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/jsr223//.jar:/home/cassandra-new/apache-cassandra-2.2.3/lib/jamm-0.3.0.jar
WARN 05:57:57 JNA link failure, one or more native method will be unavailable.
WARN 05:57:57 JMX is not enabled to receive remote connections. Please see cassandra-env.sh for more info.
INFO 05:57:57 Initializing SIGAR library
WARN 05:57:57 Cassandra server running in degraded mode. Is swap disabled? : false, Address space adequate? : true, nofile limit adequate? : false, nproc limit adequate? : true
INFO 05:57:58 Initializing system.sstable_activity
INFO 05:57:58 Initializing system.hints
INFO 05:57:58 Initializing system.compaction_history
INFO 05:57:58 Initializing system.peers
INFO 05:57:58 Initializing system.schema_columnfamilies
INFO 05:57:59 Initializing system.schema_functions
INFO 05:57:59 Initializing system.IndexInfo
INFO 05:57:59 Initializing system.schema_columns
INFO 05:57:59 Initializing system.schema_triggers
INFO 05:57:59 Initializing system.local
INFO 05:57:59 Initializing system.schema_usertypes
INFO 05:57:59 Initializing system.batchlog
INFO 05:57:59 Initializing system.available_ranges
INFO 05:57:59 Initializing system.schema_aggregates
INFO 05:57:59 Initializing system.paxos
INFO 05:57:59 Initializing system.peer_events
INFO 05:57:59 Initializing system.size_estimates
INFO 05:57:59 Initializing system.compactions_in_progress
INFO 05:57:59 Initializing system.schema_keyspaces
INFO 05:57:59 Initializing system.range_xfers
ERROR 05:57:59 Exception in thread Thread[MemtableFlushWriter:1,5,main]
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at org.apache.cassandra.utils.memory.MemoryUtil.allocate(MemoryUtil.java:82) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.io.util.Memory.(Memory.java:74) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.io.util.SafeMemory.(SafeMemory.java:32) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.io.compress.CompressionMetadata$Writer.(CompressionMetadata.java:274) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.io.compress.CompressionMetadata$Writer.open(CompressionMetadata.java:288) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.io.compress.CompressedSequentialWriter.(CompressedSequentialWriter.java:73) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.io.util.SequentialWriter.open(SequentialWriter.java:168) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.io.sstable.format.big.BigTableWriter.(BigTableWriter.java:75) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.io.sstable.format.big.BigFormat$WriterFactory.open(BigFormat.java:107) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.io.sstable.format.SSTableWriter.create(SSTableWriter.java:84) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.db.Memtable$FlushRunnable.createFlushWriter(Memtable.java:424) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.db.Memtable$FlushRunnable.writeSortedContents(Memtable.java:367) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.db.Memtable$FlushRunnable.runMayThrow(Memtable.java:352) ~[apache-cassandra-2.2.3.jar:2.2.3]
at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) ~[apache-cassandra-2.2.3.jar:2.2.3]
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297) ~[guava-16.0.jar:na]
at org.apache.cassandra.db.ColumnFamilyStore$Flush.run(ColumnFamilyStore.java:1134) ~[apache-cassandra-2.2.3.jar:2.2.3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_65]
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_65]
我浏览了CLibrary.java中的代码,发现以下代码捕获了异常 -
catch (UnsatisfiedLinkError e) { logger.warn("JNA link failure, one or more native method will be unavailable."); logger.trace("JNA link failure details: {}", e.getMessage()); }
我通过将conf/logback.xml中的日志级别更改为TRACE来重新启动cassandra,以打印更多细节 -
我现在可以看到真正的问题 -
/tmp/jna-3506402/jna6068045839690239595.tmp:无法从共享对象映射段:不允许操作
此问题是由于/ tmp文件夹上的noexec标志引起的.
然后我决定通过使用选项更改tmpdir来更改tmp文件夹:
-Djava.io.tmpdir=/home/cassandra/tmp
修复了问题.
我在cassandra-env.sh文件中添加了选项.增加以下声明 -
JVM_OPTS="$JVM_OPTS -Djava.io.tmpdir=/home/cassandra/tmp"