[ejabberd] Amazon Cluster on Amazon EC2

prasadk14 prasadk14 at gmail.com
Wed Nov 23 15:52:40 MSK 2011


Hello all,

I also have the same problem but couldn't solve yet.

This is what I have done.

1. I have two ec2 servers running independently with 'hostname -s'. I could
not run the servers with full hostname by just setting
ERLANG_NODE=ejabberd@`hostname -f` in ejabberdctl.cfg. (Should I change
anything else to make it work with full name?)

So, I have set ERLANG_NODE=ejabberd@`hostname -s` and they are running fine
without any problem. 
And I see both servers can connect to each other with just shortname (I
tried telnet-ing the other server on port 5268 and it worked fine. So,
assuming that they are able to connect to one another with just short
hostname).

I have also set FIREWALL_WINDOW=4000-4010 in /etc/default/ejabberd (I did
n't add it in /etc/ejabberd/ejabberd.cfg as mentioned in the previous
comment) and enabled these ports from ec2  security group.

I have started the servers on both the nodes by executing the command 
 sudo /etc/init.d/ejabberd start

2. Both nodes have same /etc/ejabberd/ejabberd.cfg - configured to serve the
same domain and use the same MySQL DB server. 

I executed this on both the nodes to check if they have same erlang cookie.   
    
    sudo ejabberdctl debug
    erlang:get_cookie().

(As these instances are created from the same AMI, I didn't need to manually
copy the cookie from one node to the other)


3. I stopped the ejabberd server on Node 2 by executing the command 
   sudo ejabberdctl stop

4. Executed the clustering command 
   ubuntu at domU-22-22-22-22-BB-22:~$  erl -sname
ejabberd at domU-22-22-22-22-BB-22 -mnesia extra_db_nodes
"['domU-11-11-11-11-11-11']" -s mnesia
 
and entered the command mnesia:info(). The output is 

Erlang R13B03 (erts-5.7.4) [source] [64-bit] [rq:1] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
(ejabberd at domU-22-22-22-22-BB-22)1> mnesia:info().
---> Processes holding locks <---
---> Processes waiting for locks <---
---> Participant transactions <---
---> Coordinator transactions <---
---> Uncertain transactions <---
---> Active tables <---
schema         : with 1        records occupying 392      words of mem
===> System info in version "4.4.12", debug level = none <===
opt_disc. Directory "/home/ubuntu/Mnesia.ejabberd at domU-22-22-22-22-BB-22" is
NOT used.
use fallback at restart = false
running db nodes   = ['ejabberd at domU-22-22-22-22-BB-22']
stopped db nodes   = ['ejabberd at domU-11-11-11-11-11-11']
master node tables = []
remote             = []
ram_copies         = [schema]
disc_copies        = []
disc_only_copies   = []
[{'ejabberd at domU-22-22-22-22-BB-22',ram_copies}] = [schema]
2 transactions committed, 0 aborted, 0 restarted, 0 logged to disc
0 held locks, 0 in queue; 0 local transactions, 0 remote
0 transactions waits for other nodes: []
ok

.
.
.

The only thing I have not done as per this thread is changing `hostname -s`
to `hostname -f`.


Can somebody throw some pointers to debug what the issue could be or point
anything I am missing. 

Thanks a ton in advance.

- Prasad.




