The complete end-to-end DoubleCloud services guide

This comprehensive step-by-step scenario will give you an in-depth look at every major DoubleCloud resource. You'll familiarize yourself with how to create, manage, and make practical use of the resources in your brand new data management toolkit.

A typical use case for our service includes:

  • Creating a cluster and a database for data storage.

  • Transferring the data from the outside source to your DoubleCloud cluster.

  • Analyzing the data using Visualization, our built-in BI tool.

Let's look at the flow of this scenario:

quickstart-flow

There is a CSV file with some data we need to migrate to DoubleCloud and then analyze. To do this, we transfer the file from S3 to a Managed ClickHouse® cluster. From there, we connect our Visualization service to it, prepare the data, and build some impressive visualizations from it.

Following this straightforward step-by-step quickstart tutorial, you will learn how to:

  1. Prepare to acquire the data

    1. Create a Managed ClickHouse® cluster

    2. Create a ClickHouse® database

  2. Transfer the data

    1. Create a source endpoint

    2. Create a target endpoint

    3. Create and activate a transfer

  3. Visualize the data

    1. Create a workbook

    2. Create a connection

    3. Create a dataset

    4. Prepare your dataset for visualization

    5. Create charts and selectors

    6. Create an area chart

    7. Create a bar chart

    8. Create an indicator

    9. Create a dashboard

    10. Add charts to your dashboard

    11. Add a selector

Let's get to the point right now.

Prepare to acquire the data

First, you need to create a cluster and a database that'll store the data for further processing and visualization.

You need to complete the following steps:

  1. Create a Managed Service for ClickHouse® cluster

    This is a resource allocation tool. It allows you to acquire CPU, memory, and storage quotas to operate your databases.

  2. Create a ClickHouse® database

    This section will give you an understanding of how to talk to your cluster directly from the terminal and use ClickHouse® CLI toolkit.

Create a Managed Service for ClickHouse® cluster

Warning

During the trial period, you can create clusters with up to 8 cores, 32 GB RAM, and 400 GB storage. If you need to raise the quotas, don't hesitate to contact our support.

  1. Go to the Clusters overview page in the console.

  2. Click Create cluster in the upper-right corner of the page.

  3. Select ClickHouse®.

  4. Choose a provider and a region.

  5. Under Resources:

    1. Select the s1-c2-m4 preset for CPU, RAM capacity, and storage space to create a cluster with minimal configuration.

      Understand your ClickHouse® resource preset

      A resource preset has the following structure:

      <CPU platform> - C<number of CPU cores> - M<number of gigabytes of RAM>
      

      There are three available CPU platforms:

      • g - ARM Graviton

      • i - Intel (x86)

      • s - AMD (x86)

      For example, the i1-c2-m8 preset means that it's an Intel platform 2-core CPU with 8 gigabytes of RAM.

      You can see the availability of CPU platforms across our Managed Service for ClickHouse® areas and regions.

    2. Choose the number of replicas. Let's keep it as is with a single replica.

    3. Select the number of shards. Keep a single shard.

      Understand shards and replicas

      Shards refer to the servers that contain different parts of the data (to read all the data, you must access all the shards). Replicas are duplicating servers (to read all the data, you can access the data on any of the replicas).

  6. Under Basic settings:

    1. Enter the cluster Name, in this scenario - tutorial-cluster.

    2. From the Version drop-down list, select the ClickHouse® version the Managed ClickHouse® cluster will use. For most clusters, we recommend using the latest version.

  7. Under Advanced:

    1. Under Maintenance settings, select the scheduling type:

      • Arbitrary to delegate maintenance window selection to DoubleCloud. Usually, your cluster will perform maintenance procedure at the earliest available time slot.

        Warning

        We suggest not to use this scheduling type with single-host clusters, as it can lead to your cluster becoming unavailable at random.

      • By schedule to set the weekday and time (UTC) when DoubleCloud may perform maintenance on your cluster.

    2. Under Autoscaling, select whether you want the cluster resources to automatically increase and specify the maximum limits they can increase to.

      If autoscaling is enabled, DoubleCloud regularly checks the resource utilization and incrementally adds additional resources when the utilization is nearing capaticy.

    3. Under NetworkingVPC, specify in which DoubleCloud VPC to locate your cluster. Use the default value in the previously selected region if you don't need to create this cluster in a specific network.

    4. Select the allocation for the ClickHouse Keeper service - embedded or dedicated.

      We recommend using dedicated hosts for high-load production clusters. Dedicated ClickHouse Keeper hosts ensure that your production cluster's performance remains unaffected under heavy loads - they don't use its CPU or memory.

      ClickHouse Keeper host location is irreversible

      After creating the cluster, you won't be able to change the ClickHouse Keeper deployment type.

      For dedicated ClickHouse Keeper hosts, select the appropriate resource preset. Please note that this resource preset will apply to all three hosts and will be billed accordingly.

    5. Specify or adjust your cluster's DBMS settings. For more information, see the Settings reference.

  8. Click Submit.

