Changing the coordination service from embedded ClickHouse® Keeper to ClickHouse® Keeper on separate hosts
If using embedded ClickHouse® Keeper as a coordination service, you can change it to ClickHouse® Keeper on separate hosts. Once you enable ClickHouse® Keeper on separate hosts, you cannot disable it or switch back to embedded ClickHouse® Keeper.
Warning
ClickHouse® Keeper hosts are counted towards the cloud resource quota
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id.
If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
To change the coordination service:
-
View the command description:
yc managed-clickhouse cluster add-zookeeper --help -
In the command, specify the following host parameters:
yc managed-clickhouse cluster add-zookeeper \ --name <cluster_name> \ --resource-preset <host_class> \ --disk-type <disk_type> \ --disk-size <storage_size> \ --host type=keeper,` `zone-id=<availability_zone>,` `subnet-id=<subnet_ID> \ --convert-tables-to-replicated <convert_tables>Where:
-
--resource-preset: Host class. -
--disk-type: Disk type. -
--disk-size: Storage size, in bytes. -
--host: Host settings:-
type: Host type,keeper. -
zone-id: Availability zone. -
subnet-id: Subnet ID. Specify if the selected availability zone has two or more subnets.
You can add multiple hosts at once. Specify a separate
--hostflag for each host. -
-
--convert-tables-to-replicated: Convert non-replicated tables to replicated ones.
You can get the cluster name from the list of clusters in your folder.
-
To change the coordination service:
-
Get an IAM token for API authentication and put it into an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the Cluster.AddZookeeper method, e.g., via the following cURL
request:-
Create a file named
body.jsonand paste the following code into it:{ "resources": { "resourcePresetId": "<host_class>", "diskSize": "<storage_size>", "diskTypeId": "<disk_type>" }, "hostSpecs": [ { "zoneId": "<availability_zone>", "type": "KEEPER", "subnetId": "<subnet_ID>" } ], "convertTablesToReplicated": <convert_tables> }Where:
-
resources: Host configuration:resourcePresetId: Host class ID. You can get the list of available host classes with their IDs using the ResourcePreset.list method.diskSize: Storage size, in bytes.diskTypeId: Disk type.
-
hostSpecs: Host settings as an array of elements, one per host. Each element has the following structure:-
zoneId: Availability zone. -
type: Host type,KEEPER. -
subnetId: Subnet ID.
-
-
convertTablesToReplicated: Convert non-replicated tables to replicated ones.
You can get the cluster ID with the list of clusters in the folder.
-
-
Run this request:
curl \ --request POST \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/<cluster_ID>:addZookeeper' \ --data '@body.json'
-
-
View the server response to make sure your request was successful.
To change the coordination service:
-
Get an IAM token for API authentication and put it into an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the ClusterService.AddZookeeper method, e.g., via the following gRPCurl
request:-
Create a file named
body.jsonand paste the following code into it:{ "cluster_id": "<cluster_ID>", "resources": { "resource_preset_id": "<host_class>", "disk_size": "<storage_size>", "disk_type_id": "<disk_type>" }, "host_specs": [ { "zone_id": "<availability_zone>", "type": "KEEPER", "subnet_id": "<subnet_ID>", } ], "convert_tables_to_replicated": <convert_tables> }Where:
-
resources: Host configuration:resource_preset_id: Host class ID. You can get the list of available host classes with their IDs using the ResourcePresetService.List method.disk_size: Storage size, in bytes.disk_type_id: Disk type.
-
host_specs: Host settings as an array of elements, one per host. Each element has the following structure:-
zone_id: Availability zone. -
type: Host type,KEEPER. -
subnet_id: Subnet ID.
-
-
convertTablesToReplicated: Convert non-replicated tables to replicated ones.
You can get the cluster ID with the list of clusters in the folder.
-
-
Run this request:
grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/clickhouse/v1/cluster_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d @ \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.clickhouse.v1.ClusterService.addZookeeper \ < body.json
-
-
Check the server response to make sure your request was successful.
ClickHouse® is a registered trademark of ClickHouse, Inc