Cassandra数据库jvm.options配置说明

Cassandra数据库jvm.options配置说明

  • -all flags defined here will be used by cassandra to startup the JVM
  • one flag should be specified per line
  • lines that do not start with ‘-’ will be ignored
  • only static flags are accepted (no variables or parameters)
  • dynamic flags will be appended to these on cassandra-env

注:
- cassandra将使用此处定义的所有标志来启动JVM
- 每行应指定一个标志
- 不以’ - ‘开头的行将被忽略
- 只接受静态标志(无变量或参数)
- 动态标志将附加到cassandra-env上

启动参数

// Uncomment any of the following properties to enable specific startup parameters**
取消注释以下任何属性以启用特定的启动参数
//In a multi-instance deployment, multiple Cassandra instances will independently assume that all**
在多实例部署中,多个Cassandra实例将独立地假设所有实例????

//CPU processors are available to it. This setting allows you to specify a smaller set of processors and perhaps have affinity.**

CPU处理器可用。 此设置允许您指定较小的处理器集以及有更好的兼容;
在多实例部署中,每个Cassandra实例都独立假定所有CPU处理器都可用。使用此设置可以指定一组较小的处理器

-Dcassandra.available_processors=number_of_processors

// The directory location of the cassandra.yaml file.**
指定cassandra.yaml file位置,这里注释的话就是默认同一个文件夹内

-Dcassandra.config=directory

// Sets the initial partitioner token for a node the first time the node is started.
在第一次启动节点时为节点设置初始分区标记。 ????

-Dcassandra.initial_token=token

// Set to false to start Cassandra on a node but not have the node join the cluster.
设置为false:节点上启动Cassandra,但不让节点加入群集。

-Dcassandra.join_ring=true|false

//Set to false to clear all gossip state for the node on restart. Use when you have changed node information in cassandra.yaml (such as listen_address).
设置为false:重新启动时,清除节点的所有gossip状态。 在cassandra.yaml中更改节点信息时使用(例如listen_address)。

-Dcassandra.load_ring_state=true|false

//Enable pluggable metrics reporter. See Pluggable metrics reporting in Cassandra 2.0.2.
启用可插入指标报告器。 请参阅Cassandra 2.0.2中的可插入指标报告。

扫描二维码关注公众号,回复: 2772751 查看本文章

-Dcassandra.metricsReporterConfigFile=file

//Set the port on which the CQL native transport listens for clients. (Default: 9042)
设置CQL本机传输侦听客户端的端口。 (默认:9042)

-Dcassandra.native_transport_port=port

//Overrides the partitioner. (Default: org.apache.cassandra.dht.Murmur3Partitioner)
覆盖分区程序。 (默认值:org.apache.cassandra.dht.Murmur3Partitioner)

-Dcassandra.partitioner=partitioner

//To replace a node that has died, restart a new node in its place specifying the address of the dead node. The new node must not have any data in its data directory, that is, it must be in the same state as before bootstrapping.
如果要替换已死亡的节点,请在其位置重新启动指定死节点地址的新节点。 新节点的数据目录中不得包含任何数据,也就是说,它必须处于引导前的状态。

-Dcassandra.replace_address=listen_address or broadcast_address of dead node

//Allow restoring specific tables from an archived commit log.
允许从存档的提交日志中还原特定的表。

-Dcassandra.replayList=table

//Allows overriding of the default RING_DELAY (30000ms), which is the amount of time a node waits before joining the ring.
允许覆盖默认的RING_DELAY(30000ms),这是节点在加入环之前等待的时间。

-Dcassandra.ring_delay_ms=ms

//Set the port for the Thrift RPC service, which is used for client connections. (Default: 9160)
设置Thrift RPC服务的端口,该服务用于客户端连接。 (默认:9160)

-Dcassandra.rpc_port=port

//Set the SSL port for encrypted communication. (Default: 7001)
设置SSL端口以进行加密通信。 (默认:7001)

-Dcassandra.ssl_storage_port=port

// Enable or disable the native transport server. See start_native_transport in cassandra.yaml.
启用或禁用本机传输服务器。 请参阅cassandra.yaml中的start_native_transport。

cassandra.start_native_transport=true|false

// Enable or disable the Thrift RPC server. (Default: true)
启用或禁用Thrift RPC服务器。 (默认值:true)

-Dcassandra.start_rpc=true/false

//Set the port for inter-node communication. (Default: 7000)
设置节点间通信的端口。 (默认值:7000)

-Dcassandra.storage_port=port

// Set the default location for the trigger JARs. (Default: conf/triggers)
设置触发器JAR的默认位置。 (默认值:conf / triggers)

-Dcassandra.triggers_dir=directory

//For testing new compaction and compression strategies. It allows you to experiment with different strategies and benchmark write performance differences without affecting the production workload.
用于测试新的压缩和压缩策略。 它允许您在不影响生产工作负载的情况下尝试不同的策略和基准写入性能差异。

-Dcassandra.write_survey=true

