Added steps to split DB off to its own server (#11130)

I struggled to get this working, so thought I would add my steps to the FAQ to help future users. Thanks to @murrant for the step about the .env file, that was the last piece of the puzzle.

Co-authored-by: Hans Erasmus <erasmushans27@gmail.com>
This commit is contained in:
SourceDoctor
2020-02-11 15:49:16 +01:00
committed by GitHub
parent 19a82e1500
commit 6fe840dc8d

View File

@@ -41,6 +41,7 @@ path: blob/master/doc/
- [My alerts aren't being delivered on time](#my-alerts-aren't-being-delivered-on-time)
- [My alert templates stopped working](#my-alert-templates-stopped-working)
- [How do I use trend prediction in graphs](#how-do-i-use-trend-prediction-in-graphs)
- [How do I move only the DB to another server](#move-db-to-another-server)
# Developing
@@ -314,7 +315,7 @@ architecture then the following steps should be all that's needed:
- Stop cron by commenting out all lines in `/etc/cron.d/librenms`
- Dump the MySQL database `librenms` from your old server (`mysqldump
librenms -u root -p > librenms.sql`)...
- and import it into your new server (`mysql -u root -p < librenms.sql`).
- and import it into your new server (`mysql -u root -p librenms < librenms.sql`).
- Copy the `rrd/` folder to the new server.
- Copy the `config.php` file to the new server.
- Check for modified files (eg specific os, ...) with `git status` and
@@ -593,4 +594,25 @@ To view a prediction:
- Click update
You should now see a linear prediction line on the graph.
## <a name='move-db-to-another-server'>How do I move only the DB to another server?</a>
There is already a reference how to move your whole LNMS installation to another server. But the following steps will help you to split up an "All-in-one" installation to one LibreNMS installation with a seperate database install.
*Note: This section assumes you have a MySQL/MariaDB instance
- Stop the apache and mysql service in you LibreNMS installation.
- Edit out all the cron entries in `/etc/cron.d/librenms`.
- Dump your `librenms`database on your current install by issuing `mysqldump librenms -u root -p > librenms.sql`.
- Stop and disable the MySQL server on your current install.
- On your new server make sure you create a new database with the standard install command, no need to add a user for localhost though.
- Copy this over to your new database server and import it with `mysql -u root -p librenms < librenms.sql`.
- Enter to mysql and add permissions with the following two commands:
```
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'IP_OF_YOUR_LNMS_SERVER' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'FQDN_OF_YOUR_LNMS_SERVER' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
```
- Enable and restart MySQL server.
- Edit your `config.php` file to point the install to the new database server location.
- **Very important**: On your LibreNMS server, inside your install directory is a `.env` file, in it you need to edit the `DBHOST` paramater to point to your new server location.
- After all this is done, enable all the cron entries again and start apache.