Skip to main content
Version: Preview

Configure cluster parameters

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.

There are 3 types of parameters:

  1. Environment parameters, such as GC-related parameters, PULSAR_MEM, and PULSAR_GC, changes will apply to all components;
  2. Configuration parameters, such as zookeeper or bookies.conf configuration files, can be changed through env and changes restart the pod;
  3. Dynamic parameters, such as configuration files in brokers.conf, broker supports two types of change modes: a. Parameter change requires a restart, such as zookeeperSessionExpiredPolicy; b. For parameters that support dynamic parameters, you can obtain a list of all dynamic parameters with pulsar-admin brokers list-dynamic-config.
note

pulsar-admin is a management tool built in the Pulsar cluster. You can log in to the corresponding pod with kubectl exec -it <pod-name> -- bash (pod-name can be checked by kubectl get pods command, and you can choose any pod with the word broker in its name ), and there are corresponding commands in the /pulsar/bin path of the pod. For more information about pulsar-admin, please refer to the official documentation.

View parameter information

View the current configuration file of a cluster.

kbcli cluster describe-config mycluster -n demo  
  • View the details of the current configuration file.

    kbcli cluster describe-config mycluster -n demo --show-detail
  • View the parameter description.

    kbcli cluster explain-config mycluster -n demo | head -n 20

Configure parameters

Configure parameters with configure command

Configure environment parameters

Steps

  1. You need to specify the component name to configure parameters. Get the pulsar cluster component name.

    kbcli cluster list-components mycluster -n demo 
    >
    NAME NAMESPACE CLUSTER TYPE IMAGE
    proxy demo mycluster pulsar-proxy docker.io/apecloud/pulsar:2.11.2
    broker demo mycluster pulsar-broker docker.io/apecloud/pulsar:2.11.2
    bookies-recovery demo mycluster bookies-recovery docker.io/apecloud/pulsar:2.11.2
    bookies demo mycluster bookies docker.io/apecloud/pulsar:2.11.2
    zookeeper demo mycluster zookeeper docker.io/apecloud/pulsar:2.11.2
  2. Configure parameters.

    We take zookeeper as an example.

    kbcli cluster configure mycluster -n demo --components=zookeeper --set PULSAR_MEM="-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=70" 
  3. Verify the configuration.

    a. Check the progress of configuration:

    kubectl get ops -n demo

    b. Check whether the configuration is done.

    kubectl get pod -l app.kubernetes.io/name=pulsar -n demo

Configure other parameters

The following steps take the configuration of dynamic parameter brokerShutdownTimeoutMs as an example.

Steps

  1. Get configuration information.

    kbcli cluster desc-config mycluster -n demo --components=broker
    >
    ConfigSpecs Meta:
    CONFIG-SPEC-NAME FILE ENABLED TEMPLATE CONSTRAINT RENDERED COMPONENT CLUSTER
    agamotto-configuration agamotto-config.yaml false pulsar-agamotto-conf-tpl mycluster-broker-agamotto-configuration broker mycluster
    broker-env conf true pulsar-broker-env-tpl pulsar-env-constraints mycluster-broker-broker-env broker mycluster
    broker-config broker.conf true pulsar-broker-config-tpl brokers-config-constraints mycluster-broker-broker-config broker mycluster
  2. Configure parameters.

    kbcli cluster configure mycluster -n demo --components=broker --config-specs=broker-config --set brokerShutdownTimeoutMs=66600
    >
    Will updated configure file meta:
    ConfigSpec: broker-config ConfigFile: broker.conf ComponentName: broker ClusterName: mycluster
    OpsRequest mycluster-reconfiguring-qxw8s created successfully, you can view the progress:
    kbcli cluster describe-ops mycluster-reconfiguring-qxw8s -n demo
  3. Check the progress of configuration.

    The ops name is printed with the command above.

    kbcli cluster describe-ops mycluster-reconfiguring-qxw8s -n demo
    >
    Spec:
    Name: mycluster-reconfiguring-qxw8s NameSpace: demo Cluster: mycluster Type: Reconfiguring

    Command:
    kbcli cluster configure mycluster --components=broker --config-specs=broker-config --config-file=broker.conf --set brokerShutdownTimeoutMs=66600 --namespace=demo

    Status:
    Start Time: Jul 20,2023 09:53 UTC+0800
    Completion Time: Jul 20,2023 09:53 UTC+0800
    Duration: 1s
    Status: Succeed
    Progress: 2/2
    OBJECT-KEY STATUS DURATION MESSAGE

Configure parameters with edit-config command

For your convenience, KubeBlocks offers a tool called edit-config to help you to configure parameter in a visualized way.

For Linux and macOS, you can edit configuration files by vi. For Windows, you can edit files on notepad.

  1. Edit the configuration file.

    kbcli cluster edit-config mycluster -n demo
    note

    If there are multiple components in a cluster, use --components to specify a component.

  2. View the status of the parameter configuration.

    kbcli cluster describe-ops mycluster-reconfiguring-nqxw8s -n demo
  3. Connect to the database to verify whether the parameters are configured as expected.

    kbcli cluster connect mycluster -n demo
    note
    1. When using the edit-config function, static parameters and dynamic parameters cannot be edited at the same time.
    2. Deleting a parameter will be supported later.

View history and compare differences

After the configuration is completed, you can search the configuration history and compare the parameter differences.

View the parameter configuration history.

kbcli cluster describe-config mycluster -n demo --components=zookeeper

From the above results, there are three parameter modifications.

Compare these modifications to view the configured parameters and their different values for different versions.

kbcli cluster diff-config mycluster-reconfiguring-qxw8s mycluster-reconfiguring-mwbnw