Installation
Also available as:
PDF
loading table of contents...

Setting up the REST Application Database

HCP supports the following databases:

  • MySQL

  • PostRes

  • H2

  • Oracle

For simplicity's sake, the following steps set up the MySQL REST application database:

To install a REST API to interact with Metron, complete the following steps:

  1. Connect to MySQL and create a Metron REST database:

    mysql -uroot -p
    CREATE DATABASE IF NOT EXISTS metronrest;
  2. Create a Metron user in MySQL with a password, then apply database access permission to the Metron user:

    CREATE USER 'metron'@'$REST_HOST' IDENTIFIED BY 'Myp@ssw0rd';
    GRANT ALL PRIVILEGES ON metronrest.* TO 'metron'@'$REST_HOST';

    $REST_HOST is the host on which the REST application is installed.

    Be sure to save your user name and password for later use.

  3. Create user and authorities tables:

    use metronrest;
    create table if not exists users(
     username varchar(50) not null primary key,
     password varchar(50) not null,
     enabled boolean not null
    );
    create table authorities (
     username varchar(50) not null,
     authority varchar(50) not null,
     constraint fk_authorities_users foreign key(username) references
     users(username)
    );
    create unique index ix_auth_username on authorities (username,authority);
  4. Add one or more users to the REST application:

    use metronrest;
    insert into users (username, password, enabled) values ('your_username', 'your_password',1);
    insert into authorities (username, authority) values ('your_username', 'ROLE_USER');
  5. Exit MySQL:

    quit
  6. Install the appropriate MySQL client library for your version of MySQL. For example:

    cd $METRON_HOME/lib
    wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.41.tar.gz
    tar xf mysql-connector-java-5.1.41.tar.gz
  7. To add additional users:

    use metronrest;
    insert into users (username, password, enabled) values ('your_username',
    'your_password',1);
    insert into authorities (username, authority) values ('your_username',
     'ROLE_USER');
    commit;