Data/configuration lost after restart when using binaries for non privileged user in ubuntu

789 views
Skip to first unread message

Jaime

unread,
Feb 15, 2018, 11:30:15 AM2/15/18
to rabbitmq-users

Hi all,


I'm very new to rabbitmq, currently evaluating the tool and I'm having some weird issues. I currently have two different setups in linux ubuntu. In one set of machines I don't have root access so installed rabbitmq (3.6.15) in a folder by just untaring binaries. In the other set of machines I have root so I installed (3.6.14) with apt-get. Both sets involve two servers working as federation. So in total 4 machines.


I create some configuration for a couple of exchanges and queues. I can send messages and I see the messages moving in the federation. Everything is declared as durable and messages are persistent. So everything seems to be ok. I can rabbitmqctl stop_app and rabbitmq start_app without any problems in both sets. But if I try to do rabbitmqctl stop, all configuration and messages are lost in the machines where I installed just binaries. In the other setup (where I have sudo) I use sudo service rabbitmq-server start/stop to control the service and everything comes back after restart.


In both places I just execute what I think are equivalent commands... Only difference I see is maybe ports and ips... so in general they look like:


export RABBITMQ_CONFIG_FILE=${HOME}/rabbitmq_conf_15600
export RABBITMQ_SERVER_START_ARGS=-rabbitmq_management listener [{port,15672}]
export RABBITMQ_LOG_BASE=${HOME}/data/logs/rabbitmq
export RABBITMQ_NODENAME=rabbit
export RABBITMQ_MNESIA_BASE=${HOME}/data/rabbitmq/mnesia
export RABBITMQ_PLUGINS_EXPAND_DIR=${HOME}/data/plugins/rabbitmq
export RABBITMQ_HOME=${HOME}
export RABBITMQ_ENABLED_PLUGINS_FILE=${HOME}/data/plugins/rabbitmq/enabled_plugins
export RABBITMQ_PLUGINS_DIR=/somepath/rabbitmq/3.6.15/plugins

export RMQ_USER=some_user
export RMQ_PASS=somepass
export RMQ_UPSTREAM="someip"


cat ${HOME}/rabbitmq_conf_15600.config
[{rabbit, [
  {vm_memory_high_watermark, {absolute, "512MiB"}},
  {tcp_listeners, [15600]}
]}].


# Then starting the server with

rabbitmq-server -detached # where I cannot use sudo service
rabbitmq-plugins enable rabbitmq_management
wget "http://localhost:15600/cli/rabbitmqadmin"
chmod u+x rabbitmqadmin


# Configuring

rabbitmq-plugins enable rabbitmq_management
rabbitmq-plugins enable rabbitmq_federation
rabbitmq-plugins enable rabbitmq_federation_management

rabbitmqctl add_vhost /myvhost
rabbitmqctl add_user ${RMQ_USER} ${RMQ_PASS}
rabbitmqctl set_user_tags ${RMQ_USER} administrator
rabbitmqctl set_permissions -p /myvhost ${RMQ_USER} ".*" ".*" ".*"

./rabbitmqadmin -V /myvhost -u ${RMQ_USER} -p ${RMQ_PASS} declare exchange name=some.gateway type=fanout durable=true
./rabbitmqadmin -V /myvhost -u ${RMQ_USER} -p ${RMQ_PASS} declare queue name=some.announce durable=true
./rabbitmqadmin -V /myvhost -u ${RMQ_USER} -p ${RMQ_PASS} declare binding source=some.gateway destination=some.announce destination_type=queue

URI=amqp://${RMQ_USER}:${RMQ_PASS}@${RMQ_UPSTREAM}:15600/%2Fsome

rabbitmqctl set_parameter -p /myvhost federation-upstream some-upstream '{"uri":"'${URI}'"}'
rabbitmqctl set_policy -p /myvhost --apply-to exchanges federate-me "some.gateway" '{"federation-upstream-set":"all"}'

rabbitmqctl set_policy -p /myvhost DLX ".*" '{"dead-letter-exchange":"dlx"}' --apply-to queues
./rabbitmqadmin -V /myvhost -u ${RMQ_USER} -p ${RMQ_PASS} declare exchange name=dlx type=fanout durable=true
./rabbitmqadmin -V /myvhost -u ${RMQ_USER} -p ${RMQ_PASS} declare queue name=some.dlx durable=true
./rabbitmqadmin -V /myvhost -u ${RMQ_USER} -p ${RMQ_PASS} declare binding source=dlx destination=some.dlx destination_type=queue


