github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/kubeblocks-for-pulsar/configuration/configuration.md (about)

     1  ---
     2  title: Configure cluster parameters
     3  description: Configure cluster parameters
     4  keywords: [pulsar, parameter, configuration, reconfiguration]
     5  sidebar_position: 4
     6  ---
     7  
     8  # Configure cluster parameters
     9  
    10  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.
    11  
    12  There are 3 types of parameters:
    13  
    14  1. Environment parameters, such as GC-related parameters, `PULSAR_MEM`, and `PULSAR_GC`, changes will apply to all components;
    15  2. Configuration parameters, such as `zookeeper` or `bookies.conf` configuration files, can be changed through `env` and changes restart the pod;
    16  3. Dynamic parameters, such as configuration files in `brokers.conf`, `broker` supports two types of change modes:
    17      a. Parameter change requires a restart, such as `zookeeperSessionExpiredPolicy`;
    18      b. For parameters that support dynamic parameters, you can obtain a list of all dynamic parameters with `pulsar-admin brokers list-dynamic-config`.
    19  
    20  :::note
    21  
    22  `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](https://pulsar.apache.org/docs/3.0.x/admin-api-tools/
    23  )
    24  :::
    25  
    26  ## View parameter information
    27  
    28  View the current configuration file of a cluster.
    29  
    30  ```bash
    31  kbcli cluster describe-config pulsar  
    32  ```
    33  
    34  * View the details of the current configuration file.
    35  
    36    ```bash
    37    kbcli cluster describe-config pulsar --show-detail
    38    ```
    39  
    40  * View the parameter description.
    41  
    42    ```bash
    43    kbcli cluster explain-config pulsar | head -n 20
    44    ```
    45  
    46  ## Configure parameters
    47  
    48  ### Configure parameters with configure command
    49  
    50  #### Configure environment parameters
    51  
    52  ***Steps***
    53  
    54  1. You need to specify the component name to configure parameters. Get the pulsar cluster component name.
    55  
    56    ```bash
    57    kbcli cluster list-components pulsar 
    58    ```
    59  
    60    ***Example***
    61  
    62    ```bash
    63    kbcli cluster list-components pulsar 
    64  
    65    NAME               NAMESPACE   CLUSTER   TYPE               IMAGE
    66    proxy              default     pulsar    pulsar-proxy       docker.io/apecloud/pulsar:2.11.2
    67    broker             default     pulsar    pulsar-broker      docker.io/apecloud/pulsar:2.11.2
    68    bookies-recovery   default     pulsar    bookies-recovery   docker.io/apecloud/pulsar:2.11.2
    69    bookies            default     pulsar    bookies            docker.io/apecloud/pulsar:2.11.2
    70    zookeeper          default     pulsar    zookeeper          docker.io/apecloud/pulsar:2.11.2
    71    ```
    72  
    73  2. Configure parameters.
    74  
    75     We take `zookeeper` as an example.
    76  
    77     ```bash
    78     kbcli cluster configure pulsar --component=zookeeper --set PULSAR_MEM="-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=70" 
    79     ```
    80  
    81  3. Verify the configuration.
    82  
    83     a. Check the progress of configuration:
    84  
    85     ```bash
    86     kubectl get ops 
    87     ```
    88  
    89     b.Check whether the configuration is done.
    90  
    91     ```bash
    92     kubectl get pod -l app.kubernetes.io/name=pulsar
    93     ```
    94  
    95  #### Configure other parameters
    96  
    97  The following steps take the configuration of dynamic parameter `brokerShutdownTimeoutMs` as an example.
    98  
    99  ***Steps***
   100  
   101  1. Get configuration information.
   102  
   103     ```bash
   104     kbcli cluster desc-config pulsar --component=broker
   105     
   106     ConfigSpecs Meta:
   107     CONFIG-SPEC-NAME         FILE                   ENABLED   TEMPLATE                   CONSTRAINT                   RENDERED                               COMPONENT   CLUSTER
   108     agamotto-configuration   agamotto-config.yaml   false     pulsar-agamotto-conf-tpl                                pulsar-broker-agamotto-configuration   broker      pulsar
   109     broker-env               conf                   true      pulsar-broker-env-tpl      pulsar-env-constraints       pulsar-broker-broker-env               broker      pulsar
   110     broker-config            broker.conf            true      pulsar-broker-config-tpl   brokers-config-constraints   pulsar-broker-broker-config            broker      pulsar
   111     ```
   112  
   113  2. Configure parameters.
   114  
   115     ```bash
   116     kbcli cluster configure pulsar --component=broker --config-spec=broker-config --set brokerShutdownTimeoutMs=66600
   117     >
   118     Will updated configure file meta:
   119       ConfigSpec: broker-config          ConfigFile: broker.conf        ComponentName: broker        ClusterName: pulsar
   120     OpsRequest pulsar-reconfiguring-qxw8s created successfully, you can view the progress:
   121             kbcli cluster describe-ops pulsar-reconfiguring-qxw8s -n default
   122     ```
   123  
   124  3. Check the progress of configuration.
   125  
   126     The ops name is printed with the command above.
   127  
   128     ```bash
   129     kbcli cluster describe-ops pulsar-reconfiguring-qxw8s -n default
   130     >
   131     Spec:
   132       Name: pulsar-reconfiguring-qxw8s        NameSpace: default        Cluster: pulsar        Type: Reconfiguring
   133  
   134     Command:
   135       kbcli cluster configure pulsar --components=broker --config-spec=broker-config --config-file=broker.conf --set brokerShutdownTimeoutMs=66600 --namespace=default
   136  
   137     Status:
   138       Start Time:         Jul 20,2023 09:53 UTC+0800
   139       Completion Time:    Jul 20,2023 09:53 UTC+0800
   140       Duration:           1s
   141       Status:             Succeed
   142       Progress:           2/2
   143                           OBJECT-KEY   STATUS   DURATION   MESSAGE
   144     ```
   145  
   146  ### Configure parameters with edit-config command
   147  
   148  For your convenience, KubeBlocks offers a tool `edit-config` to help you to configure parameter in a visulized way.
   149  
   150  For Linux and macOS, you can edit configuration files by vi. For Windows, you can edit files on notepad.
   151  
   152  1. Edit the configuration file.
   153  
   154     ```bash
   155     kbcli cluster edit-config pulsar
   156     ```
   157  
   158  :::note
   159  
   160  If there are multiple components in a cluster, use `--component` to specify a component.
   161  
   162  :::
   163  
   164  2. View the status of the parameter configuration.
   165  
   166     ```bash
   167     kbcli cluster describe-ops xxx -n default
   168     ```
   169  
   170  3. Connect to the database to verify whether the parameters are configured as expected.
   171  
   172     ```bash
   173     kbcli cluster connect pulsar
   174     ```
   175  
   176  :::note
   177  
   178  1. For the `edit-config` function, static parameters and dynamic parameters cannot be edited at the same time.
   179  2. Deleting a parameter will be supported later.
   180  
   181  :::
   182  
   183  ### Configure parameters with kubectl
   184  
   185  Using kubectl to configure pulsar cluster requires modifying the configuration file.
   186  
   187  ***Steps***
   188  
   189  1. Get the configmap where the configuration file is located. Take `broker` component as an example.
   190  
   191      ```bash
   192      kbcli cluster desc-config pulsar --component=broker
   193  
   194      ConfigSpecs Meta:
   195      CONFIG-SPEC-NAME         FILE                   ENABLED   TEMPLATE                   CONSTRAINT                   RENDERED                               COMPONENT   CLUSTER
   196      agamotto-configuration   agamotto-config.yaml   false     pulsar-agamotto-conf-tpl                                pulsar-broker-agamotto-configuration   broker      pulsar
   197      broker-env               conf                   true      pulsar-broker-env-tpl      pulsar-env-constraints       pulsar-broker-broker-env               broker      pulsar
   198      broker-config            broker.conf            true      pulsar-broker-config-tpl   brokers-config-constraints   pulsar-broker-broker-config            broker      pulsar
   199      ```
   200  
   201      In the rendered colume of the above output, you can check the broker's configmap is `pulsar-broker-broker-config`.
   202  
   203  2. Modify the `broker.conf` file, in this case, it is `pulsar-broker-broker-config`.
   204  
   205      ```bash
   206      kubectl edit cm pulsar-broker-broker-config
   207      ```