How to restart the RabbitMQ service on Linux and Windows
Codemia Knowledge Hub ·
On Linux with systemd, run sudo systemctl restart rabbitmq-server (or sudo service rabbitmq-server restart on SysV init). On Windows, use PowerShell's Restart-Service RabbitMQ, or stop and start the service.
When a restart is needed
- Configuration changes: edits to
rabbitmq.confoften need a restart to take effect. - Plugin management: adding or removing plugins may need a restart to initialize or clean up plugin state.
- Performance problems: memory leaks, high CPU usage, or an unresponsive service.
- Upgrades: after upgrading RabbitMQ or Erlang/OTP, a restart is generally required to run the new version.
Restart commands by operating system
Unix/Linux
Use systemctl or service, depending on your distribution:
- Using systemctl (systemd):
- Using service (SysV init):
Both stop the running broker and start it again, picking up new configuration and resetting its state.
Windows
Use the Services console or PowerShell:
- Command line:
Command reference
| Action | Command for Linux | Command for Windows | Purpose |
| Stop Service | sudo systemctl stop rabbitmq-server | Stop-Service RabbitMQ | Halts the RabbitMQ service. |
| Start Service | sudo systemctl start rabbitmq-server | Start-Service RabbitMQ | Initiates the RabbitMQ service. |
| Restart Service | sudo systemctl restart rabbitmq-server | Restart-Service RabbitMQ | Restarts the service, applying changes. |
Restarting without losing messages
- Notify users: announce the maintenance window so nobody is surprised.
- Back up configuration: save
rabbitmq.confand any custom definitions before changing them. - Drain queues: if possible, let queues drain and pause publishing to reduce message loss.
- Monitor afterwards: watch logs and metrics to confirm the broker is healthy.
Checking logs and restarting a cluster
Logs: after a restart, check the logs in /var/log/rabbitmq/ on Linux or %APPDATA%\RabbitMQ\log on Windows for startup errors.
Clusters: restart nodes one at a time to keep the service available and avoid cluster partitions.
Related reading
- How to retract a message in RabbitMQ?
- How to route a chain of tasks to a specific queue in celery?
- How to run a Kafka connect worker in YARN?
- How to run following command to test kafka server is installed properly or not?
- How to restore original client IP from Cloudflare with NGINX ingress controller
- How to retrieve a secret in terraform from aws secret manager
- How to rethrow InnerException without losing stack trace in C?
- How to retrieve actual item from HashSetT?
System design interview problems on this topic
- Design a Distributed Messaging System: solution and walkthrough
- Design a Log Collection and Analysis System: solution and walkthrough
- Design an Ad Click Aggregation System: solution and walkthrough
- Design a Webhook Notification Service: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.