Rabbitmq source code analysis 1. Startup Process

Source: Internet
Author: User

Rabbitmq is started based on boot steps. Each step of boot steps may start a component or print a startup information. Boot steps is a directed acyclic graph that ensures the sequence of startup.

One boot step:

-Rabbit_boot_step ({recovery,
[{Description, "Exchange, queue and binding recovery "},
{MFA, {rabbit, recover, []},
{Requires, empty_db_check },
{Enables, routing_ready}]}).

Name is recovery,

MFA is used to start module, function, arguments,

Requires is the boot step that must be started before it

Enables is the boot step that can be started later.


Let's take a look at the entire startup process:

Rabbitmq only has one application. It can be seen from rabbit_app.in that the rabbit startup entry is the start/0 of Rabbit. ERL,

Start/0, mainly doing the following:

1. Load the rabbit application from rabbit_app.in and save it to the ETS table named "ac_tab ".

2. Where to call setup log, tty or file

3. Confirm the mnesia storage directory

4. Read and Write the nodes_running_at_shutdown and cluster_nodes.config files.

5. check whether all node networks are connected, whether all node OTP versions are the same, and whether all node rabbitmq versions are compatible.

6. Load OS _mon and mnesia applications

7. Start OS _mon, mnesia, and rabbit in the dependency order.


The entry to the true startup of rabbit is start/2, which mainly involves the following:

1. Check Erlang version

2. Start rabbit_sup without starting any child

3. register the rabbit Process

4. Construct a boot steps directed acyclic graph and start boot steps in order

Here is a complete directed acyclic graph:

Next we will analyze the boot step one by one.

Rabbitmq source code analysis 1. Startup Process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.