Machine 1:
1. Install ejabberd as a cluster node on machine 1 (Node name: ejabberd@PrasadK)
2. Configure it to use mysql database based on the installation guide.
3. Started the server using windows services. (You can alternatively start it from command line using $ejabberd-installation/bin/ejabberdctl start)
Machine 2:
1. Install ejabberd as a cluster node on machine 2 (Nodename: ejabberd@riktam-acb56375)
2. Configure it to use mysql database (the same server which the first machine's ejabberd server is connected to)
3. Copy the .erlang.cookie file (which resides in C:/Windows folder if it's started as a service or $USER_HOME folder if it's started via command line) from the machine 1 to the machine 2's home folder. (I copied it in two places - in bin folder where erl command is executed and the user's home folder. Need to confirm which of them is used)
4. Execute the command from $ejabberd-installation/bin/ directory
5. Executing the above command should enter into erlang shell which looks like:D:\ejabberd\bin>erl -sname ejabberd@riktam-acb56375 -mnesia extra_db_nodes "['ejabberd@PrasadK']" -s mnesia
Eshell V5.6.4 (abort with ^G)(ejabberd@riktam-acb56375)1>
a) execute mnesia:info(). to check if the two nodes are shown in running_nodes. If not check your ejabberd.log file:
(ejabberd@riktam-acb56375)1>mnesia:info().---> Processes holding locks <------> Processes waiting for locks <------> Participant transactions <------> Coordinator transactions <------> Uncertain transactions <------> Active tables <---schema : with 29 records occupying 3580 words of mem===> System info in version "4.4.5", debug level = none <===opt_disc. Directory "d:/ejabberd/bin/Mnesia.ejabberd@riktam-acb56375" is NOT used.use fallback at restart = falserunning db nodes = [ejabberd@PrasadK,'ejabberd@riktam-acb56375']stopped db nodes = []master node tables = []remote = [acl,caps_features,captcha,config,http_bind,iq_response,irc_custom,local_config,mod_register_ip,motd,motd_users,muc_online_room,muc_registered,muc_room,passwd,pubsub_index,pubsub_item,pubsub_last_item,pubsub_state,pubsub_subscription,reg_users_counter,route,s2s,session,session_counter,sql_pool,sr_group,sr_user]ram_copies = [schema]disc_copies = []disc_only_copies = [][] = [sql_pool,local_config,caps_features,mod_register_ip][{ejabberd@PrasadK,disc_copies}] = [config,pubsub_subscription,passwd,irc_custom,sr_user,motd,acl,pubsub_index,sr_group,motd_users,muc_room,pubsub_state,muc_registered][{ejabberd@PrasadK,disc_copies},{'ejabberd@riktam-acb56375',ram_copies}] = [schema][{ejabberd@PrasadK,disc_only_copies}] = [pubsub_item][{ejabberd@PrasadK,ram_copies}] = [http_bind,reg_users_counter,pubsub_last_item,route,s2s,captcha,session_counter,session,iq_response,muc_online_room]3 transactions committed, 0 aborted, 0 restarted, 0 logged to disc0 held locks, 0 in queue; 0 local transactions, 0 remote0 transactions waits for other nodes: []okb) Now run the following in the same `erl' session:(ejabberd@riktam-acb56375)2> mnesia:change_table_copy_type(schema, node(), disc_copies).c) Now you can add replicas of various tables to this node with `mnesia:add_table_copy'or `mnesia:change_table_copy_type' as above (just replace `schema' with another tablename and `disc_copies' can be replaced with `ram_copies' or `disc_only_copies').d) Run `init:stop().' or just `q().' to exit from the Erlang shell. This probably can takesome time if Mnesia has not yet transfered and processed all data it needed from first.
6) Replace the newly created Db folder with the actual DB folder in (D:\ejabberd\database)
7) Change http_bind storage type to RAM and disc copy from Remote copy (Need to check whether it can be done in step 5.c. itself)
References: