Syncing config data to make Cacti HA - Working!!!

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

Moderators: Moderators, Developers

Post Reply
Posts: 11
Joined: Fri Jul 08, 2011 12:24 pm

Syncing config data to make Cacti HA - Working!!!

#1 Post by rizlo100 » Wed Jul 27, 2011 11:29 am

Hi All,

I have a requirement to have a full HA cacti environment. It also happens the 2 servers are located on other sides of the continent from each other.

I've looked into DRBD and all that stuff. Don't like it. I also don't want to be syncing the RRA directory every x hours.
I've settled on running the poller in both locations, but would like a way to have the config data synced only. So if I add a host on the primary, then it will show up on the backup eventually and start graphing on it's own.

I would like each site to have it's own graph data, this way we can see the latency difference between the two sites, so from what I understand I do not want to sync the entire DB. Is anyone able tell me what tables I need to replicate in order to accomplish this? Or if it can even be done?
Last edited by rizlo100 on Tue Aug 02, 2011 12:59 pm, edited 1 time in total.

Posts: 11
Joined: Fri Jul 08, 2011 12:24 pm

Re: Syncing config data

#2 Post by rizlo100 » Tue Aug 02, 2011 12:58 pm

Just thought I would post back here with my results.

I've been able to achieve cacti in a geographical redundant HA configuration. The process i used is as follows.
Notes: both sites run their own poller, both sites maintain their own RRD information.

- Setup cacti at SiteA. Get it to a production ready state with all your hosts and what not.
- At SiteB, setup your php/httpd/mysql services.
- Copy the entire cacti directory from SiteA to the same location at SiteB
- Dump the DB at SiteA and import into SiteB
- By now you should have 2, completely separate instances of cacti running, each polling on their own, each maintaining their own RRD info (usefull to see latency differences between your cacti sites). Cool, but no good if you have hundreds of hosts to manage. Duplicating work is for people that are not lazy, like me.
- Setup 2-way MySQL replication between the 2 DBs, but exclude the following tables from replicating.
replicate-ignore-table = cactidb.poller_output
replicate-ignore-table = cactidb.poller_command
replicate-ignore-table = cactidb.poller_time
replicate-ignore-table = cactidb.poller_reindex
replicate-ignore-table = cactidb.user_log
replicate-ignore-table = cactidb.poller
replicate-ignore-table = cactidb.settings

- Open a beer.

Someone with more MySQL-fu may be able to improve on the ignore list...mainly the settings table. It would be nice to replicate the table, however it seems the poller places a timestamp of it's last run in there. Unless your pollers are 100% in sync, I've found this causes the poller at one site or another to not run, as it thinks it already has. MySQL has the ability to filter replication down to the row level...but I didn't take it that far.

For us, this was the best route to get some sort of HA out of cacti. Initially I had thought of syncing RRD files and what not as others have mentioned on the forums and just keep a Cold-Standby. Going this route, we only need to make a change at 1 site and it's replicated almost instantly and we don't have to worry about rsyncing loads of RRD data. If one of the 2 fails, it's not big deal as the other is still running. I don't need to worry about lost RRD info, as the other site will have it.

Cacti User
Posts: 55
Joined: Fri Dec 29, 2006 4:02 am

Re: Syncing config data to make Cacti HA - Working!!!

#3 Post by jerrison » Tue Nov 29, 2011 3:30 am

you, sir, deserve a medal :). That is the exact answer to what i was looking for: how to build a redundant cacti-system over WAN.


Posts: 11
Joined: Fri Jul 08, 2011 12:24 pm

Re: Syncing config data to make Cacti HA - Working!!!

#4 Post by rizlo100 » Tue Nov 29, 2011 1:24 pm

Good luck on your build out, feel free to post any questions you may have. We have been running this setup since August with 0 issues and have had to make use of the HA'ness more then once when our main site has connectivity issues.

User avatar
Cacti User
Posts: 79
Joined: Fri Jan 14, 2011 3:28 pm
Location: Lincoln, NE

Re: Syncing config data to make Cacti HA - Working!!!

#5 Post by bkbristlin » Wed Nov 30, 2011 9:05 am

I was wondering myself it anyone was going to come up with something like this. I would love to have a second one running at my DR site. I'm going to bookmark this post for sure. Right now we run Solarwinds at one site and Cacti at the other. I can see this coming in handy for a failover Cacti down the road.

User avatar
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany

Re: Syncing config data to make Cacti HA - Working!!!

#6 Post by gandalf » Sun Dec 04, 2011 7:07 am

Well, this post is indeed helpful. Especially as it is quite short and nevertheless complete when it comes to MySQL replication.
I made up my mind to start documenting different known HA solutions at Give me a week or two

Post Reply