Configure LMT MySQL Database for DAL

Configure the Lustre monitoring tool (LMT) MySQL database for direct-attached Lustre (DAL) on CLE 6.x.

A MySQL server instance must be configured on the management server (MGS) node. All commands described below should be executed on the MGS for the direct-attached Lustre (DAL) file system.

A MySQL server instance on the management server (MGS) node stores real-time and historical Lustre monitoring tool (LMT) data. The configurator does not handle the initial setup of the LMT MySQL users and database. It must, therefore, be done manually. All commands described below should be executed on the MGS for the DAL file system.

  1. Log on to the MGS as root.
    (Where nidMGS is the node ID (NID) of the MGS node.)
    boot# ssh nidMGS
  2. Start the MySQL server daemon (if not already running).
    mgs# /sbin/service mysqld start 
  3. Run the mysql_secure_installation script to improve MySQL server instance security.

    This sets the password for the root MySQL user, disallows remote root access to the database, removes anonymous users, removes the test database, and reloads privileges. If this is the first time configuring LMT, create a symlink before running mysql_secure_installation to ensure that MySQL uses the correct socket.

    1. Create a symbolic link.
      mgs# ln -s /var/run/mysql/mysql.sock /var/lib/mysql/mysql.sock
    2. Run mysql_secure_installation utility.
      mgs# mysql_secure_installation
    3. Respond to script prompts.
      Prompts and recommended responses generated by the script.
      Enter current password for root (enter for none): <Enter>
      
      Set root password? [Y/n] Y
      New password: Enter a secure password
      Re-enter new password: Enter the secure password again
      
      Remove anonymous users? [Y/n] Y
      
      Disallow root login remotely? [Y/n] Y
      
      Remove test database and access to it? [Y/n] Y
      
      Reload privilege tables now? [Y/n] Y
  4. Ensure root only access to the LMT user configuration file, /usr/share/lmt/mkusers.sql.
    mgs# chmod 600 /usr/share/lmt/mkusers.sql
  5. Edit the LMT user configuration file /usr/share/lmt/mkusers.sql.

    This file is not used at run time by LMT or MySQL processes. This script creates the MySQL users on the persistent storage configured for the MySQL databases. After it is run through MySQL, it is no longer needed.

    This file contains MySQL statements that create users named lwatchclient and lwatchadmin. It gives them privileges only on databases that start with filesystem_. Cray recommends making the following changes to mkusers.sql.
    Edit the GRANT Statement
    Edit the GRANT statements to grant privileges on only filesystem_fsname.* where fsname is the name of the file system. This will only grant permissions on the database for the file system being monitored.
    Edit the Password
    Edit the password for lwatchadmin by changing mypass to the desired password. Also add a password for the lwatchclient user.
    CREATE USER 'lwatchclient'@'localhost' IDENTIFIED BY 'foo';
    GRANT SELECT ON filesystem_scratch.* TO 'lwatchclient'@'localhost';
    
    CREATE USER 'lwatchadmin'@'localhost' IDENTIFIED BY 'bar';
    GRANT SELECT,INSERT,DELETE  ON filesystem_scratch.* TO 'lwatchadmin'@'localhost';
    GRANT CREATE,DROP           ON filesystem_scratch.* TO 'lwatchadmin'@'localhost';
    
    FLUSH PRIVILEGES;
  6. Save the changes and execute the following command. (This prompts for the MySQL root user password, which was set when mysql_secure_installation was executed.)
    mgs# mysql -u root -p < /usr/share/lmt/mkusers.sql
  7. Create the database for the file system to be monitored.
    (Where fsname is the name of the DAL file system.)
    mgs# lmtinit -a fsname

    LMT data will be inserted into the LMT MySQL database the next time the Cerebro service is restarted on the MGS.

  8. Restart Cerebro.
    mgs# service cerebrod restart
  9. Verify that LMT is adding data to the MySQL database.
    1. Initiate the LMT shell.
      mgs# lmtsh -f fsname
    2. List tables.
      fsname> t
    3. List tables again after several seconds to verify that Row Count is increasing.