RocketMQ cluster mode architecture analysis

  1. Single node:

  2. Advantages: local development and testing, simple configuration, no sync flash message will be lost

    Disadvantages: unreliable, if downtime, the service will be unavailable

  3. Master-slave (asynchronous, synchronous double write):

    Advantages: Synchronous double-write messages are not lost, asynchronous replication has a small amount of loss, the master node is down, and the slave node can provide message consumption to the outside, but does not support writing

    Disadvantages: There is a short message delay between the master and the slave, milliseconds, and currently does not support automatic switching. It requires scripts or other programs to detect and then stop the broker and restart to make the slave node the master node

  4. Double master:

    Advantages: simple configuration, you can rely on the configuration of RAID disk array to ensure reliable messages, and a small amount of messages will be lost when flushing the disk asynchronously

    Disadvantages: During the downtime of the master machine, unconsumed messages cannot be consumed until the machine is restored, and the real-time performance will be affected

  5. Dual master and dual slave, multi-master and multi-slave mode (asynchronous replication)

    Advantages: Disk damage, very few messages are lost, and the real-time performance of messages will not be affected. After the Master goes down, consumers can still consume from the Slave

    Disadvantages: There is a short message delay between the master and the backup, milliseconds. If the Master is down and the disk is damaged, a small amount of messages will be lost

  6. Dual master and dual slave, multi-master and multi-slave mode (synchronous dual write)

    Advantages: Synchronous dual write mode, the master and backup are written successfully, and the success is returned to the application, service availability and data availability are very high

    Disadvantages: performance is slightly lower than asynchronous replication mode. After the main machine goes down, the standby machine cannot automatically switch to the main machine

 

Recommended options 2, 4, 5

The official architecture diagram:

Synchronous and asynchronous flashing of message reliability

  • Memory + disk
  • What is an asynchronous flash disk (data may be lost, high performance):
  • What is synchronous flashing: high data security
  • Choice: each has its own advantages and disadvantages, depending on business needs

Synchronous and asynchronous replication of message reliability

  • Master-Slave node
  • Asynchronous replication: data may be lost, high performance
  • Synchronous replication: high data security and low performance
  • Finally recommended this method: synchronous double write (ie MS synchronous replication), asynchronous flashing

Guess you like

Origin blog.csdn.net/qq_41023026/article/details/89763878
Recommended