Skip to end of banner
Go to start of banner

Moving the NMIS database to a new partition

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

In it's default configuration NMIS likes to be at /usr/local/nmis8, with all of it's data held within this directory but NMIS is not required to be in this location.  All, or just parts, can be moved to different directories which can be on different partitions or Logical Volumes.

Example:

Goal: To move the NMIS database off of the same partition as /usr/local, at the same time, make a backup of the NMIS runtime.  To accomplish this goal we first need a location where we will move/copy the files to, for this example I will use a target of /opt/nmis8.  Once we have this we will copy all of NMIS8 to the new location, then edit the config files in the current location to use the new data directories.

  1. Copy or move files to new directory (on a production system, you should stop NMIS from polling by editing the crontab and appending a "#" to the lines for NMIS polling).

    1. Copy files to a new directory

      cp -r /usr/local/nmis8/database /opt/nmis8
    2. Move files to a new directory

      mv /usr/local/nmis8/database /opt/nmis8
  2. Fix permissions on the copied files. 

    chown -Rv nmis:nmis /opt/nmis8
    chmod -Rv g+w /opt/nmis8 
  3. Edit config files so that NMIS will write data to our new location, edit /usr/local/nmis8/conf/Config.nmis 

    # this line
    line 13: '<nmis_data>' => '<nmis_base>',
    # should change to
    line 13: '<nmis_data>' => '/opt/nmis8',
  4. To test, move the existing data directores to new folders. 

     mv /usr/local/nmis8/database /usr/local/nmis8/database_old
  5. Run a manual update, you should see no errors. 

    /usr/local/nmis8/bin/nmis.pl type=update debug=1
    # you should not see any errors like this:
    # createRRD, ERROR (localhost) unable to create /opt/nmis8/database/health/server/localhost-reach.rrd: creating '/opt/nmis8/database/health/server/localhost-reach.rrd': No such file or directory  
  6. Open or reload the NMIS web page and everything should still look the same.
  7. After confirming there are no errors you can now safely delete the old database directory. 

    rm -rf /usr/local/nmis8/database_old

Conclusion

In addition to moving the database folder, it may also be a good idea to move the logs folder if you are running short of space on the partition holding /usr/local.

We now have NMIS saving all databases to a different folder (which could be on a different partition).

  • No labels