Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for ClickHouse®
  • Getting started
    • All guides
      • Managing a custom geobase
      • Connecting external dictionaries
      • Managing data format schemas
      • Managing machine learning models
      • Setting up access to Object Storage
  • Access management
  • Pricing policy
  • Terraform reference
  • Yandex Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Creating a geobase
  • Uploading a geobase to Yandex Object Storage
  • Adding a geobase to a ClickHouse® cluster
  • Removing a geobase
  1. Step-by-step guides
  2. Storing and processing data
  3. Managing a custom geobase

Managing a custom geobase in Managed Service for ClickHouse®

Written by
Yandex Cloud
Updated at December 17, 2025
  • Creating a geobase
  • Uploading a geobase to Yandex Object Storage
  • Adding a geobase to a ClickHouse® cluster
  • Removing a geobase

A ClickHouse® geobase consists of text files containing the names and hierarchy of regions. You can add several alternative geobases to ClickHouse® to reflect different points of view on what regions belong to what countries. For more information, see this ClickHouse® guide.

To add a custom geobase to a ClickHouse® cluster:

  1. Create a geobase.
  2. Upload the geobase to Yandex Object Storage.
  3. Add the geobase to a ClickHouse® cluster.

If you are not using your custom geobase, remove it.

Creating a geobaseCreating a geobase

  1. Create a file named regions_hierarchy.txt. It must be a TSV table without headers, containing the following columns:

    • Region ID (UInt32)
    • Parent region ID (UInt32)
    • Region type (UInt8):
      • 1: Continent
      • 3: Country
      • 4: Federal district
      • 5: Region
      • 6: City
    • Population (UInt32): Optional column.
  2. To add an alternative hierarchy of regions, create the regions_hierarchy_<suffix>.txt files with the same structure. To use an alternative geobase, provide this suffix when calling the function. Here is an example:

    • regionToCountry(RegionID): Uses the default dictionary, regions_hierarchy.txt.
    • regionToCountry(RegionID, 'alt'): Uses the dictionary with the alt suffix, regions_hierarchy_alt.txt.
  3. Create a file named regions_names.txt. It must be a TSV table without headers, containing the following columns:

    • Region ID (UInt32).
    • Region name (String): Cannot contain tab or newline characters, even escaped ones.
  4. To add region names in other languages to your geobase, create the regions_names_<language_code>.txt files with the same structure. For example, you can create regions_names_en.txt for English and regions_names_tr.txt for Turkish.

  5. Create a tar, tar.gz, or zip archive from the geobase files.

Uploading a geobase to Yandex Object StorageUploading a geobase to Yandex Object Storage

Managed Service for ClickHouse® only works with geobases uploaded to Yandex Object Storage and accessible for reading:

  1. To attach a service account to a cluster, assign the iam.serviceAccounts.user role or higher to your Yandex Cloud account.
  2. Upload the geobase archive to Yandex Object Storage.
  3. Attach the service account to the cluster. You will use this service account to configure access to the geobase archive.
  4. Assign the storage.viewer role to the service account.
  5. In the bucket ACL, add the READ permission to the service account.
  6. Get a link to the geobase archive.

Adding a geobase to a ClickHouse® clusterAdding a geobase to a ClickHouse® cluster

Management console
CLI
Terraform
REST API
gRPC API
  1. In the management console, select the folder the cluster is in.
  2. Go to Managed Service for ClickHouse.
  3. Select your cluster and click Edit in the top panel.
  4. Under DBMS settings, click Settings.
  5. In the Geobase uri field, enter a link to the geobase archive in Yandex Object Storage.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To add a geobase:

  1. View the description of the CLI command to update the cluster configuration:

    yc managed-clickhouse cluster update-config --help
    
  2. Run this command, providing the link to the archive with the geobase being added in the geobase_uri parameter:

    yc managed-clickhouse cluster update-config <cluster_name_or_ID> \
         --set geobase_uri="<link_to_geobase_archive_in_Object_Storage>"
    

    You can request the cluster ID and name with the list of clusters in the folder.

  1. Open the current Terraform configuration file describing your infrastructure.

    For information on how to create such a file, see Creating a cluster.

  2. In the Managed Service for ClickHouse® cluster settings, add the geobase_uri parameter with the link to the archive containing the geobase being added in Yandex Object Storage:

    resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
      ...
      clickhouse {
        config {
          geobase_uri = "<link_to_geobase_archive_in_Object_Storage>"
          ...
        }
      ...
      }
    ...
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see this Terraform provider guide.

