Search code examples
erlangxmppcluster-computingejabberdmongoose-im

mongooseim cluster setup eacces error on ubuntu 14.04


We are trying to create master-master cluster of two mongooseim instances on AWS in same virtual network.. All necessary ports are opened in AWS security group.

I suspect some issue with mongooseim setup on Ubuntu 14.04 LTS

After running join_cluster command on one of the node we get error as follows ( refer screenshot ) Error: {error,{badmatch,{error,eacces}}}

Attached screenshot with details. Server configuration was not changed except vm args as shown in attached screenshot.

is this an issue with your binary ? or some other glitch ?

enter image description hereenter image description here


Solution

  • I ran into this issue myself. Mongoose uses erlangs internal mnesia storage system for a lot of information including cluster topology. The default path for mnesia's storage is /var/lib/mongooseim. When you do a mongooseimctl join_cluster ... it needs to wipe it's mnesia store and basically pulls a copy from the cluster it's joining. The issue arises because it also tries to delete /var/lib/mongooseim itself, which it won't have permissions to do because the running user mongooseim won't have permissions of the parent directory, /var/lib. Nor should it.

    The way I fixed this was by creating a subdirectory which it could safely delete and recreate and configuring it to use that as it's mnesia directory:

    sudo mkdir /var/lib/mongooseim/mnesia
    sudo chown mongooseim:mongooseim /var/lib/mongooseim/mnesia
    

    Configuration for the mnesia directory exists by default in /etc/mongooseim/app.config. In mine it was the third line. Originally looked like this:

    {mnesia, [{dir, "/var/lib/mongooseim"}]},
    

    I changed the path to the new directory I created

    {mnesia, [{dir, "/var/lib/mongooseim/mnesia"}]},
    

    After that, I stopped and started mongoose and was successfully able to join the cluster

    mongooseimctl stop
    mongooseimctl start && mongooseimctl started
    mongooseimctl join_cluster [email protected]