0
votes

I am running into an issue that appears to be un-resolvable. I have a need to pass in the function mnesia:change_table_copy_type(schema, node(), disc_copies). at the command line whe the db is created from the master node. the erl start is: erl -name NODE1 -mnesia extra_db_nodes \"['MASTER']\" -s mnesia When I start the shell then enter the function call everything works fine and I can then stop the shell and start the ejabber process normally. So what I need is a scripted method to get the DB setup and sync done.

I have tried many different methods to get the change_table_copy_type passed in with no success. the end goal is to be able to script the process of starting mnesia, pass in the function, and then quit out of the shell. Has anyone even tried this? I have tried redirects such as: erl -name NODE1 -mnesia extra_db_nodes \"['MASTER']\" -s mnesia <

This fails as the node is not started when the function call is passed in. I have tried using the "-run" option but get and error telling me the function is undef. Maybe I am not constructing the -run section correctly.

2

2 Answers

1
votes

Try the -eval argument for erl:

erl -name NODE1 -mnesia extra_db_nodes "['MASTER']" -eval 'mnesia:start(), mnesia:change_table_copy_type(schema, node(), disc_copies), init:stop()'

That might need an mnesia:wait_for_tables in there somewhere to ensure that it has time to join the cluster before doing the change_table_copy_type.

0
votes

Since ejabberd 15.05, ejabberd comes with a new command to ease cluster deployment and setup: ejabberdctl join_cluster

The command is documented in ejabberd documentation: ejabberd clustering.

This should help you make sure the cluster is properly configured with the standard way to launch ejabberd.