Search code examples
amazon-web-servicesserverrabbitmqqueuestorage

How to store rabbitmq RABBITMQ_MNESIA_DIR on remote disk


We have two ec2 servers. One has the rabbitmq on it. Second one is a new one for storage purposes. Both of these are Amazon Linux 2.

On the second one we just purchased /dev/nvme1n1 70G 104M 70G 1% /data Where we would love to push our rabbitmq queues and data. Basically we would like to RABBITMQ_MNESIA_DIR setup on the first rabbitmq server to be directly connecting and saving queues in /data remote mentioned.

Currently that is /var/lib/rabbitmq/mnesia and our config file for rabbitmq is just default /etc/rabbitmq/rabbitmq.conf

I wonder if somebody has been doing this before, or can point us in the right direction on how to set RABBITMQ_MNESIA_DIR to be directly connecting to remote ec2 and store and work with queues from there. Thank you


Solution

  • At the end of the day @Parsifal was right. We ended up making one instance bigger and changed RABBITMQ_MNESIA_DIR

    This was bit tricky, because after restarting service rabbitmq-server restart First off was needed to make sure we had current right to the /data/mnesia we mounted, I managed it with chmod 755 -R /data though read/write should be sufficient based on docs.

    Then we were looking for why it always produces the error like this "broker forced connection closure with reason 'shutdown'" & Error on AMQP connection so it was after the start.

    So I figured and checked the ownership of the current mnesia dir and the new one. And turned out the user and group was root root compared to original one. Switched it to drwxr-xr-x 4 rabbitmq rabbitmq 97 Dec 16 14:57 mnesia and this started working. Maybe it will save you some headaches, I didn't realize there was a different user group for rabbitmq, since I didn't create it.

    Only thing to add, is once you are shifting the current working mnesia you might consider copying the directory to the new one since there is a lot of stuff that was currently being used and ran from. I tried it without it and even the password to admin didn't work :D