// To disable configuration via JMX of auth caches (such as those for credentials, permissions and roles). This will mean those config options can only be set (persistently) in cassandra.yaml and will require a restart for new values to take effect.
通过JMX禁用身份验证缓存(例如凭据,权限和角色的配置)的配置。 这意味着这些配置选项只能在cassandra.yaml中设置(持久),并且需要重新启动才能使新值生效。

-Dcassandra.disable_auth_caches_remote_configuration=true

//To disable dynamic calculation of the page size used when indexing an entire partition (during initial index build/rebuild). If set to true, the page size will be fixed to the default of 10000 rows per page.
禁用动态计算索引整个分区时使用的页面大小(在初始索引构建/重建期间)。 如果设置为true,则页面大小将固定为默认值o每页10000行。

-Dcassandra.force_default_indexing_page_size=true

通用JVM设置

// enable assertions. highly suggested for correct application functionality.
启用断言。 强烈建议正确的应用程序功能。?????

-ea

// enable thread priorities, primarily so we can give periodic tasks a lower priority to avoid interfering with client workload
启用线程优先级,主要是因为我们可以为周期性任务提供较低的优先级,以避免干扰客户端工作负载

-XX:+UseThreadPriorities

//allows lowering thread priority without being root on linux - probably not necessary on Windows but doesn’t harm anything. see http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workar
允许降低线程优先级而不是linux上的root用户 - 可能在Windows上不是必需的但不会损害任何东西。
请参阅http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workar

-XX:ThreadPriorityPolicy=42

//Enable heap-dump if there’s an OOM
如果有OOM,则启用堆内存

-XX:+HeapDumpOnOutOfMemoryError

//Per-thread stack size.
每个线程的堆栈大小

-Xss256k

//Larger interned string table, for gossip’s benefit (CASSANDRA-6410)
更大的实习字符串表,用于gossip的好处(CASSANDRA-6410)

-XX:StringTableSize=1000003

//Make sure all memory is faulted and zeroed on startup.
//This helps prevent soft faults in containers and makes transparent hugepage allocation more effective.
确保启动时所有内存都出现故障并归零。
这有助于防止容器中的软故障,并使透明的大页面分配更有效。

-XX:+AlwaysPreTouch

//Disable biased locking as it does not benefit Cassandra.
禁用偏向锁定,因为它不会使Cassandra受益。

-XX:-UseBiasedLocking

//Enable thread-local allocation blocks and allow the JVM to automatically resize them at runtime.
启用线程局部分配块,并允许JVM在运行时自动调整它们的大小。

-XX:+UseTLAB

-XX:+ResizeTLAB

-XX:+UseNUMA

// http://www.evanjones.ca/jvm-mmap-pause.html

-XX:+PerfDisableSharedMem

//Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
//comment out this entry to enable IPv6 support).
首选绑定到IPv4网络接口(当net.ipv6.bindv6only = 1时)。
请参阅http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561(简短版本:注释掉此条目以启用IPv6支持)。

-Djava.net.preferIPv4Stack=true

Debug options

//uncomment to enable flight recorder
取消注释以启用飞行记录器????

-XX:+UnlockCommercialFeatures

-XX:+FlightRecorder

//uncomment to have Cassandra JVM listen for remote debuggers/profilers on port 1414
取消注释让Cassandra JVM在端口1414上侦听远程调试器/分析器

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1414

//uncomment to have Cassandra JVM log internal method compilation (developers only)
取消注释Cassandra JVM日志内部方法编译(仅限开发人员)

-XX:+UnlockDiagnosticVMOptions

-XX:+LogCompilation

堆设置

//Heap size is automatically calculated by cassandra-env based on this formula:
max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB)) formula:
max(min(1/2 ram,1024MB),min(1/4 ram,8GB))
堆大小由cassandra-env根据此自动计算

- calculate 1/2 ram and cap to 1024MB

- calculate 1/4 ram and cap to 8192MB

- pick the max

//For production use you may wish to adjust this for your environment. If that’s the case, uncomment the -Xmx and Xms options below to override the automatic calculation of JVM heap memory.
对于生产用途,您可能希望根据您的环境进行调整。
如果是这种情况,请取消注释下面的-Xmx和Xms选项以覆盖JVM堆内存的自动计算。

//It is recommended to set min (-Xms) and max (-Xmx) heap sizes to the same value to avoid stop-the-world GC pauses during resize, and so that we can lock the heap in memory on startup to prevent any of it from being swapped out.
建议将min(-Xms)和max(-Xmx)堆大小设置为相同的值,以避免在调整大小期间停止世界GC暂停,以便我们可以在启动时将堆锁定在内存中以防止任何 它被换掉了????

-Xms4G

-Xmx4G

//Young generation size is automatically calculated by cassandra-env based on this formula: min(100 * num_cores, 1/4 * heap size) The main trade-off for the young generation is that the larger it is, the longer GC pause times will be. The shorter it is, the more expensive GC will be (usually).
年轻代大小由cassandra-env根据以下公式自动计算:min(100 * num_cores,1/4 *堆大小)年轻一代的主要权衡是,它越大,GC停顿时间越长。 它越短,GC就越昂贵(通常)。

