Setting up a remote database host

Before you begin

You must ensure that the database server port (3306) is open on the firewall. In addition, the intended database host must meet the following requirements:

  • The host is running a supported operating system.
  • The host has at least 4 GB of RAM and 40 GB of hard disk space.
  • The host has database installed.
  • The database host name and the RTM host name can resolve to each other.

About this task

By default, the RTM host runs as the database host. You can choose to set up the database on another host to disperse RTM activity to other machines, or to use a more optimal database host.

Important:

Go through these steps during the initial setup of your RTM installation. If you choose to do these steps after RTM is in operation for a while, the database can take a significant time to transfer to another host, during which the database is down.

Procedure

  1. Manually back up the existing RTM database by using the RTM Console.
  2. Prepare the RTM host for the database transition.
    1. Log in to the RTM host.
    2. Stop all essential services by running the following commands:
      service lsfpollerd stop
      service licpollerd stop
      service crond stop
      chkconfig mysqld off
      
    3. Create a SQL database memory dump by running the following commands:
      mysqldump cacti > cactidump.sql
      mysqldump mysql time_zone_name > timezone.sql
      

      Record the current directory (run pwd), as you need this file path to copy the SQL database dump files to the new database host.

    4. Change the RTM configuration files to refer to the new database host instead of the local host.

      In the following files, go to the line where the database host name is being declared and change "localhost" to the host name of the new database host or change "127.0.0.1" to the IP address of the new database host:

      • /RTM_TOP/cacti/include/config.php
      • /RTM_TOP/rtm/lsfversion_number/bin/grid.conf
      • /RTM_TOP/rtm/etc/lsfpollerd.conf
      • /etc/rsyslog.conf
      • /RTM_TOP/cacti/plugins/syslog/config.php
      • /RTM_TOP/rtm/etc/lic.conf
    5. Update the ODBC configuration file on the RTM management host. Use odbcinst -j to find the file location for System Data Sources. Add the following lines:
      [root@tfqc58 etc]# odbcinst -j
      unixODBC 2.2.11
      DRIVERS............: /etc/odbcinst.ini
      SYSTEM DATA SOURCES: /etc/odbc.ini
      USER DATA SOURCES..: /root/.odbc.ini
      
      [root@tfqc58 etc]# cat /etc/odbc.ini
      [cacti]
      Description             = Data Source for IBM Spectrum RTM.
      Driver          = MySQL RTM
      Server          = <remote database hostname>
      Database                = cacti
      UID             = cacti
      PASSWORD                = admin
      Port            = 3306
      Socket          =
      Option          = 4196352
      Stmt            =
  3. Set up the new database host for RTM.
    1. Log in to the new database host.
    2. Set up the database services by running the following commands:
      yum install mysql-server mysql
      chkconfig mysqld on
      /etc/init.d/mysqld start
      
    3. Create a new RTM database by using the following command:

      mysqladmin -u root create cacti

    4. Assign the appropriate database privileges by running the following commands:
      mysql -u root mysql -e "GRANT ALL ON cacti.* TO cacti@rtm_host_ip IDENTIFIED BY 'admin';"
      mysql -u root mysql -e "GRANT SELECT ON mysql.time_zone_name TO cacti@rtm_host_ip IDENTIFIED BY 'admin';"
      

      where rtm_host_ip is the IP address of the RTM.

    5. Back up the original my.cnf file and copy the my.cnf.*.innodb files from <RTM_TOP>/rtm/share in the RTM host to /etc in the new database host by running the following commands:
      cp my.cnf my.cnf.original
      scp root@rtm_host_ip:<RTM_TOP>/rtm/share/my.cnf.*.innodb /etc/my.cnf
      

      where rtm_host_ip is the IP address of the RTM host.

    6. Copy the SQL database dump files from the RTM host to the new database host by running the following commands:
      scp root@rtm_host_ip:path_to_sql_dump/cactidump.sql /tmp/
      scp root@rtm_host_ip:path_to_sql_dump/timezone.sql /tmp/
      

      where rtm_host_ip is the IP address of the RTM host and path_to_sql_dump is the file path to the database dump files.

    7. Import the SQL database dump files into the new database by running the following commands:
      mysql cacti < /tmp/cactidump.sql
      mysql mysql < /tmp/timezone.sql
      
    8. Restart the database by running the following command:

      service mysqld restart

  4. Restart the services and verify that the remote database is set up properly.
    1. Log in to the RTM host.
    2. Restart the essential services by running the following commands:
      service crond start
      service rsyslog restart
      service lsfpollerd start
      service licpollerd restart
      
    3. Verify that the database is set up properly by running the following command:

      service lsfpollerd status

      service licpollerd status

      If lsfpollerd and licpollerd are running, the database is set up properly.