Cassandra tmpdir 更改位置

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]

如果我noexec/var/tmp坐騎上移除標誌卡桑德拉正常啟動。我嘗試了多種方法來更改cassandra-env.sh文件中 tmpdir 的位置:

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或類似的內容?

答案1

啊,看起來像兩個都文件中必須存在選項cassandra-env.sh

JVM_OPTS="$JVM_OPTS -Djna.tmpdir=/home/cassandra/tmp"
JVM_OPTS="$JVM_OPTS -Djava.io.tmpdir=/home/cassandra/tmp"

答案2

我還必須向該cassandra-env.sh文件添加一個 TMPDIR 環境變數。例如:

導出 TMPDIR=/home/cassandra/tmp

相關內容