Cacti server migration

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Moderators, Developers

Post Reply
Author
Message
neox01
Posts: 34
Joined: Thu Nov 24, 2011 2:50 am
Location: Germany

Cacti server migration

#1 Post by neox01 » Thu Feb 21, 2019 8:51 am

Hello,

I'm currently running Cacti v1.1.28 on SLES 11 on server A.
The server needs to be migrated.
I've already installed Cacti v1.1.38 on RHEL 7 from the EPEL repository on server B.

Is it nessesary or recommended to upgrade Cacti to the same destination version first before proceed with the migration?
I understood that it is not possible to simply copy the RRD files, but they have to be dumped and restored with rrdtool.

Thanks a lot in advance for any advice!

netniV
Cacti Guru User
Posts: 2872
Joined: Sun Aug 27, 2017 12:05 am

Re: Cacti server migration

#2 Post by netniV » Thu Feb 21, 2019 11:50 am

You will need to migrate your database but having the exact same version isn't an issue as it will ask you to upgrade the DB.

You are also correct that if you are switching between 32-bit and 64-bit then the data must be exported and imported from the RRD files. There are tutorials on how to do this.

In the database, there are various settings which relate to paths, they should probably be checked to make sure that they are valid on the new system.

neox01
Posts: 34
Joined: Thu Nov 24, 2011 2:50 am
Location: Germany

Re: Cacti server migration

#3 Post by neox01 » Thu Feb 21, 2019 12:14 pm

Hello netniV,

Did I understand you correctly, if the architecture does not change (both 64-bit), then it is not necessary to export and import the RRD files? I can simply copy them?

The installation paths actually differ considerably. In which tables do path specifications exist that I have to check/change?

The database migration I'll properly simply do with mysqldump. Can I keep the cacti database on the new server or is it better to drop it first?

tertius
Cacti User
Posts: 71
Joined: Wed Mar 01, 2017 2:34 pm

Re: Cacti server migration

#4 Post by tertius » Thu Feb 21, 2019 7:59 pm

Regarding export and import of *.rrd files... you can use these two totally simple shell scripts for this.

Export:

Code: Select all

#!/bin/sh

# export all *.rrd files to xml

for i in `find -name "*.rrd"`; do rrdtool dump $i > $i.xml; done

Import:

Code: Select all

#!/bin/sh

# import all *.rrd.xml to *.rrd files to current architecture

for i in `find -name "*.rrd.xml"`; do
  rrd=${i%%.xml}
  mv -f $rrd $rrd.orig
  rrdtool restore $i $rrd
done

neox01
Posts: 34
Joined: Thu Nov 24, 2011 2:50 am
Location: Germany

Re: Cacti server migration

#5 Post by neox01 » Tue Aug 06, 2019 8:02 am

I still stuck on this topic :-/
After migrating the database, even the version kept the same, I do see a blank browser screen with a connection failure issue. I kept the cacti install, logs etc. folder.
If I drop and re-create a new cacti database I can login to cacti perfectly fine.
Did anybody successfully migrated from one Linux distribution to the other? As @netniV mentioned there might be wrong paths in the database, but which tables needs to be checked?
Any help is much appreciated.

neox01
Posts: 34
Joined: Thu Nov 24, 2011 2:50 am
Location: Germany

Re: Cacti server migration

#6 Post by neox01 » Tue Aug 06, 2019 8:22 am

db migration

backup

Code: Select all

# mysqldump -u root -p'<password>' cacti > cacti.dump
restore

Code: Select all

> drop database cacti;
> create database cacti;
# mysql -u root -p'<password>' cacti < cacti.dump
since I migrated from MySQL to MariaDB I run an mysql upgrade in addition (https://mariadb.com/resources/blog/mysq ... mysqldump/)

Code: Select all

# mysql_upgrade [--force] -u root -p'<password>'

neox01
Posts: 34
Joined: Thu Nov 24, 2011 2:50 am
Location: Germany

Re: Cacti server migration

#7 Post by neox01 » Wed Aug 07, 2019 8:52 am

Could it be an easier option maybe to install the latest version of Cacti (comming from 1.1.28) including a fresh new database installation and import only the tables that contain device data information?
The idea is to avoid searching all tables for (old) paths and manually adapting them to the new server folder structure.

netniV
Cacti Guru User
Posts: 2872
Joined: Sun Aug 27, 2017 12:05 am

Re: Cacti server migration

#8 Post by netniV » Mon Aug 12, 2019 2:15 pm

The archetecure of Cacti itself does not change betwee n32-bit and 64-bit. However, RRDTool does change between 32-bit and 64-bit.

User avatar
Osiris
Cacti Pro User
Posts: 863
Joined: Mon Jan 05, 2015 10:10 am

Re: Cacti server migration

#9 Post by Osiris » Mon Aug 12, 2019 5:19 pm

Here is a quick step by step:


1) 64bit -> 64bit no export required.
2) install new server with version of choice, don't enable cron
3) keep old version running
4) dump database on old system to *.sql file
5) drop database on new system, then recreate and load from the *.sql file
6) cd to cli directory and run php -q database_upgrade.php --forcever=1.1.28
7) move copy all plugins that are in use to the new system
8) update all paths in the settings table if you've changed them
9) Copy any custom scripts and resource files to new system
10) build spine if using it, and establish config
11) if you are planning on keeping the same collector frequency, then enable cron, else, that's another article
12) scp your rrdfiles from the old system to the new system as the apache/www-run user, may require a home directory, change of shell for short period of time and setup of transparent ssh
13) confirm everything is error free
14) rinse and repeat until you get it right
15) shutdown old server

I think that is pretty close.
Before history, there was a paradise, now dust.

Post Reply