Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for ClickHouse®
  • Getting started
    • All tutorials
    • Adding data to the database
    • Migrating data to Managed Service for ClickHouse® using ClickHouse®
    • Migrating data to Managed Service for ClickHouse® using Data Transfer
    • Sharding tables
    • Data resharding in a cluster
    • Using a hybrid storage
    • Fetching data from Managed Service for Apache Kafka®
    • Fetching data from RabbitMQ
    • Exchanging data with Yandex Data Processing
    • Configuring Yandex Cloud DNS for cluster access from other cloud networks
    • Analyzing Yandex Object Storage logs in Yandex DataLens
    • Configuring Managed Service for ClickHouse® for Graphite
    • Saving a Yandex Data Streams data stream in Managed Service for ClickHouse®
    • Migrating a database from Google BigQuery
    • Delivering data from Managed Service for Apache Kafka® using Yandex Data Transfer
    • Migrating data from Yandex Direct using Yandex Cloud Functions, Yandex Object Storage, and Yandex Data Transfer
    • Loading data from Yandex Object Storage to Managed Service for ClickHouse® using Yandex Data Transfer
    • Migrating a database from Greenplum® to ClickHouse®
    • Migrating a database from MySQL® to ClickHouse® using Yandex Data Transfer
    • Asynchronously replicating data from PostgreSQL to ClickHouse®
    • Loading data from Yandex Managed Service for YDB to Managed Service for ClickHouse® using Yandex Data Transfer
    • Copying data from Managed Service for OpenSearch to Managed Service for ClickHouse® using Yandex Data Transfer
    • Entering data into storage systems
    • Using parameters
    • Examples of creating QL charts
    • Web analytics with funnels and cohorts calculated based on Yandex Metrica data
    • AppMetrica: direct connection
    • AppMetrica: data export, post-processing, and visualization
    • Loading data from Yandex Metrica to a ClickHouse® data mart
    • Yandex Tracker: data export and visualization
    • Retail chain's dashboard based on a ClickHouse® DB
    • Analyzing sales and locations of pizzerias based on data from the ClickHouse® database and Marketplace
    • Geocoding with the Yandex Maps API for data visualization in DataLens
    • Importing data from Object Storage, processing and exporting to Managed Service for ClickHouse®
    • Working with data using Query
    • Federated data queries using Query
  • Access management
  • Pricing policy
  • Terraform reference
  • Yandex Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Prepare the environment
  • Required paid resources
  • Create a cluster
  • Register the rollup configuration in a cluster
  • Create and set up a virtual machine
  • Connect the virtual machine to a database
  • Create a GraphiteMergeTree table
  • Configure Graphite
  • How to delete the resources you created
  1. Tutorials
  2. Configuring Managed Service for ClickHouse® for Graphite

Configuring Managed Service for ClickHouse® for Graphite

Written by
Yandex Cloud
Updated at May 13, 2025
  • Prepare the environment
    • Required paid resources
  • Create a cluster
  • Register the rollup configuration in a cluster
  • Create and set up a virtual machine
  • Connect the virtual machine to a database
  • Create a GraphiteMergeTree table
  • Configure Graphite
  • How to delete the resources you created

Yandex Managed Service for ClickHouse® can be used as data storage for Graphite.

The GraphiteMergeTree table engine enables you to decimate and aggregate or average out the contents of a database specifically for Graphite. The engine reduces the data storage volume and improves the efficiency of queries from Graphite.

Note

If you do not need decimation and aggregation or averaging, you can use any ClickHouse® table engine to store Graphite data.

To configure a database to work with Graphite:

  1. Prepare the environment.
  2. Create a cluster.
  3. Register the rollup configuration in a cluster.
  4. Create and set up a virtual machine.
  5. Connect the virtual machine to a database.
  6. Create a GraphiteMergeTree table.
  7. Configure Graphite.

If you no longer need the resources you created, delete them.

Prepare the environmentPrepare the environment

Sign up in Yandex Cloud and create a billing account:

  1. Navigate to the management console and log in to Yandex Cloud or register a new account.
  2. On the Yandex Cloud Billing page, make sure you have a billing account linked and it has the ACTIVE or TRIAL_ACTIVE status. If you do not have a billing account, create one and link a cloud to it.

If you have an active billing account, you can navigate to the cloud page to create or select a folder for your infrastructure to operate in.

Learn more about clouds and folders.

Required paid resourcesRequired paid resources

The cost of maintaining your ClickHouse® database for Graphite includes:

  • Fee for the cluster computing resources, storage, and backups (see Yandex Managed Service for ClickHouse® pricing).
  • Fee for a running VM to manage a database (see Yandex Compute Cloud pricing).

Create a clusterCreate a cluster

  1. Create a Managed Service for ClickHouse® cluster in any suitable configuration with the db1 database and public access to all of its hosts. Save the database name, username, and password.
  2. In the management console, select Managed Service for ClickHouse® and go to the new cluster. Save the cluster ID in the Overview tab.
  3. In the top-right corner, click Connect. In the Shell tab, save the --host parameter from the Sample connection string field, e.g., rc1a-2sqal8f0********.mdb.yandexcloud.net. This is the cluster host FQDN you will need later on.

Register the rollup configuration in a clusterRegister the rollup configuration in a cluster

Register the rollup configuration in your cluster to decimate and aggregate or average out the database contents for Graphite:

