Cluster Node Replication

Hi all,

I'm new here and I have a question I could use some advice on...

I've setup two ejabberd nodes and I'd like to get them talking to each other but it doesn't seem to be happening. I've followed the documentation pretty closely except I didn't use a user named ejabberd to run the service under but rather a different user name. The user is the same on both systems and has the same erlang cookie in its home directory. If I query elang I see that both nodes are using the same cookie.

The point I guess I am most unclear about is when I connect to a local erlang should I be connecting to a username or an erlang service/environment name? When the docs say ejabberd@node is it talking about a user or the service? Or does the user and service name have to match for things to work?

I can get the two nodes to connect but I only see a schema table in mnesia, no ejabberd related tables seem to appear. I connect as both username@node1 and ejabberd@node1 and both can replicate a database that contains only schema. I think I'm close but I'm not not connecting to the right erlang environment/context.

Of course as soon as I post...

Of course as soon as I post I semi-answer my own question. I guess my problem is my ejabberd installation is called 'default'. When I try to connect as default I get the following:

node1$ ./ejabberdctl default status
Node 'default@node1' is started. Status: started

node1$ ./erl -sname default -mnesia extra_db_nodes "['default@node2']" -s mnesia
{error_logger,{{2005,11,1},{10,3,55}},'Protocol: ~p: register error: ~p~n',[inet_tcp,{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1}, {net_kernel,start_protos,4},{net_kernel,start_protos,3},{net_kernel,init_node,2}, {net_kernel,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}]}
{error_logger,{{2005,11,1},{10,3,55}},crash_report,[[{pid,<0.19.0>}, {registered_name,net_kernel},{error_info,{error,badarg}},{initial_call,{gen,init_it,...
{error_logger,{{2005,11,1},{10,3,55}},supervisor_report,[{supervisor,{local,net_sup}}, {errorContext,start_error},{reason,{'EXIT',nodistribution}}, {offender,[{pid,undefined},{name,net_kernel},...
{error_logger,{{2005,11,1},{10,3,55}},supervisor_report,[{supervisor,{local,kernel_sup}}, {errorContext,start_error},{reason,shutdown},{offender, [{pid,undefined},{name,net_sup},{mfa,{erl_distribution,start_link,[]}},...
{error_logger,{{2005,11,1},{10,3,55}},crash_report,[[{pid,<0.7.0>},...
{error_logger,{{2005,11,1},{10,3,55}},std_info,[{application,kernel},{exited,{shutdown, {kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,shutdown}

Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller) (shutdown)

OK different questions now

I discovered I had misnamed one of my nodes. calling it deafault instead of default. Which was why I was having so much trouble.

Now I'm approaching having the two nodes replciate their data. Here's what I have so far.

I've setup default@node1. It works fine. I run the following on node2

erl -sname default -mnesia extra_db_nodes "['default@node1']" -s mnesia

While this is running I can see default@node2 connected on the node status of node1. I can change the db settings and see stuff apparently replicating between the two. It looks happy so I close out the erl sesion on node2 with q(). and start node2 with the start script.

Now node2 is up and on its node status page I just see default@node2. On node1 I see default@node1 running and default@node2 as down.

How can I get the connection to be persistent on node2?

mnesia dir paramater

Do you still have the "-mnesia dir \"spool\"" paramater in your startup script ? If so, try removing it or change to the new directory, wich will be mnesia.ejabberd@node2

My start script runs

My start script runs ejabberdctl default start which does this:

exec $BINDIR/erl -noinput -sname ejabberdctl@node1 -mnesia dir "\"${EJABBERD_DB}\"" -s ejabberd_ctl -extra $@

$ROOTDIR/database/$1 maps to:

/opt/ejabberd-0.9.8/database/default

Which my user that I'm running as owns. That directory also contains all the table data files for ejabberd.

I guess I'm still not clear on the whole mnesia thing. Is mnesia the database engine overall or is it what replicates the data? Should I have a seperate mnesia.default directory?

OK I'm a little slow but I

OK I'm a little slow but I get it now. I point my second node at the created mnesia db and it works. This is awesome. I'll still need to clean this config up and package it to be deployed to my production hosts but at least it works and I finally get it.

Thanks!

Syndicate content