gravity-sync
gravity-sync copied to clipboard
Help adding gravity sync to an already configured pihole
Hi there,
I would like to setup a second pihole and have it sync from the primary. I am hoping this can be done without changing the primary pihole config. Also if possible it would be better for me to have the master pihole never accept changes from the secondary one, so the secondary only pulls changes.
Is this achievable? If I setup a blank pihole and configure it this way what additional settings would I need to put in manually that are not synced? The primary one has had many years of custom changes now and so any items not synced will most likely need me to manually setup.
Thank you in advance for any assistance or guidance.
Kind regards P
This does exactly what you need. It won't sync up stream dns etc. but any block lists / custom domains etc it will do just fine. I just set it up yesterday and it works great
This does exactly what you need. It won't sync up stream dns etc. but any block lists / custom domains etc it will do just fine. I just set it up yesterday and it works great
This is excellent. Can you tell me how you installed it so that it inly syncs one way when you set it up?
Follow the steps under install on the github page. Make sure open ssh is enabled on both servers. Once this is done you can type in;
gravity-sync pull
this will pull the config from your pihole, then you can automate it by typing in
gravity-sync automate quad pull
this will pull the config every fifteen minutes. Now i am not 100% sure if the pull argument is working in here but it doesn't give me any errors so i assume so?. I only update the main pihole and never the secondary and it seems to be working fine so far. hope that helps
Thank you, this helps.
Thanks this was how I did it.
On Primary Pihole:
curl -sSL https://raw.githubusercontent.com/vmstan/gs-install/main/gs-install.sh | GS=prep bash
On Secondary Pihole:
curl -sSL https://raw.githubusercontent.com/vmstan/gs-install/main/gs-install.sh | bash gravity-sync compare gravity-sync pull gravity-sync automate hour pull
Another optimization I have found is that since the secondary pihole updating its list is pointless, as it can happen it updates, then the primary updates and it then abandons its updated lists it just pulled and resyncs from the primary anyway is to disable pihole updating on the secondary.
I did this by editing piholes update job here: sudo nano /etc/cron.d/pihole and adding a has in front of the first uncommented line that calls "pihole updateGravity" so it does not ever update the lists from the internet itself. This is slightly more efficient for the second pihole as it simply detects when the master changes and pulls that instead of getting into a potential update then wipe the update every week on a Sunday which is pointless.
P
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.