I'm totally lost. Don't really understand why configuration and messages cannot survive a rabbitmqct stop in the machines where I installed binaries from tar.


After the rabbit restart I can see in logs

=INFO REPORT==== 15-Feb-2018::16:12:51 ===

Database directory at /myhome/data/rabbitmq/mnesia/rabbit is empty. Initialising from scratch...


Which I guess means nothing of the stuff I configured went to where rabbit is expecting to find stuff.


But while rabbit is running and even after it is stopped:


/myhome/data/rabbitmq/mnesia/rabbit$ ls
cluster_nodes.config  msg_store_transient          rabbit_durable_queue.DCD  rabbit_runtime_parameters.DCD  rabbit_user.DCL             rabbit_vhost.DCL
DECISION_TAB.LOG      nodes_running_at_shutdown    rabbit_durable_queue.DCL  rabbit_runtime_parameters.DCL  rabbit_user_permission.DCD  recovery.dets
LATEST.LOG            rabbit_durable_exchange.DCD  rabbit_durable_route.DCD  rabbit_serial                  rabbit_user_permission.DCL  schema.DAT
msg_store_persistent  rabbit_durable_exchange.DCL  rabbit_durable_route.DCL  rabbit_user.DCD                rabbit_vhost.DCD            schema_version


So the files clearly exists...


If I restart I have the files but almost everything gets a new timestamp. As if rabbit just decided to discard everything and start from scratch


There is no hostname, ip change in between restarts of rabbit.


Hope someone can give a hint


Thanks!


J.

Michael Klishin

unread,
Feb 15, 2018, 11:55:21 AM2/15/18
to rabbitm...@googlegroups.com
> Database directory at /myhome/data/rabbitmq/mnesia/rabbit is empty. Initialising from scratch

is the line that explains what's going on. RabbitMQ looks for its data directory at the above location
and either it does not exist or it is not readable.

You can override database location for a node:
http://www.rabbitmq.com/relocate.html.

Although with generic UNIX libraries it is under ./var in the installation directory and in most
cases that's not necessary. Several RabbitMQ team members use generic UNIX packages
without sudo daily, Homebrew on MacOS uses the same package without sudo and so on.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Jaime

unread,
Feb 15, 2018, 12:16:00 PM2/15/18
to rabbitmq-users
Hi Michael,

Thank you for your reply. I was trying to follow that page's instructions when I set:

export RABBITMQ_HOME=${HOME}
export RABBITMQ_MNESIA_BASE=${HOME}/data/rabbitmq/mnesia

Some files are created/modified in that location every time I start/stop the server. That is what I meant when I was listing the folder.


/myhome/data/rabbitmq/mnesia/rabbit$ ls

cluster_nodes.config  msg_store_transient          rabbit_durable_queue.DCD  rabbit_runtime_parameters.DCD  rabbit_user.DCL             rabbit_vhost.DCL
DECISION_TAB.LOG      nodes_running_at_shutdown    rabbit_durable_queue.DCL  rabbit_runtime_parameters.DCL  rabbit_user_permission.DCD  recovery.dets
LATEST.LOG            rabbit_durable_exchange.DCD  rabbit_durable_route.DCD  rabbit_serial                  rabbit_user_permission.DCL  schema.DAT
msg_store_persistent  rabbit_durable_exchange.DCL  rabbit_durable_route.DCL  rabbit_user.DCD                rabbit_vhost.DCD            schema_version


all files there have rw permissions for the user running rabbit. Most of them (all but schema.DAT and schema_version) get a new timestamp with server restart.

I'm assuming the executables are ok. It must be a problem with my configuration but I cannot point what is wrong.

Jaime.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Michael Klishin

unread,
Feb 15, 2018, 12:36:21 PM2/15/18
to rabbitm...@googlegroups.com
Have you considered not overriding those env variables and simply running
./sbin/rabbitmq-server which would create a data directory under ./var? Unless something might mess with ./var, you shouldn’t need to do anything.

Another thing that can affect default node location is host name, which is included
in one of the directory names. Should hostname change, you must override RABBITMQ_MNESIA_DIR and friends to point to an existing data directory.
Reply all
Reply to author
Forward
0 new messages