Timeouts

The Terraform provider sets the following timeouts for Managed Service for ClickHouse® cluster operations:

  • Creating a cluster, including by restoring from a backup: 60 minutes.
  • Updating a cluster: 90 minutes.
  • Deleting a cluster: 30 minutes.

Operations exceeding the timeout are aborted.

How do I change these limits?

Add a timeouts section to the cluster description, e.g.:

resource "yandex_mdb_clickhouse_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Cluster.Update method, e.g., via the following cURL request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
        --request PATCH \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/<cluster_ID>' \
        --data '{
                  "updateMask": "configSpec.clickhouse.config.geobaseUri",
                  "configSpec": {
                    "clickhouse": {
                      "config": {
                        "geobaseUri": "<link>"
                      }
                    }
                  }
                }'
    

    Where:

    • updateMask: Comma-separated list of settings you want to update.

      Here, we only specified a single setting, configSpec.clickhouse.config.geobaseUri.

    • configSpec.clickhouse.config.geobaseUri: Link to the geobase archive in Object Storage.

    You can get the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Call the ClusterService.Update method, e.g., via the following gRPCurl request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    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 '{
              "cluster_id": "<cluster_ID>",
              "update_mask": {
                "paths": [
                  "config_spec.clickhouse.config.geobase_uri"
                ]
              },
              "config_spec": {
                "clickhouse": {
                  "config": {
                    "geobase_uri": "<link>"
                  }
                }
              }
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.clickhouse.v1.ClusterService.Update
    

    Where:

    • update_mask: List of settings you want to update as an array of strings (paths[]).

      Here, we only specified a single setting, config_spec.clickhouse.config.geobase_uri.

    • config_spec.clickhouse.config.geobase_uri: Link to the geobase archive in Object Storage.

    You can get the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure your request was successful.

Removing a geobaseRemoving a geobase

Management console
CLI
REST API
gRPC API
  1. In the management console, select the folder the cluster is in.
  2. Go to Managed Service for ClickHouse.
  3. Select your cluster and click Edit in the top panel.
  4. Under DBMS settings, click Settings.
  5. Delete the value in the Geobase uri field.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To remove a geobase:

  1. View the description of the CLI command to update the cluster configuration:

    yc managed-clickhouse cluster update-config --help
    
  2. Run this command, providing an empty value in the geobase_uri parameter:

    yc managed-clickhouse cluster update-config <cluster_name_or_ID> \
         --set geobase_uri=""
    

    You can get the cluster ID and name with the list of clusters in the folder.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Cluster.Update method, e.g., via the following cURL request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
        --request PATCH \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://mdb.api.cloud.yandex.net/managed-clickhouse/v1/clusters/<cluster_ID>' \
        --data '{
                  "updateMask": "configSpec.clickhouse.config.geobaseUri",
                  "configSpec": {
                    "clickhouse": {
                      "config": {
                        "geobaseUri": ""
                      }
                    }
                  }
                }'
    

    Where:

    • updateMask: Comma-separated list of settings you want to update.

      Here, we only specified a single setting, configSpec.clickhouse.config.geobaseUri.

    • configSpec.clickhouse.config.geobaseUri: Link to the geobase archive in Object Storage. Set an empty value for this parameter.

    You can get the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Call the ClusterService.Update method, e.g., via the following gRPCurl request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    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 '{
              "cluster_id": "<cluster_ID>",
              "update_mask": {
                "paths": [
                  "config_spec.clickhouse.config.geobase_uri"
                ]
              },
              "config_spec": {
                "clickhouse": {
                  "config": {
                    "geobase_uri": ""
                  }
                }
              }
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.clickhouse.v1.ClusterService.Update
    

    Where:

    • update_mask: List of settings you want to update as an array of strings (paths[]).

      Here, we only specified a single setting, config_spec.clickhouse.config.geobase_uri.

    • config_spec.clickhouse.config.geobase_uri: Link to the geobase archive in Object Storage. Set an empty value for this parameter.

    You can get the cluster ID with the list of clusters in the folder.

  4. Check the server response to make sure your request was successful.

ClickHouse® is a registered trademark of ClickHouse, Inc.

Was the article helpful?

Previous
DB user management
Next
Connecting external dictionaries
© 2025 Direct Cursus Technology L.L.C.