Your cluster will appear with the Creating status on the Clusters page in the console. Setting everything up may take some time. When the cluster is ready, it changes its state to Alive.

Click on the cluster to open its information page:

cluster-created

Tip

The DoubleCloud service creates the superuser admin and its password automatically. You can find both the User and the Password in the Overview tab on the cluster information page.

To create users for other roles, see Manage ClickHouse® users

Your cluster will appear with the Creating status on the Clusters page in the console. Setting everything up may take some time. When the cluster is ready, it changes its state to Alive.

Tip

The DoubleCloud service creates the superuser admin and its password automatically. You can find both the User and the Password in the Overview tab on the cluster information page.

To create users for other roles, see Manage ClickHouse® users

Create a ClickHouse® database

This step gives you a glimpse into talking with your Managed ClickHouse® cluster directly from your Linux system.

Please note - this tutorial is based on a DEB-based Linux distribution . You can use a standalone system or a Windows Subsystem for Linux solution.

  1. Install the ClickHouse® client.

The software is ready to go. Let's connect to your new cluster:

  1. Select Clusters from the list of services on the left.

  2. Select the name of your cluster to open its information page. By default, you will see the Overview tab.

  3. Under Connection strings, find the Native interface string and click Copy.

  4. Run the following command in your terminal:

    docker run --network host --rm -it clickhouse/<Native interface connection string>
    
    The complete Docker command structure
    docker run --network host --rm -it \ 
                clickhouse/clickhouse-client \
                --host <FQDN of your cluster> \
                --secure \
                --user <cluster user name> \
                --password <cluster user password> \
                --port 9440 
    
    <Native interface connection string>
    

You are now connected to your cluster via the clickhouse-client. It's time to create the database for your Facebook Ads metrics data. Let's call it Sample-ClickHouse-DB:

  1. Type the following command in your terminal:

    CREATE DATABASE IF NOT EXISTS sample_clickhouse_db
    
  2. Check if the database is available on the cluster. Type SHOW DATABASES. You'll see the following readout:

    ┌─name─────────────────┐
    │ INFORMATION_SCHEMA   │
    │ sample_clickhouse_db │
    │ _system              │
    │ default              │
    │ information_schema   │
    │ system               │
    └──────────────────────┘
    

Tip

Alternatively, you can use a visual IDE of your choice to connect to a cluster and create a database.

Transfer the data

Now it's time to set up the tools to get the data from a remote source and transfer it to your sample_clickhouse_db ClickHouse® database. To accomplish this, you need to complete the following steps:

  • Create a source endpoint

    This is your data fetcher. It will connect to a remote source and send the data to your Managed ClickHouse® cluster.

  • Create a target endpoint

    This is your receiver. It will acquire the data sent by the source endpoint and write it to the database on your Managed ClickHouse® cluster.

  • Create and activate a transfer

    This is your data pipeline tool. It will connect your endpoints and ensure the integrity of the data.

