Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • 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
    • Connecting to databases
    • Stop and start the cluster
    • SQL queries in the management console
    • Changing cluster and database settings
    • Connecting to DataLens
    • Connecting external dictionaries
    • Adding your own geobase
    • Enabling machine learning models
    • Changing ClickHouse versions
    • Managing ClickHouse hosts
    • Adding ZooKeeper hosts
    • Database management
    • Managing database users
    • Managing backups
    • How to manage shards
    • Deleting clusters
  • Solutions
    • Adding data to the database
    • Migrating ClickHouse data
    • Sharding tables
  • Concepts
    • Relationship between service resources
    • Host classes
    • Network in Yandex Managed Service for ClickHouse
    • Quotas and limits
    • Storage types
    • Backups
    • Replication
    • Dictionaries
    • Sharding
    • Supported clients
  • 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. How to manage shards

How to manage shards

  • Enable sharding
  • Change a shard
  • List shards in a cluster
  • Add a shard
  • Delete a shard

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

Enable sharding

Managed Service for ClickHouse clusters are created in a configuration with one shard. To start sharding data, follow the guidelines in Sharding ClickHouse tables.

Change 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.

List 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.

Add 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 host to the cluster, use the addHosts method.

Delete a shard

You can delete a shard from a ClickHouse cluster provided that it's not the only shard in it.

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 deleteHosts method to delete a host.

In this article:
  • Enable sharding
  • Change a shard
  • List shards in a cluster
  • Add a shard
  • Delete a shard
Language
Careers
Privacy policy
Terms of use
© 2021 Yandex.Cloud LLC