how does Ejabberd manage databases for clustering? [closed]
Asked Answered
T

2

6

Does it replicate all the data to every node or does it store data fragments on each node and then fetches every needed fragment from different node at runtime? Or how does this work?

Does clustering still work correctly if, instead of Mnesia, you use MySQL?

Talavera answered 28/3, 2013 at 1:53 Comment(0)
V
7

By default everything goes to mnesia and most of stuff is replicated. Also you can choose if mnesia tables go to disc or memory. Basically, you can re-configure mnesia table location as you wish, but usually tables are replicated in memory, to keep them close.

It is also true that clustering ejabberd is done via spanning nodes over mnesia cluster, so probably it is not worth an effort to get rid of that.

Most of mods (which implement xeps) use mnesia however they have mysql equivalents. It is even wider - they have SQL equivalents which are suffixed with "_odbc". Example: mod_roster and mod_roster_odbc.

To sum up, you can end up with light weight mnesia to handle configs and some in-memory stuff and use central mysql for heavy stuff. Location of mysql is configurable in ejabberd config.

Vernalize answered 28/3, 2013 at 16:47 Comment(2)
I aim to create the simplest setup possible that will grow easily to any needed size(10M * n actives..) by adding more nodes. 3 things come to mind. (A). With mnesia table size limit Local Content Tables rather than replication sounds like a better option at first glance with an mnesia only setup. (B). Not externalizing anything to MySQL and relying solemnly on an mnesia setup would be the siplest setup. (C). Would a centralized MySQL DB required for a very large deployment or can mnesia cut it?Talavera
Majority of eJabberd deployments I met has mixed setup and they do use centralized mysql (it is easy to replicate, easy to access by another layers of the system). What you mean by mnesia table size limit? In memory tables have no limit and in most cases you need in-memory location for performance reasons.Vernalize
R
3

Mnesia can support clustering rather easily, but it does require some tinkering in an interactive erl session. As far as the exact mechanism, it's all handled by erlang and mnesia's built in clustering, and it's beyond my expertise. You can tell it to store copies (replicas) on each node, but it is a fine-grained control that needs to be tuned for your needs, as this document's first comment suggests. I can't find any information on how fragmentation works, unfortunately, though I suspect mnesia will cache (in memory or on disc, depending on configuration) any structures it retrieves from another node.

You might take a look at this, as it explains there's caveats for SQL - namely that using it will not eliminate the use of Mnesia in ejabberd. It seems a shared mysql host would be one option, or using a master-slave replication configuration within mysql's clustering capabilities would also probably work since a shared SQL server works.

Rotberg answered 28/3, 2013 at 14:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.