FAQs
Common questions about the RocketMQ project:
1 Basic
Why should we use RocketMQ instead of choosing other products?
Please refer towhy choose RocketMQ
Do I need to install any other software in order to use RocketMQ, such as ZooKeeper?
No,RocketMQ can run on independent。
2 Use
Where does the newly created ConsumerGroup start consuming messages?
1)When the 5.x SDK is first online, it will consume from the latest message on the server, starting from the tail of the queue. After restarting again, it will continue to consume from the last consumption position.
2)The 3.x/4.x SDK is more complicated. If the first start is within three days of the sent message, the consumer will start consuming from the first saved message on the server. If the sent message is more than three days, the consumer will start consuming from the latest message on the server, starting from the tail of the queue. After restarting again, it will continue to consume from the last consumption position.
When consumption fails, how can the message be consumed again?
1)In cluster mode, the consumption business logic code will return a consumption failure status, or throw an exception. If a message consumption fails, it will be retried according to the maximum retry count set, and then the message will be discarded.
2)In broadcast consumption mode, broadcast consumption still guarantees that the message is consumed at least once, but does not provide resend options.
When consumption fails, how can the failed message be found?
1)Using a time-based topic query can query messages within a period of time.
2)Use the topic and message ID to accurately query the message.
3)Use the topic and message Key to accurately query all messages with the same message Key.
Is the message only delivered once?
RocketMQ ensures that all messages are delivered at least once. In most cases, messages are not repeated.
How can a new Broker be added?
1)Start a new Broker and register it in the Broker list of the NameServer.
2)By default, only internal system Topics and Consumer Groups are automatically created. If you want to have your business topic and consumer group on the new node, copy them from the existing Broker. We provide management tools and command line to handle this.
3 Configuration dependent
The following answers are default values, which can be modified through configuration.
How long can messages be saved on the server?
Messages will be stored for a maximum of 3 days. Messages that have not been used for more than 3 days will be deleted.
What is the size limit for message bodies?
Typically, it is 256KB.
How do you set the number of consumer threads?
When you start the consumer, you can set the property. The parameter name varies by version.
4 Error
APPLY_TOPIC_URL
exception information
topic[xxx] not exist, apply first please!
reason
1)When a Producer sends a message or a Consumer consumes a message, this exception will occur if the routing information for the Topic cannot be obtained.
solution
1)Make sure that the NameServer indeed contains the routing information for the Topic. You can use the management tool or the Web console to query the routing information from the NameServer through the TopicRoute;
2)Make sure that the Broker and Consumer are connected to the same NameServer cluster;
3)Make sure that the queue permissions for the topic are 6 (rw-) for the Producer or at least 2 (-w-) for the Consumer;
If the topic cannot be found, create it on the Broker through the management tool command updateTopic or the Web console.
NAME_SERVER_ADDR_NOT_EXIST_URL
exception information
No name server address, please set it
or
connect to xxx failed, maybe the domain name xxx not bind in /etc/hosts
reason
1)Producer or Consumer, there is an error in obtaining the NameServer address information.
solution
1)Please refer to:5.1 Client addressing
GROUP_NAME_DUPLICATE_URL
exception information
The producer group[xxx] has been created before, specify another name please.
reason
1)A Consumer Group with the same name has already been started and registration failed.
solution
1)Rename a new Consumer Group.
2)A Consumer Group with the same name was normally closed and then started again.
CLIENT_PARAMETER_CHECK_URL
exception information
consumerGroup can not equal ...
or
allocateMessageQueueStrategy is null ...
or
Long polling mode, the consumer consumerTimeoutMillisWhenSuspend must greater than brokerSuspendMaxTimeMillis ...
In addition to the above exceptions, there may be other exceptions that are not listed here.
reason
1)Consumer parameter verification failed.
solution
1)Please refer to: 5.2 Client configuration
SUBSCRIPTION_GROUP_NOT_EXIST
exception information
subscription group not exist
reason
1)If the Consumer Group or DleayQueue encounters an error while getting subscription information.
solution
1)Ensure the Consumer’s subscription to the Topic information is consistent with the Topic information in the NameServer.
2)Make sure the Broker and Consumer are connected to the same NameServer cluster.
3)Ensure the queue permissions for the Topic are 6 (rw-) for the Producer, or at least 2 (-w-) for the Consumer
CLIENT_SERVICE_NOT_OK
exception information
The xxx service state not OK, maybe started once
reason
1)Starting multiple Producer/Consumer instances in the same JVM using the same Producer/Consumer Group may cause the client to fail to start.
solution
1)Make sure only one Producer/Consumer instance is started for a given Producer/Consumer Group JVM.
NO_TOPIC_ROUTE_INFO
exception information
No route info of this topic:
reason
1)If a message is sent to a topic that is not available to the producer,that’s what happens.
solution
1)Ensure the producer is able to connect to the name server and retrieve routing metadata from it.
2)Ensure the name server contains routing metadata for the topic. You can use a management tool or the Web console to query the routing metadata from the name server using TopicRoute.
3)Make sure your Broker is sending heartbeats to the same NameServer list that your producer is connected to.
4)Ensure the topic has permission 6 (rw-), or at least 2 (-w-).
If the topic is not found, create it on the Broker via the management tool command updateTopic or the Web console.
LOAD_JSON_EXCEPTION
exception information
readLocalOffset Exception
reason
1)In broadcast mode, consumers have an error when loading the local offsets.json file.
2)A damaged fastjson file can also cause the same problem.
solution
1)Check if the fastjson version and RocketMQ version in use are consistent.
2)Upgrade fastjson version.
SAME_GROUP_DIFFERENT_TOPIC
exception information
the consumer's group info/subscription not exist
reason 1)Consumer subscription to Topic information does not exist.
solution
1)Check if the Consumer Group where the Consumer belongs exists.
2)Check if the Topic subscribed to by the Consumer exists.
MQLIST_NOT_EXIST
exception information
Can not find Message Queue for this topic
reason 1)For the Producer, the corresponding Queue information could not be obtained based on the Topic.
solution
1)Ensure that the Queue information has been correctly configured for the Topic.
2)Ensure that the Queue corresponding to the Topic has at least 2 (-w-) permissions.
SEND_MSG_FAILED
exception information
Send [xxx] times, still failed, cost [xxx]ms, Topic: xxx, BrokersSent ...
reason 1)The Producer message sending is abnormal. A total of 3 times are sent in SYNC mode, and 1 time is sent in ASYNC and ONEWAY.
solution 1)Whether the timeout parameter of the Producer sending message is too small.
2)Ensure that the Broker is normal.
3)Ensure that the connection between the Producer and Broker is normal.
UNKNOWN_HOST_EXCEPTION
exception information
InetAddress java.net.InetAddress.getLocalHost() throws UnknownHostException
reason
1)There may be many network interfaces on the host, and one interface may be bound to multiple IP addresses.
solution
1)Ensure that the IP corresponding to the host can be accessed normally, and use network commands such as Ping to check the network situation.
5 Others
What is the impact of the Broker crashing?
1)Master node crashes
Messages can no longer be sent to the Broker cluster, but if you have another available Broker cluster, messages can still be sent as long as the topic exists. Messages can still be consumed from the Slave node.
2)Some Slave nodes crash
Sending messages will not be affected as long as there is another working Slave. Consuming messages will not be affected unless the consumer group is set to consume from the Slave first. By default, the consumer group consumes from the Master.
3)All Slave nodes crash
Sending messages to the Master will not be affected, but if the Master is SYNC_MASTER, the Producer will get a SLAVE_NOT_AVAILABLE indicating that the message was not sent to any Slave. Consuming messages will not be affected unless the consumer group is set to consume from the Slave first. By default, the consumer group consumes from the Master.