You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2022-12-18-install-pihole-ha.md
+68-10Lines changed: 68 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,14 @@ To have a high availability cluster, you will need more than one Pi-hole instanc
72
72
sudo apt install keepalived libipset13 -y
73
73
```
74
74
75
-
Once installed, edit the configuration file
75
+
By default `keepalived` will only swap over if the entire node is down. What we really want is failover when the DNS services are down. To enable service failover we will need to have `keepalived` run a script, which requires a script user.
| 1 | The first thing to configure is the instance name. I have it set to `pihole`. |
110
-
| 2 | You will need to decide the node's default disposition, whether it is the master node or a backup. Keep in mind, the node's disposition will change as necessary based on other nodes. If another node enters the cluster with a higher priority, it will always become the master node. |
111
-
| 3 | The name of the interface that the virtual IP will be bound. Can be found using `ip a`. |
112
-
| 5 | The priority will configure which node is the Master. The master node will always be the node with the highest priority |
113
-
| 6 | The advertisement timespan in seconds. |
114
-
| 7 | You will need to add the node's IP |
115
-
| 8 | The other nodes IPs |
128
+
| Line | Description |
129
+
| ---- | --- |
130
+
| 1 | The first thing to configure is global definitions. We need to enable scripts and auto priority. |
131
+
| 5 | Then configure the health check script. This script will make a DNS query and return 1 if it fails. `keepalived` will interpret any response other than 0 as a failure |
132
+
| 11 | The instance name. I have it set to `pihole`. |
133
+
| 12 | You will need to decide the node's default disposition, whether it is the master node or a backup. Keep in mind, the node's disposition will change as necessary based on other nodes. If another node enters the cluster with a higher priority, it will always become the master node. |
134
+
| 13 | The name of the interface that the virtual IP will be bound. Can be found using `ip a`. |
135
+
| 15 | The priority will configure which node is the Master. The master node will always be the node with the highest priority |
136
+
| 16 | The advertisement timespan in seconds. |
137
+
| 17 | The current node IP IP |
138
+
| 18 | The other nodes IPs |
139
+
| 23 | Node authentication. Keep in mind this is unencrypted, which is why we specify the other nodes by IP |
140
+
| 32 | The script to run to verify DNS is live |
116
141
117
142
> Never set an IP reservation for the virtual IP, or set it as a static address for another device
118
143
{: .prompt-warning }
@@ -189,4 +214,37 @@ gravity-sync auto
189
214
190
215
Auto will follow use the last successful connection made, pull or push.
191
216
217
+
## Updating Pi-Hole
218
+
219
+
If you regularly backup your pihole server, you can also automatically update your server. One easy way is to run a script using cron. Create the script somewhere in your home directory.
220
+
221
+
```bash
222
+
nano /home/patrick/.local/bin/update_pihole.sh
223
+
```
224
+
225
+
```bash
226
+
#!/bin/bash
227
+
228
+
# update pihole
229
+
/usr/bin/sudo pihole -up
230
+
231
+
# reboot
232
+
/usr/bin/sudo systemctl reboot -i
233
+
```
234
+
235
+
Then add the script to crontab. It's a good idea to stagger the different instances of pihole so if something goes wrong, you can catch it.
0 commit comments