[ejabberd] How to change mnesia table type by command line ?

Manuel DE FERRAN mdeferran at ubikod.com
Thu Dec 2 10:49:48 MSK 2010


On Wed, Dec 1, 2010 at 7:28 PM, Badlop <badlop at gmail.com> wrote:

> 2010/12/1 Manuel DE FERRAN <mdeferran at ubikod.com>:
> > I'm trying to change disc_copies mnesia tables to ram_copies. But I'd
> like
> > to do it with a script.
>
> If I understood correctly, you want to do something like:
> ejabberdctl mnesia_change_tabletype bytestream disc_only_copies
>
> You can apply this patch to ejabberd 2.1.x (or to 2.1.5, or manually
> to mod_admin_extra):
>
>
Great, thanks.

I kept digging and I tried the following erlang lines :

 -module(mychangetabletype).
-export([setLocalRamCopies/0]).
setLocalRamCopies() ->
  mnesia:start(),
  mnesia:change_table_copy_type(acl, node(), ram_copies),
  mnesia:change_table_copy_type(config, node(), ram_copies),
  mnesia:change_table_copy_type(local_config, node(), ram_copies),
  mnesia:change_table_copy_type(passwd, node(), ram_copies).

erlc mychangetabletype.erl

It works as expected on ejabberdctl debug, but it does not work when called
with :
/etc/init.d/ejabberd stop
erl  -pa '/tmp' -home /var/lib/ejabberd -name ejabberd at node01 -setcookie
mycookie  -mnesia dir "'/var/lib/ejabberd'" -run mychangetabletype
setLocalRamCopies

I tried also without mnesia:start() in the script and adding -s mnesia to
the command line.

Looks like mnesia is not initialized yet or smth like that.

I'm wondering why it does not work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20101202/043a856d/attachment-0001.html>


More information about the ejabberd mailing list