Create a source endpoint

  1. Go to the Transfer page in the console.

  2. Select Endpoints tab, click Create endpoint, and choose Source.

  3. Select S3 as the Source type.

  4. Under Basic settings:

    1. Enter the Name of the endpoint: s3-source-quickstart.

    2. (optional) Enter a Description of the endpoint.

  5. Specify endpoint parameters under Endpoint settings:

    1. Specify the Dataset: bookings.

    2. Provide the Path pattern: data-sets/bookings.csv.

    3. Keep the Schema field with its default value.

    4. From the drop-down menu, select the data format - CSV.

  6. Under CSV, specify the Delimiter - ;. Keep the rest of the fields with their default values.

  7. Under S3: Amazon Web Services, enter the name of the Bucket: doublecloud-docs. As the bucket is public, leave the rest of the fields blank.

  8. Optionally, you can test your source endpoint:

    After configuring your endpoint, click Test. You'll see an endpoint test dialog:

    endpoint-test

    You can use two runtime types for connection testing - Dedicated and Serverless.

    Runtime compatibility warning

    Don't use endpoints with different runtime types in the same transfer - this will cause it to fail.

    Dedicated

    The Transfer service uses this runtime to connect to your data source via an internal or external network.

    This runtime is useful when you need to use a specific network - it may be an external network or an internal one with a peer connection.

    To run the test with this runtime:

    1. Under Runtime, select Dedicated.

    2. From the drop-down list, select the network to use to connect to your data source.

    3. Click Test connection.

      After completing the test procedure, you'll see a list of the endpoint's data sources. For Apache Kafka® endpoints, you'll also see data samples for each data source.

    Serverless

    The Transfer service uses this runtime to connect to your data sources available from the internet via an automatically defined network.

    Use this runtime to test an endpoint to a data source located outside isolated networks.

    To run the test with this runtime:

    1. Under Runtime, select Serverless.

    2. Click Test.

      After completing the test procedure, you'll see a list of the endpoint's data sources. For Apache Kafka® endpoints, you'll also see data samples for each data source.

    Warning

    Please be patient - testing may take up to several minutes.

  9. Click Submit.

The transmitter is ready to go. We need to create an endpoint to receive the data from a remote source.

Create a target endpoint

  1. Go to the Transfer page in the console.

  2. Select Endpoints tab, click Create endpoint and choose Target.

  3. Select ClickHouse® as the Target type.

  4. Under Basic settings:

    1. Enter the Name of the endpoint: clickhouse-target-quickstart

    2. (optional) Enter a Description of the endpoint.

  5. Specify endpoint parameters under Endpoint settings:

    1 Under Managed cluster, select your cluster name (tutorial-cluster) from the drop-down list.

    1. Specify the connection properties:

      • Under Managed cluster, select your cluster name (doublecloud-quickstart) from the drop-down list.

      • Specify the Database name you want to transfer the data to: sample_clickhouse_db.

      • Specify the User of the database: admin.

      • Enter the Password of the database user.

  6. Leave all the other fields blank or with their default values.

  7. Click Submit.

Good work. We've created an endpoint to receive and write the data to your ClickHouse® database. Now we need a tool that will connect both endpoints and transfer the data.

Create and activate a transfer

  1. In the list of services, select Transfer.

  2. Click Create transfer.

  3. Under Endpoints:

    1. Select s3-source-quickstart from the Source drop-down menu.

    2. Select clickhouse-target-quickstart from the Target.

  4. Under Basic settings:

    1. Enter the transfer Name: transfer-quickstart

    2. (optional) Enter the transfer Description.

  5. Leave all the other fields blank or with their default values.

  6. Click Submit. You will see the following line on your Transfer page:

    transfer-ready

  7. After you've created a transfer, click Activate.

  8. Wait until your transfer status changes to Done.

Check the data transferred to your ClickHouse® database:

  1. Open your terminal.

  2. Connect to your cluster with the Native interface string from your cluster's Overview tab and type the following command:

    SHOW TABLES FROM sample_clickhouse_db
    

    You should see the following output:

    ┌─name─────┐
    │ bookings │
    └──────────┘
    

Nice work! You have all the data transferred from a remote source and replicated with complete integrity in your own ClickHouse® database. Now let's make this data earn its worth.

Visualize the data

After migrating the data to your Managed ClickHouse® cluster, it's time to start building data displays. This process consists of the following steps:

  1. Create a workbook.

    In Visualization it works as a container for all other visualization elements.

  2. Create a connection

    This tool connects to your Managed ClickHouse® cluster to fetch and update the data.

  3. Create a dataset based on the data from your connection and prepare it for visualization.

  4. Create a dashboard

    This tool provides a canvas on which to place and organize charts.

  5. Create charts to visualize your data.

Create a workbook