CLI
API

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. Prepare a YAML file named graphite-rollup.yaml with a description of rollup parameters, e.g.:

    name: test_rollup
    patterns:
      - regexp: click_cost
        function: max
        retention:
          - age: 86400
            precision: 60
    
  2. Run this command:

    yc managed-clickhouse cluster add-graphite-rollup <cluster_ID> --rollup-file-name <yaml_file_path>
    

    Where:

    • <cluster_ID>: Cluster ID.
    • --rollup-file-name: Path to graphite-rollup.yaml.

    For more information about the managed-clickhouse cluster add-graphite-rollup command, see the CLI reference.

Use the REST API update method by providing the required rollup parameters in the request body:

"graphiteRollup": [
          {
            "name": "test_rollup",
            "patterns": [
              {
                "regexp": "click_cost",
                "function": "max",
                "retention": [
                  {
                    "age": "86400",
                    "precision": "60"
                  }
                ]
              }
            ]
          }
        ]

Create and set up a virtual machineCreate and set up a virtual machine

  1. In the same cloud network where the cluster is located, create a VM on Linux.

  2. Connect to the VM via SSH.

  3. Connect the ClickHouse® DEB repository:

    sudo apt update && sudo apt install -y apt-transport-https ca-certificates dirmngr && \
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4 && \
    echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \
    /etc/apt/sources.list.d/clickhouse.list
    
  4. Install the dependencies and the clickhouse-client client application:

    sudo apt update && sudo apt install -y clickhouse-client
    
  5. Download the configuration file for clickhouse-client:

    mkdir -p ~/.clickhouse-client && \
    wget "https://storage.yandexcloud.net/doc-files/clickhouse-client.conf.example" \
      --output-document ~/.clickhouse-client/config.xml
    
  6. Get an SSL certificate:

    sudo mkdir --parents /usr/local/share/ca-certificates/Yandex/ && \
    sudo wget "https://storage.yandexcloud.net/cloud-certs/RootCA.pem" \
         --output-document /usr/local/share/ca-certificates/Yandex/RootCA.crt && \
    sudo chmod 655 /usr/local/share/ca-certificates/Yandex/RootCA.crt && \
    sudo update-ca-certificates
    

Connect the virtual machine to a databaseConnect the virtual machine to a database

  1. If you are using security groups for a cloud network, configure them to allow all required traffic between the cluster and the VM.

  2. Connect.

  3. Run the ClickHouse® CLI with the following parameters: replace <host_FQDN>, <DB_name>, <DB_username>, and <DB_user_password> with the previously saved values.

    clickhouse-client --host <host_FQDN> \
                      --secure \
                      --user <DB_username> \
                      --database <DB_name> \
                      --password <DB_user_password> \
                      --port 9440
    

Create a GraphiteMergeTree tableCreate a GraphiteMergeTree table

ClickHouse® CLI

In the ClickHouse® CLI interface, run a query to create a GraphiteMergeTree table. For the parameter, provide the name of the rollup section described earlier:

CREATE TABLE GraphiteTable
(        
    Path String, 
    Time DateTime, 
    Value Int64, 
    Version UInt64
)
ENGINE = GraphiteMergeTree('test_rollup')
PARTITION BY Time
ORDER BY cityHash64(Version, Path)

Configure GraphiteConfigure Graphite

Configure Graphite to save metrics in the ClickHouse® cluster. In this case, data is decimated automatically by the ClickHouse® server according to the parameters you specified.

  1. Install the carbon-clickhouse utility in the system running Graphite:

    wget https://github.com/go-graphite/carbon-clickhouse/releases/download/v0.11.2/carbon-clickhouse_0.11.2_amd64.deb && \
    sudo apt-get install $(pwd)/carbon-clickhouse_0.11.2_amd64.deb
    
  2. Configure carbon-clickhouse.

  3. Run carbon-clickhouse:

    sudo systemctl enable carbon-clickhouse && \
    sudo systemctl start carbon-clickhouse
    
  4. Install the graphite-clickhouse utility:

    wget https://github.com/go-graphite/graphite-clickhouse/releases/download/v0.13.2/graphite-clickhouse_0.13.2_amd64.deb && \
    sudo apt-get install $(pwd)/graphite-clickhouse_0.13.2_amd64.deb
    
  5. Configure graphite-clickhouse.

  6. Run graphite-clickhouse:

    sudo systemctl enable graphite-clickhouse && \
    sudo systemctl start graphite-clickhouse
    

    For more information about configuring Graphite, see the relevant documentation.

How to delete the resources you createdHow to delete the resources you created

To remove the rollup configuration from a cluster:

  1. Delete all the tables that use this configuration.
  2. Run the yc managed-clickhouse cluster remove-graphite-rollup command.

For more information about the command, see the CLI reference.

Alert

Removal of the rollup configuration without first deleting the tables that use it may result in cluster failure.

Delete the resources you no longer need to avoid paying for them:

  • Delete the ClickHouse® cluster.
  • Delete the VM.

ClickHouse® is a registered trademark of ClickHouse, Inc.

Was the article helpful?

Previous
Analyzing Yandex Object Storage logs in Yandex DataLens
Next
Saving a Yandex Data Streams data stream in Managed Service for ClickHouse®
© 2025 Direct Cursus Technology L.L.C.