RocketMQ (4) --- RocketMQ core configuration explain

RocketMQ core configuration explain

RocketMQ core configuration in broker.conf configuration file, here we have to analyze it.

A, broker.conf configuration

Here are some commonly used only to explain the core configuration.

1, broker.conf core configuration explain

# nameServer地址,如果nameserver是多台集群的话,就用分号分割
namesrvAddr=172.1.21.29:9876;143.13.262.43:9876
# 所属集群名字(同一主从下:Master和slave名称要一致)
brokerClusterName=rocketmq-cluster
# broker名字,注意此处不同的配置文件填写的不一样  例如:在a.properties 文件中写 broker-a  在b.properties 文件中写 broker-b
brokerName=broker-a
# 0 表示 Master,>0 表示 Slave
brokerId=0
# Broker 对外服务的监听端口
listenPort=10911
# 在发送消息时,自动创建服务器不存在的topic,默认创建的队列数。由于是4个broker节点,所以设置为4
# defaultTopicQueueNums=4
# 是否允许 Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
# 是否允许 Broker 自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
# commitLog每个文件的大小默认1G
mapedFileSizeCommitLog=1073741824
# ConsumeQueue每个文件默认存30W条,根据业务情况调整
mapedFileSizeConsumeQueue=300000
# 检测可用的磁盘空间大小,当磁盘被占用超过90%,消息写入会直接报错                    
diskMaxUsedSpaceRatio=90
# Broker 的角色: ASYNC_MASTER 异步复制Master ; SYNC_MASTER 同步双写Master; SLAVE
brokerRole=SYNC_MASTER
# 刷盘方式 ASYNC_FLUSH 异步刷盘; SYNC_FLUSH 同步刷盘
flushDiskType=ASYNC_FLUSH

2, the synchronous or asynchronous brush disc brush disc

Synchronous and asynchronous disk brush brush plate refers memory and disk relationships.

RocketMQ message is ultimately to storage on disk, so can guarantee the power restored, but also allows the amount of messages stored in memory exceeds the limit.

Sending a message from a client, start the first write to memory, and then written to disk. As shown below

Both strategies

同步刷盘: When the data has been successfully written to memory immediately after the brush plate (synchronous), to ensure that messages are written in the state under the premise of a successful return to write the disk also successful.

异步刷盘: After data is written to memory, direct return successful status. Asynchronous data memory persisted to disk.

Synchronous and asynchronous transmission disc brush merits disc

Synchronization brush plate

优点: To ensure the reliability of the data, to ensure that data is not lost.

缺点: Synchronous disc brush less efficient because memory is needed before a message is written to disk return a successful status.

Asynchronous brush plate

优点: Asynchronous brush disc can improve the system throughput. Because it is only written after the success of memory, it returns a successful status.

缺点: Asynchronous brush plate can not guarantee the reliability of data. Because writing to memory successfully, but when written to disk write fails for some reason, it will be lost piece of news.

3, synchronous replication or asynchronous replication

Synchronous and asynchronous replication refers to the Master node and slave node relationships.

If a group Broker Master and Slave, the message needs to be copied from the Master to the Slave

Both strategies

同步复制: When the data has been successfully written to memory immediately after synchronization Master node Slave when Slave is also a prerequisite for success at writing a successful return to the state.

异步复制: After the data has been successfully written to the memory of Master node, direct return successful status, asynchronous data stored in the Master Slave nodes.

Synchronous and asynchronous replication of the pros and cons:

同步复制 : Data security and lowest performance point.

异步复制 : Data may be lost, high-performance point.


建议 + Online synchronous asynchronous replication brush disc;




只要自己变优秀了,其他的事情才会跟着好起来(上将1)

Guess you like

Origin www.cnblogs.com/qdhxhz/p/11116197.html