Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Solutions
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Managed Service for ClickHouse
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Information about existing clusters
    • Creating clusters
    • How to connect to a database
    • Stopping and starting clusters
    • SQL queries in the management console
    • Changing cluster and database settings
    • Connecting external dictionaries
    • Adding your own geobase
    • Enabling machine learning models
    • Managing data format schemas
    • Connecting to DataLens
    • Changing ClickHouse versions
    • Managing ClickHouse hosts
    • Managing ZooKeeper hosts
    • Database management
    • Managing database users
    • Managing backups
    • Managing shards
    • Managing groups of shards
    • Deleting clusters
  • Use cases
    • Adding data to the database
    • Sharding tables
    • Using hybrid storage
    • Getting data from Managed Service for Apache Kafka®
  • Concepts
    • Relationship between service resources
    • Host classes
      • Active host classes
      • Archive
        • Before June 1, 2020
      • Using deprecated host classes
    • Network in Yandex Managed Service for ClickHouse
    • Quotas and limits
    • Storage types
    • Backups
    • Replication
    • Dictionaries
    • Sharding
    • Supported clients
    • ClickHouse versioning policy
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Before January 1, 2019
      • From January 1 to March 1, 2019
      • From March 1, 2019 to February 1, 2020
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • BackupService
      • ClusterService
      • DatabaseService
      • FormatSchemaService
      • MlModelService
      • ResourcePresetService
      • UserService
      • VersionsService
      • OperationService
    • REST
      • Overview
      • Backup
        • Overview
        • get
        • list
      • Cluster
        • Overview
        • addHosts
        • addShard
        • addZookeeper
        • backup
        • create
        • createExternalDictionary
        • createShardGroup
        • delete
        • deleteExternalDictionary
        • deleteHosts
        • deleteShard
        • deleteShardGroup
        • get
        • getShard
        • getShardGroup
        • list
        • listBackups
        • listHosts
        • listLogs
        • listOperations
        • listShardGroups
        • listShards
        • move
        • rescheduleMaintenance
        • restore
        • start
        • stop
        • streamLogs
        • update
        • updateShard
        • updateShardGroup
      • Database
        • Overview
        • create
        • delete
        • get
        • list
      • FormatSchema
        • Overview
        • create
        • delete
        • get
        • list
        • update
      • MlModel
        • Overview
        • create
        • delete
        • get
        • list
        • update
      • ResourcePreset
        • Overview
        • get
        • list
      • User
        • Overview
        • create
        • delete
        • get
        • grantPermission
        • list
        • revokePermission
        • update
      • Versions
        • Overview
        • list
      • Operation
        • Overview
        • get
  • Questions and answers
    • General questions
    • Questions about ClickHouse
    • All questions on the same page
  1. Step-by-step instructions
  2. Managing shards

Managing shards

  • Enabling sharding
  • Adding a shard
  • Listing shards in a cluster
  • Changing a shard
  • Deleting a shard

You can enable sharding for a cluster as well as add and configure individual shards.

Warning

If a cluster uses hybrid storage at the Preview stage, only shards with a single host can be added to this cluster. This restriction is removed at the General Availability stage.

Enabling sharding

Managed Service for ClickHouse clusters are created with one shard. To start sharding data, add one or more shards and create a distributed table.

Adding a shard

The number of shards in Managed Service for ClickHouse clusters is limited by the CPU and RAM quotas available to DB clusters in your cloud. To check the resources in use, open the Quotas page and find the Yandex Managed Service for ClickHouse block.

Management console
API
  1. Go to the folder page and select Managed Service for ClickHouse.
  2. Click on the name of the cluster you need and go to the Hosts tab.
  3. Click Add shard.
  4. Enter a name for the shard and add the desired number of hosts.
  5. Click Create shard.

To add a shard to the cluster, use the addShard method.

Listing shards in a cluster

Management console
API
  1. Go to the folder page and select Managed Service for ClickHouse.

  2. Click the name of a cluster and open the Shards tab.

To list the shards in a cluster, use the listShards method.

Changing a shard

You can change the shard weight as well as host class and storage size.

Management console
CLI
API
  1. Go to the folder page and select Managed Service for ClickHouse.
  2. Click the name of a cluster and open the Shards tab.
  3. Click and select Change.

If you don't have the Yandex.Cloud command line interface yet, install and initialize it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To change a shard in the cluster:

  1. View a description of the CLI's shard change command:

    yc managed-clickhouse shards update --help
    
  2. Start an operation, such as changing the shard weight:

    yc managed-clickhouse shards update --cluster-name clickhouse12 \
                                  --name shard1 \
                                  --weight 80
    

When the operation is complete, the CLI displays information about the changed shard:

name: shard1
cluster_id: c9fmo2rf013t4q0ab8m1
config:
  clickhouse:
    config:
      effective_config:
        log_level: INFORMATION
  ...

  weight: "80"

To change the shard settings, use the updateShard method.

Deleting a shard

You can delete a shard from a ClickHouse cluster provided that:

  • It's not the only shard.
  • It's not the only shard in a group of shards.

When you delete a shard, all tables and data that are saved on that shard are deleted.

Management console
API
  1. Go to the folder page and select Managed Service for ClickHouse.

  2. Click on the name of a cluster and open the Shards tab.

  3. Click in the line of the desired host and select Delete.

Use the deleteShard method to delete a shard.

In this article:
  • Enabling sharding
  • Adding a shard
  • Listing shards in a cluster
  • Changing a shard
  • Deleting a shard
Language / Region
Careers
Privacy policy
Terms of use
Brandbook
© 2021 Yandex.Cloud LLC