Installing HCP with Ambari
Also available as:
PDF

Set up the REST Application Database

Prior to installing HCP, you must set up the REST application database.

  1. Connect to MySQL and create a Metron REST database:
    mysql -uroot -p -e "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';
  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;