// It is not recommended to set the young generation size if using the G1 GC, since that will override the target pause-time goal.More info: http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html
如果使用G1 GC,建议不要设置年轻代大小,因为这会超出目标暂停时间目标。 更多信息:http://www.oracle.com/technetwork/articles/java/g1gc 1984535.html
// The example below assumes a modern 8-core+ machine for decent times. If in doubt, and if you do not particularly want to tweak, go 100 MB per physical CPU core.
下面的例子假设现代的8核+机器适合不错的时间。 如果有疑问,如果您不想特别调整,请为每个物理CPU核心提供100 MB。

-Xmn800M

EXPIRATION DATE OVERFLOW POLICY

// Defines how to handle INSERT requests with TTL exceeding the maximum supported expiration date:
// * REJECT: this is the default policy and will reject any requests with expiration date timestamp after 2038-01-19T03:14:06+00:00.
// * CAP: any insert with TTL expiring after 2038-01-19T03:14:06+00:00 will expire on 2038-01-19T03:14:06+00:00 and the client will receive a warning.
// * CAP_NOWARN: same as previous, except that the client warning will not be emitted.
定义如何处理TTL超过支持的最大到期日期的INSERT请求:
//* REJECT:这是默认策略,将在2038-01 19T03:14:06 + 00:00之后拒绝任何带有到期日期时间戳的请求。
//* CAP:在2038-01-19T03:14:06 + 00:00之后TTL到期的任何插入将在2038-01-19T03:14:06 + 00:00过期,客户端将收到警告。
//* CAP_NOWARN:与上一个相同,但不会发出客户端警告。

-Dcassandra.expiration_date_overflow_policy=REJECT

GC 设置

CMS设置

-XX:+UseParNewGC

-XX:+UseConcMarkSweepGC

-XX:+CMSParallelRemarkEnabled

-XX:SurvivorRatio=8

-XX:MaxTenuringThreshold=1

-XX:CMSInitiatingOccupancyFraction=75

-XX:+UseCMSInitiatingOccupancyOnly

-XX:CMSWaitDuration=10000

-XX:+CMSParallelInitialMarkEnabled

-XX:+CMSEdenChunksRecordAlways

//some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
当通过JMX访问时,一些JVM将填满其堆,请参阅CASSANDRA-6541

-XX:+CMSClassUnloadingEnabled

G1设置(注释上一部分,取消注释下一部分已启用)

// Use the Hotspot garbage-first collector.
使用Hotspot垃圾优先收集器。

-XX:+UseG1GC

// Have the JVM do less remembered set work during STW, instead preferring concurrent GC. Reduces p99.9 latency.
让STVM在STW期间更少记住设置工作
偏好并发GC。 减少p99.9延迟。

-XX:G1RSetUpdatingPauseTimePercent=5

// Main G1GC tunable: lowering the pause target will lower throughput and vise versa. 200ms is the JVM default and lowest viable setting 1000ms increases throughput. Keep it smaller than the timeouts in cassandra.yaml.
主G1GC可调:降低暂停目标将降低吞吐量,反之亦然。
200ms是JVM默认设置和最低可行设置
1000ms增加了吞吐量。 保持小于cassandra.yaml中的超时。

-XX:MaxGCPauseMillis=500

Optional G1 Settings

//Save CPU time on large (>= 16GB) heaps by delaying region scanning until the heap is 70% full. The default in Hotspot 8u40 is 40%.
通过延迟区域扫描,将CPU时间节省在大(> = 16GB)堆上
直到堆满70%。 Hotspot 8u40的默认值为40%。

-XX:InitiatingHeapOccupancyPercent=70

For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores. Otherwise equal to the number of cores when 8 or less. Machines with > 10 cores should try setting these to <= full cores.
//对于具有> 8个内核的系统,默认的ParallelGCThreads是逻辑内核数量的5/8。否则等于8或更少的核心数。具有> 10个核心的计算机应尝试将这些设置为<=完整核心。

-XX:ParallelGCThreads=16

// By default, ConcGCThreads is 1/4 of ParallelGCThreads. Setting both to the same value can reduce STW durations.
默认情况下,ConcGCThreads是ParallelGCThreads的1/4。
将两者设置为相同的值可以减少STW持续时间。

-XX:ConcGCThreads=16

GC logging options – uncomment to enable

GC日志记录选项 - 取消注释以启用

-XX:+PrintGCDetails

-XX:+PrintGCDateStamps

-XX:+PrintHeapAtGC

-XX:+PrintTenuringDistribution

-XX:+PrintGCApplicationStoppedTime

-XX:+PrintPromotionFailure

-XX:PrintFLSStatistics=1

-Xloggc:/var/log/cassandra/gc.log

-XX:+UseGCLogFileRotation

-XX:NumberOfGCLogFiles=10

-XX:GCLogFileSize=10M

猜你喜欢

转载自blog.csdn.net/weixin_38916872/article/details/81325980
今日推荐