How to check Mnesia database of ejabberd
Asked Answered
L

2

6

I want to access Mnesia database of ejabberd server, But i don't know how to read,write and update the data, Is there a way by which i can do this. Can i change Database to MySQL rather than Mnesia. I have tried this

{odbc_server, {mysql, "localhost", "xmpp_db", "root", "**********"}}. 

Here "xmpp_db" is the name of my database which is created for ejabberd, But i does not see any change in xmpp_db. Should i create any tables in "xmpp_db", But problem is what are the names of my tables and fields. I also have used

ejabberdctl dump /tmp/ejabberd.db.txt 

command, But this is just for read the data(the data is in very roughly format and hard to understand). Is there any way by which i can perform read, write and update operations on Mnesia database.

your help will be appreciated.

Ludovick answered 8/4, 2015 at 13:10 Comment(0)
A
4

Is there any way by which i can perform read, write and update operations on Mnesia database?

General Info:

Using ejabberdctl you can get a list of Mnesia general information, tables, records count, directory of its file and etc.

$ ejabberdctl mnesia [info]

Data Manipulation:

One way for reading Mnesia records is by attach to ejabberd console and call mnesia:dirty_read/2 function with desired arguments.

$ ejabberdctl debug
1> mnesia:dirty_read(passwd, {<<"username">>, <<"host">>}).
[{passwd,{<<"username">>,<<"host">>}, <<"password">>}]

Also for updating (or writing) Mnesia records you can call mnesia:dirty_write/2 function the same way.

$ ejabberdctl debug
1> mnesia:dirty_write({passwd, {<<"user">>, <<"host">>, <<"new-pass">>}).
ok

For learning other Mnesia's API check its official manual.

Acescent answered 8/1, 2016 at 22:1 Comment(0)
S
2

You can use MySQL indeed. As described in documentation, you need to configure MySQL connection and decide which module will use it.

You can read doc here: http://docs.ejabberd.im/admin/guide/configuration/#database-and-ldap-configuration

And them you need to configure back-end / method for relevant module. For example, for authentification, you need to set auth_method to odbc:

auth_method: odbc

Studied answered 14/4, 2015 at 18:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.