Save data to ClickHouse

    Create the database:

    1. create database test;

    create table:

    Create the rule:

    Go to the EMQX DashboardSave data to ClickHouse - 图2 (opens new window), and type in the follwing SQL:

      Add an action and select “Data to ClickHouse” from the dropdown list.

      image

      Provide the arguments of the action:

      1). The resource id. We create a new clickhouse resource now:

      Click “create” right to the resource Id text box, and then select “clickhouse” and fill in the following paramenters:

      2). The SQL template. In this example we insert an message to clickhouse:

      image

      Keep all other arguments unchanged and confirm the action creation.

      Then click “Create” to confirm the rule creation.

      Now the rule has been created, we send an testing message to the broker:

      And then we can verify if the message is inserted to the clickhouse table: