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.

Step 1. Configure resources

  1. Go to the Clusters page in the console and click Create cluster at the top right.

  2. Select ClickHouse.

  3. Choose a provider and region. You can create Managed ClickHouse® clusters on AWS or Google Cloud in any of the available regions. By default, DoubleCloud preselects the region nearest to you.

  4. In the Resources section, select between the x86 or ARM machine type and then select a resource preset that’s suitable for your expected workload.

    For testing or development, you can select any preset. In production, ClickHouse® developers recommend having at least 16 GB of RAM.

    ClickHouse® resource preset reference

    A resource preset has the following structure:

    <cpu-platform>-c<number-of-cpu-cores>-m<gigabytes-of-ram>
    

    There are three available CPU platforms:

    • g: ARM Graviton

    • i: Intel (x86)

    • s: AMD (x86)

    For example, the i2-c2-m8 preset corresponds to an Intel-family machine with 2 virtual cores and 8 GB of RAM.

    Learn more about the availability of CPU platforms in areas and regions

  5. Select the number of shards, number of replicas, and amount of RAM for your workload. For a high-availability configuration, make sure to select at least three replicas.

    About shards and replicas

    Replicas are ClickHouse® hosts that hold a copy of the data in the cluster or shard. Storing the same data in several replicas enables higher data availability and redundancy. Learn more

    Shards refer to subsets of data. Sharding data across multiple servers allows you to distribute and divide the load so that you don’t exceed the capacity of a single server. Learn more

  6. Under Basic settings, enter a cluster name, such as clickhouse-dev.

  7. In Version, select the ClickHouse® version for the cluster. Unless you need a specific version, select the latest one.

Step 2. Configure advanced settings

  1. Under Maintenance settings, select between the arbitrary and scheduled maintenance:

    About maintenance settings

    If you select Arbitrary, DoubleCloud selects the maintenance window automatically. Usually, maintenance takes place at the earliest available time slot.

    Warning

    If your cluster has only one host, arbitrary maintenance can make it unavailable at a random time.

    To perform maintenance on a specific date and time, select By schedule and specify the day and time (UTC) when you want the cluster maintenance to be performed.

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

    If autoscaling is enabled, DoubleCloud regularly checks the resource utilization and automatically adjusts them depending on the cluster usage. Learn more

  3. In ClickHouse Keeper hosts, select the deployment mode.

    About ClickHouse Keeper hosts

    In the embedded mode, ClickHouse Keeper shares hosts with ClickHouse®. In the dedicated mode, ClickHouse Keeper uses three separate hosts, which improves performance, availability, and fault tolerance. Learn more

    For high-load production clusters, make sure to use dedicated ClickHouse Keeper hosts for better performance — when running on separate hosts, ClickHouse® and ClickHouse Keeper don’t compete for CPU and RAM.

    Warning

    You can’t change the ClickHouse Keeper deployment mode after creating the cluster.

    For dedicated ClickHouse Keeper hosts, select the appropriate resource preset. It applies to all three hosts and is billed accordingly.

  4. Under NetworkingVPC, select the network where you want to create the cluster.

    If you don’t need to place the cluster in a specific network, leave the preselected default option.

  5. Specify or adjust your cluster’s DBMS settings. For more information, refer to Managed ClickHouse® settings reference.

  6. In the Summary block on the right, review the resources to be created and their price.

  7. Click Submit.

Creating a cluster usually takes five to seven minutes depending on the cloud provider and region. When the cluster is ready, its status changes from Creating to Alive.

To view the cluster details, select it from the cluster list:

Screenshot of the ClickHouse® cluster page

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

DoubleCloud creates the admin superuser and its password automatically. You can the username and password under Credentials in the Overview tab on the cluster page.

To learn how to create users for other roles, refer to 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.

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. Click CreateSource endpoint.

  3. In Source type, select Object storage.

  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:

    1. Click Test connection.

    2. Select the runtime type you want Transfer to use for connecting to the database.

      • Dedicated: Transfer connects to the database using a specified internal or external network.

      • Serverless: Transfer connects to the database available from the internet using an automatically chosen network.

      Runtime compatibility warning

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

    3. If you selected the dedicated runtime, select the network in the dropdown.

      Screenshot of the endpoint testing dialog

    4. Click Test connection.

    Testing the connection may take a few 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. Click CreateTarget endpoint.

  3. In Target type, select ClickHouse.

  4. Under Basic settings:

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

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

  5. In Connection settingsConnection type, select Managed cluster.

  6. In Managed cluster, select clickhouse-dev from the dropdown list.

  7. In Authentication, select Default to connect to the cluster as the admin user.

  8. In Database, enter sample_clickhouse_db — the name of the database you created earlier.

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

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

    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 .

    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