How does each node know about each other in ha mode?

How the nodes know about each other in ha mode, so they can share information about the sessions, login atempts and so on… ? What configuration makes them to know each other?

I‘ve made video about Keycloak Cluster config:

Hi, I’ve watched the video, but I’m not using docker. I’ve setup 2 standalone-ha virtual machines with a shared database and a http/https load balancer in front. If I log in with the 2 vm up and then power off one of them, when I refresh the page it takes me back to login page. So the session is not being preserved. What can I do to solve it?

It’s not related to Docker, it’s just the platform I used for my demo.
You have to configure a proper cluster.
Please read the server admin docs, it’s all in there.

@dasniko I know everything is in the admin docs. I’ve already read the docs. In standalone-ha.xml I’ve just configured the database access properties, nothing else. As docs says, everything is pre-configured. I have two vm’s in the same subnet and I would expect they talk to each other via multicast. I can see some logs about it, but the problem is: the session is being lost when I power off one of the vm’s. The standalone-ha.xml is too difficult for me, that’s why I’m asking for help, if you don’t mind to give me some tips.

Ok, now we know what you did, what is working and can guess where the error might be. Just saying „it doesn‘t work“ is useless if we don‘t know the other parts.

Most likely you have to configure the cache owners, as these are defaulting to 1 and thus data is distributed only on 1 node (so, local only, no cross-node distribution): Server Installation and Configuration Guide

Hello, thanks for the help. But it still loosing the session when I power off one of the vm´s behind the LB. I´ve set the owners like this:

 <distributed-cache name="sessions" owners="2">
                    <expiration lifespan="900000000000000000"/>
                </distributed-cache>
                <distributed-cache name="authenticationSessions" owners="2">
                    <expiration lifespan="900000000000000000"/>
                </distributed-cache>
                <distributed-cache name="offlineSessions" owners="2">
                    <expiration lifespan="900000000000000000"/>
                </distributed-cache>
                <distributed-cache name="clientSessions" owners="2">
                    <expiration lifespan="900000000000000000"/>
                </distributed-cache>
                <distributed-cache name="offlineClientSessions" owners="2">
                    <expiration lifespan="900000000000000000"/>
                </distributed-cache>
                <distributed-cache name="loginFailures" owners="2">
                    <expiration lifespan="900000000000000000"/>

Try using replicated cache instead, but distributed cache should work as well.