Ejabberd scaling/clustering

Hi! I just want to understand how scaling works, so for instance, I have 2 servers with two A records pointing to them: x.domain.com and y.domain.com
I currently have x setup and working with SRV records like so:

_xmpp-client._tcp.domain.com. 18000 IN SRV 0 5 5222 x.domain.com.
_xmpp-server._tcp.domain.com. 18000 IN SRV 0 5 5269 x.domain.com.
_xmpp-server._tcp.conference.domain.com. 18000 IN SRV 0 5 5269 x.domain.com.

So, I would assume that the accompanying records for server y would be:

_xmpp-client._tcp.domain.com. 18000 IN SRV 0 5 5222 y.domain.com.
_xmpp-server._tcp.domain.com. 18000 IN SRV 0 5 5269 y.domain.com.
_xmpp-server._tcp.conference.domain.com. 18000 IN SRV 0 5 5269 y.domain.com.

Is this correct?
Then, in order to cluster, I would copy the cookie and .yml over to server y from x. Now, i get confused and where I have more questions:
1. According to the clustering guide, I will need to use "join_cluster":
ejabberdctl join_cluster 'ejabberd@ejabberd01'
so would it be something like this in my case? "ejabberd@x.domain.com" ?
2. Do I also need to configure hostnames to match x and y A record names?
3. What about reverse PTR?
4. How are the databases (i am using mnesia) going to be synced?
5. What happens when I need to add more servers? Do I just run the same join_cluster command to cluster with ejabberd01 node?
6. What would I use as the FQDN in each .yml? Would both be domain.com or would it be x.domain.com and y.domain.com depending on the server?

Let's clarify terms: - the

Let's clarify terms:
- the machine name is, for example, machine7.domain.com
- in a machine, you can have one or several erlang nodes running, each one with a different name, for example: ejabberd@machine7.domain.com, ejabberd4@machine7.domain.com
- then, in each erlang node (that is running a different ejabberd, installed in a different path, with different configuration file), you can serve several XMPP domains, for example aus.domain.com, anon.domain.com

1. In this sense, in join_cluster you must provide the erlang node name, in my example ejabberd@machine7.domain.com
2. Depending on what you want to do. Probably yes.
3. Sorry, no idea
4. join_cluster will tel mnesia of one node to sync with the other node, and it will do automatically when any of those databases change.
5. yes
6. Depends. You can even configure as hosts in ejabberd.yml "example.com", and then set DNS x.domain.com and y.domain.com, and tell your client to login to "example.com" with host "x.domain.com" and port "5222".

Sorry I can't help you more with DNS setup, better search tutorials over Internet about ejabberd (or other Jabber servers) domain setup.

Thank you for the reply! So

Thank you for the reply! So in order to cluster, the nodes need to be on the same machine? I was thinking of having them run on separate machines (in case of hardware failure for instance). How would that differ?

Also, how would I achieve the name in front of the @ (ejabberd@machine.domain.com, ejabberd4@machine.domain.com)?

The erlang nodes can be in

The erlang nodes can be in different machines, like ejabberd4@machine.domain.com and ejabberd5@machine2.domain.com. It's preferable if they are in a reliable network, not broad internet, but any way will work.

Regarding the exact node name, you can set it in the file ejabberdctl.cfg. Remember to do that before starting ejabberd the first time, otherwise you have to delete the Mnesia database, or convert it to the new node name.

Yeah, I intended on using

Yeah, I intended on using them on VPSs so they would have a reliable network! And that makes sense, thank you!

Oh,one more question, would

Oh,one more question, would the two servers need to use the same certificate/dhparam files?

I assume yes. Let's think:

I assume yes. Let's think: the XMPP client will connect to one of the nodes (or the other), so whatever it connects, it must be correctly configured: accept its username+password (you accomplish that by mnesia database replication), same features (you accomplish that by having the same modules configuration in each nodes), and I satisfactory encryption (which probably means the same certificates and cert config).

Perfect, thank you badlop!

Perfect, thank you badlop!

Syndicate content