can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?
-
@comet424
You can do this with the HAproxy package. You can add both home assistant VMs to a backend, either both active or one as backup.
Then you have to send the packets to pfSense instead of to the VMs directly. -
@viragomann
ok ill install that and try it... and how do you send the packets directly pfsense instead of the vmsis that
accessing by "homeassistant" or do you need to
say
192.168.0.1:8123 and using that port would forward with haproxy... but ill download that later today when im home and take a look -
@comet424
To access the home assistant point the client to pfSense instead of the VM.
You can also change the home assistant VMs IPs to something else and assign their original IPs to pfSense. So no changes on the clients is needed.A point to consider is that going over HAproxy replaces the client IP with pfSense IP. So the server doesn't know the real client IP anymore. Maybe this is an issue.
-
not a 100% what you mean.... as i not fluent in pfsense just simple home user...
but i installed the haproxy and setup backend but not working by homeassistant name
not sure what else i need to do .. tried a couple youtube video but got confused but here is some screen shots
-
Do you have a front end pointing to it?
What name are you trying to use? Does it resolve to an IP HAProxy is listening on?
-
no i dont have a front end setup didnt know i had to..
i just going from what @viragomann said about backend
what i trying to do is have 2 Home Assistant VMs clones
main at
192.168.0.12and backup at 192.168.0.10
and what i want is like
http://homeassistant:8123 and it will go to the main one but if the main one it goes down due to server reboot it will flip to the backup running on a backupserver
or even use like
http://homesystem or http://homeassistant without the port but it know to go to 8123so i wanted like
that carp fail over for pfsense of if microsoft.com goes down on 1 server another one will pick up the slack
least thats what i trying to do at home -
@comet424
Any connection through HAproxy needs a frontend and a backend. I just managed the backend, because this does the trick of failover.In the frontend you configure, which IP and port HAproxy is listening and to which backend the connection should be forwarded.
So set up a fronted for listening to a proper interface address and port 8123. Select the homeassistant backend as default backend.
and what i want is like
http://homeassistant:8123 and it will go to the main one but if the main one it goes down due to server reboot it will flip to the backup running on a backupserverSo you should set the backup server as backup type in the backend.
-
@viragomann ok ill give it a try i was getting confused
so did i do the backend correctly? or was it wrong what i did... ill give it a try the front again
or is it
front end is main home assistant
backend is the backup home assistant -
@comet424 said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:
front end is main home assistant
backend is the backup home assistant?
You want HAproxy to forward all requests to the main home assistant, expect if it's down, then the requests should go to the backup.
So edit the backup in the backend and set the type to "backup".
Actually both are "active". With this setting HAproxy does load balancing, i.e. the first request is sent to main, the second to backup and so on. -
looks like i buggered it up i got a bind error?
so i guess i did it wrong -
@comet424
The frontend must listen on an interface address of pfSense, as I mentioned above twice. -
if you mean the listem address
i changed that to custom as i couldnt get the 192.168.0.12 or is this how it should look
-
@viragomann
Please slow down and follow the suggestions.
I told you to simply edit the backup server in the backend and change the type to "backup". You need a single backend. -
@viragomann
ok i lostfirst you said i just need backend then steph siad i need a front end..then you said i need a front end but you did it with just a backend
i said i changed the front end localhost to custom cuz thats where i want 192.168.0.12 main home assistant
but you said i did it wrong so i put it to the backendso the main home assistant is Active and the backup home assistant is backup
cuz there is no main....i need it explained simpllified like if you were teaching high school student.. cuz with learning disiability i not understanding 100%
so should it look like this then cuz i not grasping it yet fully i a visual learning not so much with words
-
@comet424 said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:
first you said i just need backend then steph siad i need a front end..then you said i need a front end but you did it with just a backend
@viragomann said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:
Any connection through HAproxy needs a frontend and a backend. I just managed the backend, because this does the trick of failover.
Again, the frontend listens on an interface an port for requests like any other server does. And it forward the request to a backend, basically this can be based on ACLs, but this is not needed for your purpose. You can state your backend as default backend.
In the backend settings you state the backend servers with IP addresses and ports. Since you want to realize a failover, you need to add both home assistant server to a single backed, the main as active, the backup as backup.
Is this really as complicated?
-
@viragomann i did have both Active and backup of the ip address in Backend and you said that was wrong so i deleted the active
as you seen in the pic i had both and then you bolded that i needed a single backend so the way you sounded i had to erase the active one
-
@comet424
Your very first screenshot above shows both server as active. So I advised you@viragomann said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:
So you should set the backup server as backup type in the backend.
-
@viragomann
dont remember i talking about the picture right above your reply thats where it says Active and backup and when i read your message i then deleted the active imageviragomann
33 minutes ago@viragomann
Please slow down and follow the suggestions.
I told you to simply edit the backup server in the backend and change the type to "backup". You need a single backend.but ok so i put it back in i set it the way its in the pic... im sure i not done what else do i need to edit?
-
so i tried to see if it works
by trying http://homeassistant:8123 that didnt work
i tried the name home_assistant:8123i tried
192.168.0.1:8123 that didnt work eitheri did try changing the Listening interface from Localhost to LAN
so it set it to
192.168.0.1:8123now when i accessed that i got a 503 server error... but still couldnt access http://homeassistant to access the backup server
or by the 192.168.0.1 pfsense boxas i turned off the main home assitant... but ill keep playing around too.. trial and error (:
i also checked off the box use forwarder.. i not sure if you need that checked off or not
-
@comet424
Seems you're going on doing try and fail.by trying http://homeassistant:8123 that didnt work
i tried the name home_assistant:8123Is the client able to resolve these host names to pfSense? You've probably to update your DNS accordingly.
i did try changing the Listening interface from Localhost to LAN
so it set it to
192.168.0.1:8123Localhost only makes sense if you forward the packets on the incoming interface port 8123 to it.
Otherwise let HAproxy listen on the interface address.now when i accessed that i got a 503 server error... but still couldnt access http://homeassistant to access the backup server
or by the 192.168.0.1 pfsense boxIf you look in the HAproxy stats, are the backends shown as online at all?
Maybe we can get a step beyond, when you provide some more details about your network and the HAproxy settings.