Workbooks are visualization environments for data in your projects.

  1. Open the Visualization page in the console.

  2. Click CreateCreate workbook in the upper-right corner of the page. You'll see the following dialog:

    workbook-create

  3. Under Name, type Booking Demo Workbook.

  4. Under Description, paste the following:

    This workbook contains a connection, a dataset, charts and a dashboard for the complete end-to-end DoubleCloud scenario.
    
  5. Click Create. The new workbook page will look as follows:

    collection-ready

Let's fill in all its sections.

Create a connection

Connections access hosts in your cluster to fetch data for processing and visualization.

  1. Click CreateConnection in the upper-right corner of your workbook page.

  2. Select ClickHouse®.

  3. Specify the connection parameters:

    • Hostname. Copy the name of a host from the Hosts tab on your cluster's information page.

    • Username and Password from the Overview tab on the information page of your cluster.

    • Leave all the other fields with their default values.

  4. Click Check connection.

    If your connection is operational, you'll see a green icon. A red icon and a popup message with information about the error will appear if there's a problem.

    Your connection parameters should look like this:

    workbook-connection-form

  5. Click Create connection in the upper-right corner of the page.

  6. In the dialog, name the connection ClickHouse DB and click Create.

Create a dataset

Datasets process data from your connections and prepare them for visualization.

  1. In the upper-right corner of your connection page, click Create dataset.

  2. In the Connections section, you'll see your new connection, and under it - the table you can use to create a dataset.

    You'll see the sample_clickhouse_db.bookings table in the workspace on the right. The preview of the resulting dataset will appear in the Preview section below.

    Your dataset configuration should look similar to this:

    dataset-form

  3. Click Save in the upper-right corner of your dataset page.

  4. In the dialog, name the dataset Bookings Dataset and click Create.

Prepare your dataset for visualization

Use calculated fields and aggregation to extract more value from your data.

  1. In the top-left corner of your dataset page, select Fields.

    Let's look at the list of fields we've got here. The first column is Row_num - this isn't the best option for a sorting field.

    What's the best sorting parameter for a bookings dataset? It should be some sort of time indicator

    Where do we get the appropriate values? Let's look at the dataset again. There is the booking_start_date field. It's a timestamp with the standard YYYY-MM-DD structure transferred as a string. We need to parse it into a more useful data type.

  2. Create a calculated field to extract the year number from this data column:

    1. Click + Add field button in the top right to create a calculated field.

    2. Under Field settings specify the name for the field: Booking Start Date.

    3. Use the DATE_PARSE function in the formula:

      DATE_PARSE([booking_start_date])
      
    4. Click Create in the lower-right corner.

      You'll see the new calculated field on the top of the dataset field list. It will have the icon in the Field source column:

      calculated-field-year

    5. Hide the Row_num column since we won't use it:

      1. Hover the cursor over Row_num in the list of dataset fields.

      2. Click the icon.

    The field is now hidden and will be unavailable for visualization. It as also disappeared from the Preview section of the dataset.

  3. Click Save in the upper-right corner of the dataset page to save changes.

Now the data is ready for visualization. Let's get right to it.

Create charts

To get you familiar with the most popular chart types in DoubleCloud Visualization, we'll create the following:

Create a stacked area chart

A Stacked area chart is good at showing how value changes over time.

  1. In the upper-right corner of your workbook page, click CreateWizard chart.

  2. Select Bookings Dataset from the list.

  3. Click the chart type field on the right of the dataset section and select Stacked area chart from the drop-down menu.

  4. Drag and drop Measures and Dimensions to the appropriate sections of the chart:

    • Booking Start Date to X - this provides the timeline over which the data was changing.

    • Price to Y - these are the value changes we want to visualize.

    Your chart fields configuration should look like this:

    dashboard-stacked-area-chart-fields

  5. Now let's change the default blue color of the chart into something with a bit more zest:

    1. Hover your cursor over the Colors field and click the icon.

    2. In the popup window, select a different color for the Price sum field.

    3. Click Apply.

  6. Click Save in the upper-right corner of the page.

  7. Let's call our chart Price and click Save.

    Your stacked area chart should look similar to this:

    stacked_area_chart

  8. Go back to your workbook page by clicking Booking Demo Workbook in the breadcrumbs at the top.

