Accessing data using Apache Druid
Also available as:
PDF

Set up a database

You choose and set up a database to use as the metastore for Apache Druid (incubating).

MySQL or Postgres databases that you install on the cluster are supported for production use. The MySQL database installed by Ambari does not meet the UTF-8 requirement for Druid, and is not suitable for production clusters. You can also use the default Derby database for development work. Database setup includes configuring the database connector in Ambari. If you use the default Derby database, you must assign all Druid components to the same node during installation.
  1. As root, install a database, MySQL for example, on any node in your cluster.

    On Centos 7.4, for example:

    yum install https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
    
    yum install mysql-community-server
  2. Start the MySQL service.
    systemctl start mysqld.service
  3. Obtain the temporary password and change the password for the root user. Do not use special characters in the password.
    Ambari is compatible with most, but not all, special characters.
    grep 'A temporary password is generated for root@localhost' \
    /var/log/mysqld.log |tail -1
    
    /usr/bin/mysql_secure_installation              
  4. On the database host, launch Mysql and create a user named druid with superuser permissions:
    CREATE USER 'druid'@'%' IDENTIFIED BY '<DRUIDPASSWORD>';
    GRANT ALL PRIVILEGES ON *.* TO 'druid'@'%’;
    GRANT ALL PRIVILEGES ON *.* TO 'druid'@'%' WITH GRANT OPTION;
    FLUSH PRIVILEGES;                         
  5. Create a UTF8 database named druid.
    CREATE DATABASE druid DEFAULT CHARACTER SET utf8;