Server Migration
Observium stores its data in two places, historical data in in RRD format files in the rrd directory and state data and events in the MySQL database. This makes migration easy as you only need to transfer these along with the relevant config.php entries to the new system.
We strongly recommend keeping your config.php small to simplify migrations.
Prepare new server
Firstly install Observium on the new server. You can follow the install guides for this. Ensure that you can log in to the server, and that polling and the web interface function correctly. We recommend using the install script.
Make a note of the database settings for the new server. You'll need these later. You can paste them into a notepad or another text editor.
Text Only | |
---|---|
1 2 3 4 5 6 |
|
Now go back to the old server to dump and copy the MySQL database, rrd files and config.
Database dump
To dump the database you need to use the mysqldump
command. We recommend using --add-drop-table
and --extended-insert
. Additional option is --no-tablespaces
for prevent error 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation'. You can get the username and password required by grepping them from the configuration file.
Text Only | |
---|---|
1 2 3 4 5 6 |
|
Here we would use "observium" as the username and "password" as the password.
Text Only | |
---|---|
1 |
|
This will promp you for your observium database password and dump the database to a file called observium-dump.sql
Text Only | |
---|---|
1 2 3 4 |
|
RRD files
The RRD files can be tarred and copied or rsynced to the new server. We'll use tar here. rsync is potentially faster, but more complicated.
Text Only | |
---|---|
1 |
|
This command will compress all of the RRDs into a single file you can copy to the new server.
Text Only | |
---|---|
1 2 3 4 5 |
|
Copy files
You now need to copy the two files you generated along with the config.php to the new installation.
From the new server you can use scp to copy them.
Text Only | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 |
|
You should now have the three files in the /opt/observium directory on the new server
Text Only | |
---|---|
1 2 3 4 |
|
Modify configuration
Modify the config.php file to replace the database entries from the old server with the ones you copied at the start of this guide. The new server has a different MySQL password, so the old server's config.php won't work without copying at least the username and password generated during installation of the new install.
Note that from this point on we always use the new database username and password.
Replace database
Before we insert the database information it's a good idea to delete all of the tables, just in case there's a mismatch in version between the old and new servers.
Generate a list of tables on the new server and use it to delete them. We will use the MySQL root password for this. We also need to disable and re-enable foreign key checks whilst doing this.
Text Only | |
---|---|
1 2 3 4 |
|
Your observium database should now be compeltely empty. You can insert the dump you generated earlier
Text Only | |
---|---|
1 2 3 4 5 |
|
Replace RRD files
Finally we can restore the RRD files from the tar file. It's probably a good idea to delete the existing RRD directory first.
Text Only | |
---|---|
1 2 |
|
The tar file should give a long list of RRDs it's restoring as it's run
Text Only | |
---|---|
1 2 3 4 5 6 7 |
|
You should also make sure the permissions are correct on the RRD files
Text Only | |
---|---|
1 |
|
Finished!
You should now be able to log in to the web interface. Ensure that devices are being correctly polled.
You may need to do additional configuration for mail or other services from the old server.
This process can also be used for backup/restoration by periodically dumping the database, tarring the RRDs and copying them to a backup location. Restoration is as simple as using the backup files in this guide.