简体   繁体   English

我们如何在 k8ssandra helm 中使用 Configmap 实用程序?

[英]How do we use Configmap utility in k8ssandra helm?

I am trying to migrate cassandra DB to AKS using k8ssandra.我正在尝试使用 k8ssandra 将 cassandra DB 迁移到 AKS。 I would like to retain the source DB's cassandra.yaml configuration in the target as well, like increase the timeout parameters ( to handle client requests).我也想在目标中保留源数据库的 cassandra.yaml 配置,例如增加超时参数(以处理客户端请求)。 I see the configmap placeholder in the k8ssandra's values.yaml file.我在 k8ssandra 的 values.yaml 文件中看到了 configmap 占位符。 Would it help to retain the source configurations?保留源配置是否有帮助? Detailed guideline on how to use it is much appreciated:)非常感谢关于如何使用它的详细指南:)

Support for specifying Casssandra configs via a ConfigMap was added in this PR and made available in K8ssandra 1.4.0.在此PR中添加了通过 ConfigMap 指定 Casssandra 配置的支持,并在 K8ssandra 1.4.0 中可用。

The new chart property name is cassandraYamlConfigMap .新的图表属性名称是cassandraYamlConfigMap Here is what the docs for the property say:这是该属性的文档所说的内容:

# -- Specifies the name of a ConfigMap that contains a custom cassandra.yaml. The
# ConfigMap should have a key named cassandra.yaml. The values will be merged with the
# base configuration. The following properties should NOT be specified in the ConfigMap:
#    * cluster_name
#    * seed_provider
#    * authenticator
#    * authorizer
#    * commitlog_directory
#    * data_file_directories
#    * saved_caches_directory
#    * hints_directory
#    * endpoint_snitch

Here is an example ConfigMap:这是一个示例 ConfigMap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: cassandra-config
data:
  cassandra.yaml: |-
    auto_snapshot: false
    memtable_flush_writers: 1
    commitlog_segment_size_in_mb: 2
    concurrent_compactors: 1
    compaction_throughput_mb_per_sec: 0
    sstable_preemptive_open_interval_in_mb: 0
    key_cache_size_in_mb: 0
    prepared_statements_cache_size_mb: 1
    slow_query_log_timeout_in_ms: 0
    counter_cache_size_in_mb: 0
    concurrent_reads: 2
    concurrent_writes: 2
    concurrent_counter_writes: 2
    read_request_timeout_in_ms: 90000
    range_request_timeout_in_ms: 90000
    write_request_timeout_in_ms: 90000
    truncate_request_timeout_in_ms: 90000
    request_timeout_in_ms: 90000

Here's how this works.这是它的工作原理。 The cassandra.yaml, jvm-server-options, etc. are generated as normal when cassandraYamlConfigMap is set. cassandra.yaml、jvm-server-options 等在设置cassandraYamlConfigMap时正常生成。 After the server-config-init init container generates the configs, then a new init container called apply-custom-config does a merge using yq of the cassandra.yaml in the ConfigMap and the cassandra.yaml generated by server-config-init .server-config-init初始化容器生成配置后,一个名为apply-custom-config的新初始化容器使用 ConfigMap 中的 cassandra.yaml 和server-config-init生成的 cassandra.yaml 的 yq 进行合并。 The ConfigMap takes precedence. ConfigMap 优先。

Make sure to pay attention to the properties that should not be specified.请务必注意不应指定的属性。 No validation checks are performed on the ConfigMap.不会对 ConfigMap 执行任何验证检查。

Note that you will need to use the cassandraYamlConfigMap property if you want to configure internode encryption.请注意,如果要配置节点间加密,则需要使用cassandraYamlConfigMap属性。 See this post for a detailed explanation.有关详细说明,请参阅此帖子

Lastly, I want to point out that there is improved support for configuring cassandra.yaml in K8ssandra Operator.最后,我想指出,在 K8ssandra Operator 中改进了对配置 cassandra.yaml 的支持。 The operator does not allow you to specify a custom ConfigMap but all cassandra.yaml properties are available in the K8ssandraCluster CRD.运营商不允许您指定自定义 ConfigMap,但所有 cassandra.yaml 属性在 K8ssandraCluster CRD 中可用。 See here for an example.请参阅此处的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM