Skip to main content
Version: Preview

Configure cluster parameters

The KubeBlocks configuration function provides a set of consistent default configuration generation strategies for all the databases running on KubeBlocks and also provides a unified parameter configuration interface to facilitate managing parameter configuration, searching the parameter user guide, and validating parameter effectiveness.

From v0.6.0, KubeBlocks supports kbcli cluster configure and kbcli cluster edit-config to configure parameters. The difference is that KubeBlocks configures parameters automatically with kbcli cluster configure but kbcli cluster edit-config provides a visualized way for you to edit parameters directly.

  1. Get the configuration file of this cluster.

    kubectl edit configurations.apps.kubeblocks.io mycluster-redis -n demo
  2. Configure parameters according to your needs. The example below adds the - configFileParams part to configure acllog-max-len.

    spec:
    clusterRef: mycluster
    componentName: redis
    configItemDetails:
    - configSpec:
    constraintRef: redis7-config-constraints
    name: redis-replication-config
    namespace: demo
    reRenderResourceTypes:
    - vscale
    templateRef: redis7-config-template
    volumeName: redis-config
    - configFileParams:
    redis.conf:
    parameters:
    acllog-max-len: "256"
    name: mycluster-redis-redis-replication-config
  3. Connect to this cluster to verify whether the configuration takes effect.

    1. Get the username and password.

      kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
      >
      default

      kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.password}' | base64 -d
      >
      kpz77mcs
    2. Connect to this cluster and verify whether the parameters are configured as expected.

      kubectl exec -ti -n demo mycluster-redis-0 -- bash

      root@mycluster-redis-0:/# redis-cli -a kpz77mcs --user default

      127.0.0.1:6379> config get parameter acllog-max-len
      1) "acllog-max-len"
      2) "256"
note

Just in case you cannot find the configuration file of your cluster, you can switch to the kbcli tab to view the current configuration file of a cluster.