rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject incubator-rocketmq-site git commit: Add a blog to introduce methods to specify name server for brokers, producers, consumers and mq admin tools.
Date Fri, 10 Feb 2017 04:09:24 GMT
Repository: incubator-rocketmq-site
Updated Branches:
  refs/heads/master 0b348ef85 -> bdd8b466f

Add a blog to introduce methods to specify name server for brokers, producers, consumers and
mq admin tools.


Branch: refs/heads/master
Commit: bdd8b466f31c8d703400f529ffa432fa307a9f9c
Parents: 0b348ef
Author: Zhanhui Li <>
Authored: Fri Feb 10 12:09:17 2017 +0800
Committer: Zhanhui Li <>
Committed: Fri Feb 10 12:09:17 2017 +0800

---------------------------------------------------------------------- | 71 ++++++++++++++++++++
 1 file changed, 71 insertions(+)
diff --git a/_posts/ b/_posts/
new file mode 100644
index 0000000..f4c78b1
--- /dev/null
+++ b/_posts/
@@ -0,0 +1,71 @@
+title: "Four Methods to Feed Name Server Address List"
+  - RocketMQ
+  - RocketMQ
+  - Name Server
+Apache RocketMQ is a distributed system that each components should be properly coordinated
to work smoothly. Name 
+servers are designed to take much of this responsibility through managing topic route information.
+The management, roughly speaking, consists two parts. The first one is that brokers report
to name servers on meta data
+of themselves and topics they have. The second is serving clients, including producer, consumer
and command line
+ executables these meta data.
+As a result, before launching brokers and clients, we need to feed name server address list
to them. Apache RocketMQ 
+provides four methods to achieve this goal.
+1. Programmatic Way
+   For broker, we may specify `namesrvAddr=name-server-ip1:port;name-server-ip2:port` in
broker configuration file.
+   Alternatively, we may pass a parameter like `-n name-server-ip1:port;name-server-ip2:port`
to `mqbroker` script.
+   For producers and consumers, we may feed name server address list to them as follows:
+   `
+   DefaultMQProducer producer = new DefaultMQProducer("please_rename_unique_group_name");
+   producer.setNamesrvAddr("name-server1-ip:port;name-server2-ip:port");`
+   `
+   DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("please_rename_unique_group_name");
+   consumer.setNamesrvAddr("name-server1-ip:port;name-server2-ip:port");`
+   If you use admin command line from shell, you may specify this way:
+   `sh mqadmin command-name -n name-server-ip1:port;name-server-ip2:port -x other-options`
+   a simple example is:
+   `sh mqadmin -n localhost:9876 clusterList`
+   assuming to query cluster info on the name server node.
+   If integrating admin tool into your own dashboard, you may
+   `DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt("please_rename_unique_group_name");
+    defaultMQAdminExt.setNamesrvAddr("name-server1-ip:port;name-server2-ip:port");`
+2. Environment Variable
+   You can export `NAMESRV_ADDR` environment variable. Brokers and clients will examine and
use its value if set.
+3. Java Options
+    Similar to environment variable, you may specify the sequel java option `rocketmq.namesrv.addr`
before launching your
+    application.
+4. HTTP endpoint
+    If you do not specify name server address list using previously mentioned methods, Apache
RocketMQ will periodically 
+    access the following HTTP end point to acquire and update name server address list.
+    On default, the end point is:
+    ``
+    You may override `` by this java option: `rocketmq.namesrv.domain`,
+    You may also override `nsaddr` part by this java option: `rocketmq.namesrv.domain.subgroup`
+    This method is recommended because it gives you maximum flexibility, aka, you can dynamically
add or 
+    remove name server node without necessity of rebooting your brokers and clients according
to your name servers'
+    system load. 
\ No newline at end of file

View raw message