Ejabberd runtime configuration

Aus Free Software
Wechseln zu: Navigation, Suche

You can change lots of the configuration at runtime either via the webinterface or by attaching to the ejabberd node. You can do the latter by running "ejabberdctl debug", where you can run any of the following commands:

Check Syntax of file 
fast_yaml:decode_from_file(<<"/etc/ejabberd/ejabberd.yml">>, [plain_as_atom]).
Reload config-file 
ejabberd_config:load_file("/etc/ejabberd/ejabberd.cfg").
Note that this only updates ACL and Shapers. Listening ports, virtual hosts, modules and all major options will not change.
Add codepath 
code:add_patha("/usr/lib/erlang/lib/xmlrpc-1.13/").
Set loglevel 
ejabberd_logger:set(4).

Note: A loglevel of 5 sometimes causes additional debug messages on stdout (which breaks munin plugins).
Get loglevel 
ejabberd_logger:get().
Reload module 
l(mod_version).
Where mod_version is the module you want to reload.
Recompile module 
c(mod_version).
Where mod_version is the module you want to compile. You will still have to reload the module.
'top' for erlang processes 
/usr/lib/erlang/lib/observer-1.1/priv/bin/etop -node ejabberd@titan -sort reductions

Memory debugging

application:start(os_mon).
{_, _, {Pid, Size}} = memsup:get_memory_data().
application:stop(os_mon).
erlang:process_info(Pid).

Manually invoke garbage collector:

lists:foreach(fun erlang:garbage_collect/1, processes()).

Show how much memory is used by Erlang VM and processes:

erlang:memory().

Show finer grained allocation of Erlang VM memory usage:

erlang:system_info(allocated_areas).

Scripting

To execute e.g. mnesia:info():

#!/usr/bin/env escript
%%! -sname admin@titan

main(_Args) ->
    Node = 'ejabberd@titan',
    Module = mnesia,
    Function = info,
    Arguments = [],

    rpc:call(Node, Module, Function, Arguments).

epmd

List currently registered nodes 
epmd -names

ejabberdctl -> nodedown

ejabberdctl's connection to ejabberd is quite fragile. If ejabberdctl can't connect, it will say

root@host: ~ $ ejabberdctl status
Failed RPC connection to the node ejabberd@host: nodedown

A few things to check for:

  • The host name configured by ERLANG_NODE must be resolveable. For example, ejabberd@somehost means that somehost should be set in /etc/hosts.
  • When you set e.g. INET_DIST_INTERFACE=127.0.0.1, make sure that the hostname from ERLANG_NODE resolves to exactly that address. we hat 127.0.1.1 titan (note the "1" i the third octet) and had to change it to 127.0.0.1.


See also