Tip

If you want to practice creating area charts a bit more, create a similar chart, but make it about Average price - choose the Price avg field for your Y field.

Create a bar chart

A Bar chart allows you to compare the same parameter across several categories. For example, we'd like to know the number of bookings in each borough and compare them at a glance. Let's make it happen:

  1. Click CreateWizard chart.

  2. Select Bookings Dataset from the list.

  3. Click the chart type field on the right of the dataset section and select Bar chart from the drop-down list.

  4. Drag and drop Measures and Dimensions to the appropriate sections of the chart:

    • borough to Y - these are our categories.

    • booking_id_ to X - this is the parameter we want to compare between the categories.

    • borough to Colors - this will paint horizontal bars in different colors to make the data easier to read.

    • booking_id_ to Signatures - this will write the numeric values inside the bars.

    Your chart fields configuration should look like this:

    dashboard-bar-chart-fields

  5. Let's call our chart Bookings by Borough and click Save.

    Your bar chart should look similar to this:

    bar_chart_simple

  6. Go back to your workbook page by clicking Booking Demo Workbook in the breadcrumbs at the top.

Tip

If you want to practice creating bar charts, create a similar chart, but make it about ratings rather than bookings - choose the rating_overall field for your X and Signature fields.

Create an indicator

An indicator shows a numeric value or a sum of values in large letters.

  1. Click CreateWizard chart.

  2. Select Bookings Dataset from the list.

  3. Click the chart type field on the right of the dataset section and select Indicator from the drop-down list.

  4. Drag and drop host_id to the Measure field.

    This will automatically sum up all the values in the field. However, we need to count the number of unique IDs, so we'll have to create a calculated field for this indicator.

  5. Click the icon to the right of the field name in the wizard slot.

  6. In the Field settings window, let's rename the field into hosts count.

  7. Paste the following formula into the code field below:

    COUNT(INT([host_id]))
    
  8. Click Save.

  9. Let's customize the appearance of our indicator:

    1. Hover your cursor over the Measure field and click the icon.

    2. In the popup window, select the S size and choose a different color.

    3. Click Apply.

  10. Click Save in the upper-right corner of the page.

    Your indicator should look similar to this:

    indicator_chart

  11. Let's call our chart Hosts Count Indicator and click Done.

Tip

If you want to practice creating indicators, create a similar chart, but choose the booking_id field for your Measure field and select a different color for the numbers.

Create a dashboard

A dashboard is a customizable data display that allows you to arrange charts, selectors and widgets.

  1. Click Booking Demo Workbook in the breadcrumbs.

  2. On your workbook page, click CreateDashboard in the upper-right corner of your workbook page.

  3. Call it Booking Dashboard and click Create.

    Your dashboard will open in edit mode. You're ready to start populating it with tabs and charts.

Add charts to your dashboard

  1. Click AddChart. You'll see the chart placement dialog:

    chart-placement-dialog

    1. Under Chart, click Select and choose the Price chart from the list.

    2. You'll see the chart's Title appear in the relevant field. To the right, there's the Show checkbox - let's keep it as is.

    3. Click Add.

    4. Move the chart around the dashboard and resize it if needed.

  2. Add the other charts the same way and arrange them to your liking.

Add a selector

Selectors can work as filters for your charts and give you additional analytical flexibility.

  1. Click AddSelector.

  2. Keep the Based on dataset mode selected.

  3. From Dataset, select Bookings dataset.

  4. From Fields, select property_type.

  5. In the Selector type field, keep List.

  6. Under Operation, select Belongs to a set from the drop-down menu.

  7. Toggle Multiple choice on.

  8. In the Title field, enter Property type.

  9. Click Save

Now you can filter your charts by one or more property types. Give it a try.

Tip

If you want to practice creating selectors, create a similar one, but choose Borough under Field.

After working with charts, click Save in the upper-right corner of the page to save the changes to the dashboard.

Below you can see a tab with sample data and layout:

sample-dashboard

Add a sample dashboard to any project

You can add this sample dashboard to any of your projects - click Add demo workbook in the upper-right corner of your All workbooks page.

This concludes the tutorial. There's a lot more you can do with DoubleCloud. Keep exploring!

See also

Managed Service for ClickHouse®

Transfer

Visualization