0

On windows, when I am using rabbitmq-server start/stop commands, data over the RabbitMQ durable queues are deleted. It seems queues are re-created when I start the RabbitMQ server.

If I use rabbitmqctl stop_app/start_app, I am not losing any data. Why?

What will happen if my server goes down and how can I be sure I that I won't lose data if it does?

melihcoskun
  • 326
  • 1
  • 4
  • 19

2 Answers2

1

configuration issue: I was starting rabbitmq from rabbitmq sbin directory. I re-installed the rabbitmq and added rabbitmq to windows services. Now data lost problem was solved on my computer. When I start/stop the windows service , rabbitmq is not losing any data

melihcoskun
  • 326
  • 1
  • 4
  • 19
0

Making queues durable is not enough. Probably you'll need also to declare exchange as durable as well as send 'persistent' messages.

In Java you'll use:

channel.basicPublish("", "sample_queue",
        MessageProperties.PERSISTENT_TEXT_PLAIN, // note that this parameter is not null!
        message.getBytes())
halfer
  • 19,824
  • 17
  • 99
  • 186
Mark Bramnik
  • 39,963
  • 4
  • 57
  • 97
  • I am also persisting messages. when I use rabbitmqctl start/stop , I am not loosing any 'persistent messages'. I am using deliveryMode=2 when publishing messages. – melihcoskun Dec 28 '16 at 12:02
  • I know that start_app/stop_app will only restart rabbit mq itself. All the persistent stuff is stored in database called mnesia. Its just runs on top of erlang vm just like rabbit. On linux you can type ps -ef | grep rabbit and you'll see that there are many processes. So rabbitmq-server stop will stop everything including mnesia. Thats the difference between two commands. – Mark Bramnik Dec 28 '16 at 13:48
  • thanks. Stopping Mnesia shouldnt be a problem. Because I am starting rabbitmq again.Mnesia is a db and databases can not loose any data when you restart them. I am not using any clustering just single rabbitmq instance so i am assuming that single mnesia single rabbitmq cluster is working on my system. – melihcoskun Dec 28 '16 at 14:08