diff --git a/examples/clickhouse/README.md b/examples/clickhouse/README.md index 3eecd2e76..4b7bfee6e 100644 --- a/examples/clickhouse/README.md +++ b/examples/clickhouse/README.md @@ -7,7 +7,6 @@ There are two key components in the ClickHouse cluster: - ClickHouse Server: The ClickHouse server is responsible for processing queries and managing data storage. - ClickHouse Keeper: The ClickHouse Keeper is responsible for monitoring the health of the ClickHouse server and performing failover operations when necessary, alternative to the Zookeeper. - ## Features In KubeBlocks ### Lifecycle Management @@ -16,15 +15,11 @@ There are two key components in the ClickHouse cluster: |------------------|------------------------|-----------------------|-------------------|-----------|------------|-----------|--------|------------| | standalone/cluster | Yes | Yes | Yes | Yes | Yes | Yes | No | N/A | -### Backup and Restore - -| Feature | Method | Description | -|-------------|--------|------------| - ### Versions | Major Versions | Description | |---------------|-------------| +| 22 | 22.9.4 | | 24 | 24.8.3| ## Prerequisites @@ -212,6 +207,60 @@ Increase size of volume storage with the specified components in the cluster kubectl apply -f examples/clickhouse/volumeexpand.yaml ``` +### [Reconfigure](configure.yaml) + +Reconfigure parameters with the specified components in the cluster + +```bash +kubectl apply -f examples/clickhouse/reconfigure.yaml +``` + +This example will change the `max_bytes_to_read` to `200000000000`. +To verify the configuration, you can connect to the ClickHouse server and run the following command: + +```bash +# connect to the clickhouse pod +kubectl exec -it clickhouse-cluster-clickhouse-0 -- /bin/bash +``` + +and check the configuration: + +```bash +# connect to the clickhouse server +clickhouse-client --user $CLICKHOUSE_ADMIN_USER --password $CLICKHOUSE_ADMIN_PASSWORD +> set profile='web'; +> select name,value from system.settings where name like 'max_bytes%'; + +
+ +The `user.xml` file is an xml file that contains the configuration of the ClickHouse server. +```xml + + + + + 8 + + + 1000000000 + 100000000000 + + + +``` + +When updating the configuration, the key we set in the `reconfigure.yaml` file should be the same as the key in the `user.xml` file, for example: + +```yaml +- key: user.xml + parameters: + - key: clickhouse.profiles.web.max_bytes_to_read + value: '200000000000' +``` + +To update parameter `max_bytes_to_read`, we use the full path `clickhouse.profiles.web.max_bytes_to_read` w.r.t the `user.xml` file. +
+ ### [Restart](restart.yaml) Restart the specified components in the cluster @@ -276,5 +325,4 @@ kubectl delete cluster clickhouse-cluster # delete secret udf-account-info if exists # kubectl delete secret udf-account-info -``` - +``` \ No newline at end of file diff --git a/examples/clickhouse/reconfig.yaml b/examples/clickhouse/reconfig.yaml new file mode 100644 index 000000000..1f3084726 --- /dev/null +++ b/examples/clickhouse/reconfig.yaml @@ -0,0 +1,34 @@ +apiVersion: operations.kubeblocks.io/v1alpha1 +kind: OpsRequest +metadata: + name: ch-reconfiguring + namespace: default +spec: + # Specifies the name of the Cluster resource that this operation is targeting. + clusterName: clickhouse-cluster + # Instructs the system to bypass pre-checks (including cluster state checks and customized pre-conditions hooks) and immediately execute the opsRequest, except for the opsRequest of 'Start' type, which will still undergo pre-checks even if `force` is true. Note: Once set, the `force` field is immutable and cannot be updated. + force: false + # Specifies a component and its configuration updates. This field is deprecated and replaced by `reconfigures`. + reconfigures: + # Specifies the name of the Component. + - componentName: clickhouse + # Contains a list of ConfigurationItem objects, specifying the Component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. + configurations: + # Sets the parameters to be updated. It should contain at least one item. + # The keys are merged and retained during patch operations. + - keys: + # Represents the unique identifier for the ConfigMap. + - key: user.xml + # Defines a list of key-value pairs for a single configuration file. + # These parameters are used to update the specified configuration settings. + parameters: + # Represents the name of the parameter that is to be updated. + - key: clickhouse.profiles.web.max_bytes_to_read + # Represents the parameter values that are to be updated. + # If set to nil, the parameter defined by the Key field will be removed from the configuration file. + value: '200000000000' + # Specifies the name of the configuration template. + name: clickhouse-user-tpl + # Specifies the maximum number of seconds the OpsRequest will wait for its start conditions to be met before aborting. If set to 0 (default), the start conditions must be met immediately for the OpsRequest to proceed. + preConditionDeadlineSeconds: 0 + type: Reconfiguring \ No newline at end of file