Tables and DB using clustering

Hello,
I have set up a cluster in ejabberd, but I have some doubts about some issues:

1-When you get the tables from the main node with add_table_copy, where are these tables being created?

2-At some point, I tried to change one node. The configuration was simple: MainNode, SecondNode1.
The problem came when I tried to replace SecondNode1 for SecondNode2. After starting the erlang console with
erl -sname ejabberd \
-mnesia dir '"/var/lib/ejabberd/"' \
-mnesia extra_db_nodes "['ejabberd@SecondNode2']" \
-s mnesia
-setcookie myCookie

I received an error complaining because SecondNode1 was not there (sorry, I don't remember exactly the error, but it was something like that), and that wasn't solved until I made a backup of MainNode's DB and put a new one to work. Is this due to change_table_copy_type? If so, is there any way to revert the operation?
I thought of just changing the SecondNode1's name to SecondNode2 before setting SecondNode2 as a new element of the cluster, so that maybe it would leave all the references in the DB ready for a new node called SecondNode2, but I don't know if in this case checks are performed using node's names or using some hash, like the erlang cookie.

3-And finally, what's the difference between the .erlang.cookie file stored in /var/lib/ejabberd and the one stored in the ejabberd directory? Do they serve for the same purpose?

Syndicate content