Sylvain Niles-2 wrote:
> 
> Sorry just went and checked my config, instead of starting an erlang
> shell on node 1, edit your ejabberd.cfg on both nodes and add:
> 
> FIREWALL_WINDOW=4000-4010
> 
> then restart ejabberd on node 1
> 
> then do your erl/extra_mnesia_nodes, etc to join the cluster on node 2.
> 
> -Sylvain
> 
> 
> 
> On Thu, Jun 23, 2011 at 2:08 PM, Isaac P. T da Silva <isaacsou at gmail.com>
> wrote:
>> Daniel -
>>
>> Thank you for looking into this problem.
>>
>> Node 1 is ejabberd at ip-10-244-139-223.ec2.internal.
>>
>> Node 2 is ejabberd at ip-10-38-22-127.ec2.internal.
>>
>> Any help/insights on that matter would be great!
>>
>> Thanks
>>
>> On Thu, Jun 23, 2011 at 4:33 PM, Daniel Dormont
>> <dan at greywallsoftware.com>
>> wrote:
>>>
>>> I'm about to do something similar, but haven't actually done it yet, so
>>> this is just a guess. However, if I'm not mistaken, an Erlang node can
>>> only
>>> be running with a short or long name, at a time, and a short name node
>>> can
>>> only talk to another short name node, and vice versa. On Node 1, is your
>>> node name ejabberd at ip-10-244-139-223 (short name) or is it
>>> ejabberd at ip-10-244-139-223.ec2.internal (long name)?
>>>
>>> dan
>>>
>>> On Jun 23, 2011, at 3:07 PM, Isaac P. T da Silva wrote:
>>>
>>> > I'm having a problem setting up 2 Ejabberd nodes on Amazon EC2.
>>> >
>>> > I looked everywhere and in the past threads and was unable to find any
>>> > answer. Any directions/advice would be greatly appreciated!
>>> >
>>> > Bellow is a detailed description of the problem:
>>> >
>>> > 1 -  I have two images of CentOS 5.4, running
>>> > Ejabberd-2.1.6-1.el5.x86_64
>>> >
>>> > 2 -  Ejabberd.cfg is the same in both nodes and configured to serve
>>> the
>>> > same domain.
>>> >
>>> > 3 - I set ERLANG_NODE=ejabberd@`hostname -f` in ejabberdctl.cfg of
>>> both
>>> > machines.
>>> >
>>> > Node number 1 - it is called
>>>  'ejabberd at ip-10-244-139-223.ec2.internal'.
>>> > Its private IP is 10.244.139.223.
>>> >
>>> > Node number 2  - it is called
>>>  'ejabberd at ip-10-38-22-127.ec2.internal'.
>>> > Its private IP is 10.38.22.127.
>>> >
>>> > 4 - I also edited /etc/hosts on each machines, so I can successfully
>>> > ping each of the machines from inside each of them:
>>> >
>>> > Node number 1 (etc/hosts):
>>> > 127.0.0.1   localhost   localhost.localdomain
>>> > 10.38.22.127 ip-10-38-22-127.ec2.internal ip-10-38-22-127
>>> >
>>> > Node Number 2 (etc/hosts):
>>> > 127.0.0.1   localhost   localhost.localdomain
>>> > 10.244.139.223 ip-10-244-139-223.ec2.internal ip-10-244-139-223
>>> >
>>> > 5 - I get the .erlang.cookie on Node number 1:
>>> >
>>> > sudo ejabberdctl debug
>>> > erlang:get_cookie().
>>> >
>>> > On Node 2:
>>> >
>>> > 6 - I copied .erlang.cookie from Node number 1 to .erlang.cookie on
>>> Node
>>> > 2
>>> >
>>> > 7  - Executed:
>>> >
>>> > erl -sname ejabberd at ip-10-38-22-127 -mnesia dir '"/var/lib/ejabberd"'
>>> > -mnesia extra_db_nodes "['ejabberd at ip-10-244-139-223']" -s mnesia
>>> >
>>> > 8 - Made sure the cookie on Node 2 is the same on Node 1:
>>> > erlang:get_cookie().
>>> >
>>> > 9 - Typed mnesia:info().
>>> >
>>> > It always returns:
>>> >
>>> > running db nodes   = ['ejabberd at ip-10-38-22-127']
>>> > stopped db nodes   = ['ejabberd at ip-10-244-139-223']
>>> >
>>> > I have port 4369 opened on Amazon Security Group.
>>> >
>>> > I feel I'm missing something. Maybe my DNS configuration? I don't know
>>> > if it matters, but on my DNS server (I'm using Godaddy)  I created two
>>> A
>>> > records (@), each pointing to the  Elastic IP Address of both Amazon
>>> > instances.
>>> >
>>> > Any help/direction would be greatly appreciated!
>>> >
>>> > _______________________________________________
>>> > ejabberd mailing list
>>> > ejabberd at jabber.ru
>>> > http://lists.jabber.ru/mailman/listinfo/ejabberd
>>>
>>> _______________________________________________
>>> ejabberd mailing list
>>> ejabberd at jabber.ru
>>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ejabberd mailing list
>> ejabberd at jabber.ru
>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>
>>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
> 
> 

-- 
View this message in context: http://old.nabble.com/Amazon-Cluster-on-Amazon-EC2-tp31914034p32873740.html
Sent from the ejabberd mailing list archive at Nabble.com.



More information about the ejabberd mailing list