gravity-sync icon indicating copy to clipboard operation
gravity-sync copied to clipboard

Allow sync between more than 2 PiHoles.

Open pauljrowland opened this issue 2 years ago • 10 comments
trafficstars

Would it be possible to implement this in a way which syncs more than 2 PiHoles?

I understand as it's more than a 2-way sync, a master-slave topology may need to be introduced (i.e. changes made on number 1 are pushed to 2, 3 4,.... etc.).

I am using 2 PiHoles at work using gravity-sync and we have a second site. This will total 4 PiHoles and it would be nice to keep all 4 in sync as opposed to 2 lots of 2.

pauljrowland avatar Jan 09 '23 13:01 pauljrowland

https://www.techaddressed.com/tutorials/gravity-sync-pi-hole-instances/

smithj33 avatar Jan 15 '23 07:01 smithj33

Love this project, been using it for a long time now. I would also vote for this feature especially if it was somehow cloud enabled. Aside from wanting a third instance in my home, i am currently maintaining Piholes at my mother and my two sister's houses. would love to be able to make changes in one location and have them all be sync'd. i looked at pihole-cloudsync, but it does not seem to be maintained any longer. also looked at orbital-sync, but the piholes need to be in the same network.

chupacabra71 avatar Jan 25 '23 18:01 chupacabra71

https://www.techaddressed.com/tutorials/gravity-sync-pi-hole-instances/

do i understand right, that i have to use gravity-sync auto only on my secondary pihole's and the primary stays "passiv" without any automation?

soonic6 avatar Mar 11 '23 22:03 soonic6

Those thing only support 2 Piholes. Like OP, I would need to sink multiples piholes to a single one. I was able to sync no1 and no2 together. But no3 always fails to pull no1.

kodiakastu avatar Jul 19 '23 21:07 kodiakastu

Those thing only support 2 Piholes. Like OP, I would need to sink multiples piholes to a single one. I was able to sync no1 and no2 together. But no3 always fails to pull no1.

The instructions I provided above sync multiple. I have 3 instances. #2 syncs with #1. #3 syncs with #1. Been using it without issue.

smithj33 avatar Jul 19 '23 22:07 smithj33

Quesiton about implementing this after the fact: How do you reconfigure Gravity Sync if it's already installed and you want to add a third pi? is it as simple as gravity-sync disable on the primary install and then gravity-sync pull then gravity-sync auto on the other two configured to point at the primary IP?

y8s avatar Nov 02 '23 15:11 y8s

Quesiton about implementing this after the fact: How do you reconfigure Gravity Sync if it's already installed and you want to add a third pi? is it as simple as gravity-sync disable on the primary install and then gravity-sync pull then gravity-sync auto on the other two configured to point at the primary IP?

Follow the instructions at the link above. On your primary pi, you will need to rerun the gravity sync config and follow the instructions which will make it your primary. Then continue with the tutorial to get your other 2 to sync with the primary.

smithj33 avatar Nov 02 '23 15:11 smithj33

Quesiton about implementing this after the fact: How do you reconfigure Gravity Sync if it's already installed and you want to add a third pi? is it as simple as gravity-sync disable on the primary install and then gravity-sync pull then gravity-sync auto on the other two configured to point at the primary IP?

Follow the instructions at the link above. On your primary pi, you will need to rerun the gravity sync config and follow the instructions which will make it your primary. Then continue with the tutorial to get your other 2 to sync with the primary.

Looking at the gravity-sync.conf file it looks like it just leaves the host and user blank instead of adding an IP and username:

REMOTE_HOST=''
REMOTE_USER=''

and on the secondary/ies:

REMOTE_HOST='primary ip'
REMOTE_USER='primary username'

The instructions aren't clear on whether or not you need to run gravity-sync auto on the primary as well. It seems to me it wouldn't do anything but throw errors about missing hostname/username.

y8s avatar Nov 02 '23 17:11 y8s

It just needs to be installed on the primary. It's just playing a host role and doesn't connect to anything. I checked my primary config and all the fields are blank. My secondaries have the IP and user like yours. You only run auto on your secondaries or choose a specific schedule, as I did, since Auto is random and I wanted them to all be synced quickly. If you run into issues, it's likely ssh related. Make a change on your primary. Then go to your secondaries and do a Pull to see if the changes synced. Push only works with 2 way sync. Set gavity-sync update as a cron job to keep it updated. Hope that helps.

smithj33 avatar Nov 02 '23 18:11 smithj33

I did some testing and the primary is "disabled" with the secondaries "auto" and it does what it's supposed to. Auto is fast enough but I might play around with speeding up the secondaries.

How often do you sync?

y8s avatar Nov 02 '23 18:11 y8s

Effective July 26, 2024, this project has been retired. Thank you for your use and enthusiasm for a project that began as a few lines of bash in a Slack channel and envolved into something far more complex, and used by many thousands of Pi-hole enthusiasts over the last four years.

vmstan avatar Jul 26 '24 18:07 vmstan