Installing Druid

This section provides a step-by-step guide to installing Druid.

Pre-requisites

Before installing Druid, make sure the following things are in place:

  1. Create directories and place the respective files provided as a release artifact, in the specified locations.
    1. create /home/druid/allmetrics directory, and place all_metrics.sh and allmetrics_airflow.json files inside the folder.
    2. create /home/druid/cdpdashboard/cdpleadconv directory, and place cdp_leadconv.sh and cdp_leadconv.json files inside the folder.
    3. create /home/druid/cdpdashboard/cdpuniqueusers directory, and place cdp_uniqueusers.sh and cdp_uniqueusers.json files inside the folder.
    4. create /home/druid/cdpdashboard/events directory, and place events_druid_with_python.sh and events_v1.json files inside the folder.
    5. create /home/druid/daily directory, and place uploadmysqlmappingfiles.sh files inside the folder.
  2. Install mc client. Follow the steps below to install mc client.
    1. Download the mc client, and update the execute permissions using below command.
      curl -fsSLhttps://dl.min.io/client/mc/release/linux-amd64/mc > /usr/bin/mc && chmod +x /usr/bin/mc
    2. Navigate vi /etc/profile, and update the mc path in the system profile file using the below information.
      export PATH="/usr/bin/mc:$PATH"
    3. Verify the version of the mc client using below command.
      mc --version

Setting up MySQL

To set up MySQL, follow the steps below:

  1. Install the MySQL server.
    yum install mysql-server
  2. Start the MySQL server.
    systemctl start mysqld
  3. On successful starting up of the server, check for the status.
    systemctl status mysqld
    mysql -u root
  4. Create a user for the MySQL server.
    CREATE USER 'druid'@'localhost' IDENTIFIED BY 'Oc3f4EagD5cUnZnUy5uMQ==';
    CREATE DATABASE druid DEFAULT CHARACTER SET utf8mb4;
  5. Grant comprehensive privileges on the druid database to the user.
    GRANT CREATE, ALTER, DROP, INSERT, UPDATE, INDEX, DELETE, SELECT, REFERENCES ON druid.* TO 'druid'@'localhost' WITH GRANT OPTION;FLUSH PRIVILEGES;

Installing Druid and MySQL connector

To install Druid binary and MySQL connector, follow the steps below:

  1. Download the latest package of Apache Druid binary.
    wget https://archive.apache.org/dist/druid/25.0.0/apache-druid-25.0.0-bin.tar.gz
  2. Extract the tar package, and move the directory to the local folder.
    tar -xzf apache-druid-28.0.1-bin.tar.gz
    mv apache-druid-25.0.0 /sdd/
  3. Download the MySQL Connector/J library (version 5.1.49) to the current working directory.
    wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar
  4. Copy the jar file to the local directory as shown below.
    cp mysql-connector-java-5.1.49.jar /sdd/apache-druid-25.0.0/extensions/mysql-metadata-storage/

Updating Druid Configuration

To update the druid configuration, follow the steps below:

  1. Open common.runtime.properties files in text editor, and update mysql-metadata-storage and druid-s3-extensions in druid.extensions.loadList along with other extensions section.
    vi /sdd/apache-druid-25.0.0/conf/druid/single-server/small/_common/common.runtime.properties
    druid.extensions.loadList=["druid-hdfs-storage", "druid-kafka-indexing-service", "druid-datasketches", "druid-multi-stage-query","mysql-metadata-storage", "druid-s3-extensions"]
  2. Comment the Derby configurations, and update the following properties in common.runtime.properties.
    druid.metadata.storage.type=mysql druid.metadata.storage.connector.connectURI=jdbc:mysql://<host>/druid?allowPublicKeyRetrieval=true&useSSL=false
    druid.metadata.storage.connector.user=druid
    druid.metadata.storage.connector.password=<password>
  3. Update the following to store segments in S3.
    druid.storage.type=s3
    druid.storage.bucket=druid-bucket
    druid.storage.baseKey=druid/segments
  4. Add the druid.storage.disableAcl=true at the end of the file.
    nohup ./start-single-server-small &
    ps -eaf | grep supervise