最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jvm - Cassandra order of precedence between .option files - Stack Overflow

programmeradmin6浏览0评论

In a server with Cassandra 4 with the files:

jvm-server.options
jvm11-server.options

among others.

What will be the order they are loaded in? Am I correct in understanding that the last one overrides the next to last and so on?

I've looked at the Cassandra documentation re jvm-* files, I've looked at the cassandra-env.sh file as well, and in the cassandra file in /usr/sbin and couldn't understand the order. I'm seeing the files in the original Github so surely the all serve some purpose but I just can't figure out how they come together.

Could I decypher this from the run command I found via pgrep -af cassandra? Is this a general Java thing or a Cassandra thing?

In a server with Cassandra 4 with the files:

jvm-server.options
jvm11-server.options

among others.

What will be the order they are loaded in? Am I correct in understanding that the last one overrides the next to last and so on?

I've looked at the Cassandra documentation re jvm-* files, I've looked at the cassandra-env.sh file as well, and in the cassandra file in /usr/sbin and couldn't understand the order. I'm seeing the files in the original Github so surely the all serve some purpose but I just can't figure out how they come together.

Could I decypher this from the run command I found via pgrep -af cassandra? Is this a general Java thing or a Cassandra thing?

Share Improve this question asked Mar 11 at 15:11 UberhumusUberhumus 1,2222 gold badges17 silver badges28 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

So if we have a look at the code in the cassandra.in.sh file (for version 4.1), we can see this at the bottom:

# Read user-defined JVM options from jvm-server.options file
JVM_OPTS_FILE=$CASSANDRA_CONF/jvm${jvmoptions_variant:--clients}.options
if [ $JAVA_VERSION -ge 11 ] ; then
    JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm11${jvmoptions_variant:--clients}.options
else
    JVM_DEP_OPTS_FILE=$CASSANDRA_CONF/jvm8${jvmoptions_variant:--clients}.options
fi

for opt in `grep "^-" $JVM_OPTS_FILE` `grep "^-" $JVM_DEP_OPTS_FILE`
do
  JVM_OPTS="$JVM_OPTS $opt"
done

Actually, if we cd into the conf/ directory, we can use a modified version of that for loop:

for opt in `grep "^-" jvm-server.options` `grep "^-" jvm11-server.options`
do
  echo $opt
done

...this will let you see the order that each of the JVM options from those files will be applied in.

So yes, if there are conflicting JVM options set between the two files, the jvm11-server.options file will win-out.

发布评论

评论列表(0)

  1. 暂无评论