github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/kubeblocks-for-kafka/configuration/configuration.md (about) 1 --- 2 title: Configure cluster parameters 3 description: Configure cluster parameters 4 keywords: [kafka, parameter, configuration, reconfiguration] 5 sidebar_position: 1 6 --- 7 8 # Configure cluster parameters 9 10 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. 11 12 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. 13 14 ## View parameter information 15 16 View the current configuration file of a cluster. 17 18 ```bash 19 kbcli cluster describe-config mykafka 20 ``` 21 22 From the meta information, the cluster `mykafka` has a configuration file named `server.properties`. 23 24 You can also view the details of this configuration file and parameters. 25 26 * View the details of the current configuration file. 27 28 ```bash 29 kbcli cluster describe-config mykafka --show-detail 30 ``` 31 32 * View the parameter description. 33 34 ```bash 35 kbcli cluster explain-config mykafka | head -n 20 36 ``` 37 38 * View the user guide of a specified parameter. 39 40 ```bash 41 kbcli cluster explain-config mykafka --param=log.cleanup.policy 42 ``` 43 44 <details> 45 46 <summary>Output</summary> 47 48 ```bash 49 template meta: 50 ConfigSpec: kafka-configuration-tpl ComponentName: broker ClusterName: mykafka 51 52 Configure Constraint: 53 Parameter Name: log.cleanup.policy 54 Allowed Values: "compact","delete" 55 Scope: Global 56 Dynamic: false 57 Type: string 58 Description: The default cleanup policy for segments beyond the retention window. A comma separated list of valid policies. 59 ``` 60 61 </details> 62 63 * Allowed Values: It defines the valid value range of this parameter. 64 * Dynamic: The value of `Dynamic` in `Configure Constraint` defines how the parameter configuration takes effect. Currerntly, Kafka only supports static strategy, i.e. `Dynamic` is `false`. Restarting is required to make configuration effective. 65 * Description: It describes the parameter definition. 66 67 ## Configure parameters 68 69 ### Configure parameters with configure command 70 71 1. View the current value of `log.cleanup.policy`. 72 73 ```bash 74 kbcli cluster describe-config mykafka --show-detail | grep log.cleanup.policy 75 > 76 log.cleanup.policy=delete 77 ``` 78 79 2. Adjust the value of `log.cleanup.policy`. 80 81 ```bash 82 kbcli cluster configure mykafka --set=log.cleanup.policy=compact 83 ``` 84 85 :::note 86 87 Make sure the value you set is within the Allowed Values of this parameter. Otherwise, the configuration may fail. 88 89 ::: 90 91 3. View the status of the parameter configuration. 92 93 `Status.Progress` and `Status.Status` shows the overall status of the parameter configuration and Conditions show the details. 94 95 When the `Status.Status` shows `Succeed`, the configuration is completed. 96 97 <details> 98 99 <summary>Output</summary> 100 101 ```bash 102 # In progress 103 kbcli cluster describe-ops mykafka-reconfiguring-wvqns -n default 104 > 105 Spec: 106 Name: mykafka-reconfiguring-wvqns NameSpace: default Cluster: mykafka Type: Reconfiguring 107 108 Command: 109 kbcli cluster configure mykafka --components=broker --config-spec=kafka-configuration-tpl --config-file=server.properties --set log.cleanup.policy=compact --namespace=default 110 111 Status: 112 Start Time: Sep 14,2023 16:28 UTC+0800 113 Duration: 5s 114 Status: Running 115 Progress: 0/1 116 OBJECT-KEY STATUS DURATION MESSAGE 117 ``` 118 119 ```bash 120 # Parameter reconfiguration is completed 121 kbcli cluster describe-ops mykafka-reconfiguring-wvqns -n default 122 > 123 Spec: 124 Name: mykafka-reconfiguring-wvqns NameSpace: default Cluster: mykafka Type: Reconfiguring 125 126 Command: 127 kbcli cluster configure mykafka --components=broker --config-spec=kafka-configuration-tpl --config-file=server.properties --set log.cleanup.policy=compact --namespace=default 128 129 Status: 130 Start Time: Sep 14,2023 16:28 UTC+0800 131 Completion Time: Sep 14,2023 16:28 UTC+0800 132 Duration: 25s 133 Status: Succeed 134 Progress: 1/1 135 OBJECT-KEY STATUS DURATION MESSAGE 136 ``` 137 138 </details> 139 140 4. View the configuration file to verify whether the parameter is configured as expected. 141 142 The whole searching process has a 30-second delay. 143 144 ```bash 145 kbcli cluster describe-config mykafka --show-detail | grep log.cleanup.policy 146 > 147 log.cleanup.policy = compact 148 mykafka-reconfiguring-wvqns mykafka broker kafka-configuration-tpl server.properties Succeed restart 1/1 Sep 14,2023 16:28 UTC+0800 {"server.properties":"{\"log.cleanup.policy\":\"compact\"}"} 149 ``` 150 151 ### Configure parameters with edit-config command 152 153 For your convenience, KubeBlocks offers a tool `edit-config` to help you to configure parameter in a visulized way. 154 155 For Linux and macOS, you can edit configuration files by vi. For Windows, you can edit files on notepad. 156 157 1. Edit the configuration file. 158 159 ```bash 160 kbcli cluster edit-config mykafka 161 ``` 162 163 :::note 164 165 If there are multiple components in a cluster, use `--component` to specify a component. 166 167 ::: 168 169 2. View the status of the parameter configuration. 170 171 ```bash 172 kbcli cluster describe-ops xxx -n default 173 ``` 174 175 3. Connect to the database to verify whether the parameters are configured as expected. 176 177 ```bash 178 kbcli cluster connect mykafka 179 ``` 180 181 :::note 182 183 1. For the `edit-config` function, static parameters and dynamic parameters cannot be edited at the same time. 184 2. Deleting a parameter will be supported later. 185 186 ::: 187 188 ## View history and compare differences 189 190 After the configuration is completed, you can search the configuration history and compare the parameter differences. 191 192 View the parameter configuration history. 193 194 ```bash 195 kbcli cluster describe-config mykafka 196 ``` 197 198 From the above results, there are three parameter modifications. 199 200 Compare these modifications to view the configured parameters and their different values for different versions. 201 202 ```bash 203 kbcli cluster diff-config mykafka-reconfiguring-wvqns mykafka-reconfiguring-hxqfx 204 > 205 DIFF-CONFIG RESULT: 206 ConfigFile: server.properties TemplateName: kafka-configuration-tpl ComponentName: broker ClusterName: mykafka UpdateType: update 207 208 PARAMETERNAME MYKAFKA-RECONFIGURING-WVQNS MYKAFKA-RECONFIGURING-HXQFX 209 log.retention.hours 168 200 210 ```