Apache Druid
  • 18 Nov 2022
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

Apache Druid

  • Dark
    Light

Overview

In this article we will explain how to connect an Apache Druid (Imply) database to Preset. So let's get started!


Allowlist Preset IPs

Preset Cloud currently runs on three regions with the IPs listed below, and those need to be allowlisted so Preset can access your data.

Before starting, please take a moment to allowlist the IPs below based on the region that you're deployed in.

us-west-2 (us1a) us-east-1 (us2a) eu-north-1 (eu5a) ap-northeast-1 (ap1a)
35.161.45.11 44.193.153.196 13.48.95.3 35.74.159.67
54.244.23.85 52.70.123.52 13.51.212.165 35.75.171.157
52.32.136.34 54.83.88.93 16.170.49.24 52.193.196.211

If you are not sure where your Preset workspace is located, you can refer to the URL on your browser when accessing Preset. It should look like this: https://xxxxxxxx.us2a.app.preset.io/superset..., where us2a means it is in us-east-1.


Step 1: Retrieve Data from Imply

In order to connect Apache Druid (Imply) to Preset, we first need to retrieve some key data from the Imply environment:

  • Required to Construct SQLAlchemy URI
    • Initial Druid API User
    • Initial Druid API Pass
    • Public Load Balancer Endpoint
  • Required Security for Preset
    • Root Certificate

To start, let's navigate to your Imply cluster and then select Manage.

Retrieve_Cluster_Data_1

...then select API.

You will notice that this screen contains all of the required information for the subsequent connection steps below.

Retrieve_Cluster_Data_2


Step 2: Connect Database to Preset

Add Database

From the Home Page, in the Toolbar, hover your cursor over Data and then select Databases.

Select_Databases1

Select + Database.

Add_Database

The Connect a database window appears.

Configure Basic Tab

In the Supported Databases field, select Apache Druid.

Apache_Druid_Select_Database

In the Display Name field, enter a meaningful name for the new connection to the Apache Druid database. In this example, we simply used the default Apache Druid.

In the SQLAlchemy URI field, customize your URI connection string using the following syntax:

druid+https://<User>:<password>@<Host>:<Port-default-8082>/druid/v2/sql
Alternative URI

In the event that you do not have authorization set up, you can replace druid+https with druid+http and skip the username and password credentials.

And we could mention that they can also use druid+http if that's the case, and skip username/password if they don't have auth set up

Required elements retrieved earlier that will be used here include:

  • Initial Druid API User
  • Initial Druid API Pass
  • Public Load Balancer Endpoint

When done, select the Advanced tab.

Apache_Druid_Completed_Basic_Tab

Configure Advanced Tab

In the Imply API menu screen referenced in Step 1 above, navigate to the URL in the Root Certificate field and then copy the certificate.

In Preset with the Advanced tab selected, expand the Security section.

In the Root Certificate field, paste the certificate from your system's clipboard.

Apache_Druid_Root_Certificate

Next, expand the Other section.

Aurora_PostgreSQL_Open_Advanced_Other_Section

In the Engine Parameters section, enter the following parameters:

{"context":
    {
        "useGroupingSetForExactDistinct": "true",
        "useUseApproximateCountDistinct": "false"
    }
}

Apache_Druid_Engine_Params

When done, return to the previous screen by selecting the Basic tab.

Aurora_PostgreSQL_Select_Basic_Tab

Test and Connect

To test your connection, select Test Connection. If successful, a notification message appears:

Aurora_PostgreSQL_Connection_Looks_Good

After a successful test, go ahead and select Connect to finalize the connection.

Apache_Druid_Connect

Congratulations, your Apache Druid database is now connected to Preset!


Was this article helpful?