Java
Cassandra tmpdir 更改位置
/tmp
如果設置為,則 Cassandra 無法啟動noexec
,這在當今幾乎是預設設置: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.2.jar:2.2.2] at org.apache.cassandra.io.util.Memory.<init>(Memory.java:74) ~[apache-cassandra-2.2.2.jar:2.2.2] at org.apache.cassandra.io.util.Memory.allocate(Memory.java:97) ~[apache-cassandra-2.2.2.jar:2.2.2] at org.apache.cassandra.io.sstable.IndexSummary$IndexSummarySerializer.deserialize(IndexSummary.java:323) ~[apache-cassandra-2.2.2.jar:2.2.2] at org.apache.cassandra.io.sstable.format.SSTableReader.loadSummary(SSTableReader.java:836) ~[apache-cassandra-2.2.2.jar:2.2.2] at org.apache.cassandra.io.sstable.format.SSTableReader.load(SSTableReader.java:692) ~[apache-cassandra-2.2.2.jar:2.2.2] at org.apache.cassandra.io.sstable.format.SSTableReader.load(SSTableReader.java:664) ~[apache-cassandra-2.2.2.jar:2.2.2] at org.apache.cassandra.io.sstable.format.SSTableReader.open(SSTableReader.java:458) ~[apache-cassandra-2.2.2.jar:2.2.2] at org.apache.cassandra.io.sstable.format.SSTableReader.open(SSTableReader.java:363) ~[apache-cassandra-2.2.2.jar:2.2.2] at org.apache.cassandra.io.sstable.format.SSTableReader$4.run(SSTableReader.java:501) ~[apache-cassandra-2.2.2.jar:2.2.2] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_102] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_102] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_102] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_102] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]
如果我從裝載Cassandra
noexec
中刪除標誌,則可以正常啟動。我嘗試了多種方法來更改文件中 tmpdir 的位置:/var/tmp``cassandra-env.sh
JVM_OPTS="$JVM_OPTS -Djna.tmpdir=/home/cassandra/tmp" JVM_OPTS="$JVM_OPTS -Djava.io.tmpdir=/home/cassandra/tmp" JVM_OPTS="$JVM_OPTS -Dorg.xerial.snappy.tempdir=/home/cassandra/tmp"
我沒有一次使用這些,當然,這些是我在網際網路上找到的解決方案,但似乎沒有一個有效。
TMPDIR
我什至嘗試在文件開頭導出cassandra-env.sh
,但無濟於事。它總是失敗並顯示相同的消息。我認為在
/tmp
安全方面沒有 noexec 標誌離開是個壞主意。我顯然在這裡遺漏了一些基本的東西。如何將 tmpdir 設置為/home/cassandra/tmp
或類似的東西?
啊,看起來這兩個選項都必須存在於
cassandra-env.sh
文件中:JVM_OPTS="$JVM_OPTS -Djna.tmpdir=/home/cassandra/tmp" JVM_OPTS="$JVM_OPTS -Djava.io.tmpdir=/home/cassandra/tmp"