sudo docker run -d --name rocketmq-namesrv --network rocketmq -p 9876:9876 -v /home/luohong/coding/dockers/rocketmq/namesrv/logs:/root/logs -v /home/luohong/coding/dockers/rocketmq/namesrv/store:/root/store apache/rocketmq:4.9.1 sh mqnamesrv
> 查看 rocketmq-namesrv 状态
(base) luohong@luohong:~/coding/dockers/rocketmq$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4b6a5f523bfe apache/rocketmq:4.9.1 “sh mqnamesrv” 2 seconds ago Up 1 second 10909/tcp, 0.0.0.0:9876->9876/tcp, :::9876->9876/tcp, 10911-10912/tcp rocketmq-namesrv
docker cp 容器ID:容器内文件位置 本地位置
4b6a5f523bfe : 是自己本地允许的 rocketmq-namesrv的 container id
# Licensed to the Apache Software Foundation(ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #所属集群名字,同一个集群名字相同 brokerClusterName=rocketmq-cluster #broker名字 brokerName=broker-a #0表示master >0 表示slave brokerId=0 #删除文件的时间点,凌晨4点 deleteWhen=04 #文件保留时间 默认是48小时 fileReservedTime=168 #异步复制Master brokerRole=ASYNC_MASTER #刷盘方式,ASYNC_FLUSH=异步刷盘,SYNC_FLUSH=同步刷盘 flushDiskType=ASYNC_FLUSH #Broker 对外服务的监听端口 listenPort=10911 #nameServer地址,这里nameserver是单台,如果nameserver是多台集群的话,就用分号分割(即namesrvAddr=ip1:port1;ip2:port2;ip3:port3) namesrvAddr=172.21.129.80:9876;172.21.129.80:9877 #每个topic对应队列的数量,默认为4,实际应参考consumer实例的数量,值过小不利于consumer负载均衡 defaultTopicQueueNums=8 #是否允许 Broker 自动创建Topic,生产建议关闭 autoCreateTopicEnable=true #是否允许 Broker 自动创建订阅组,生产建议关闭 autoCreateSubscriptionGroup=true #设置BrokerIP brokerIP1=172.21.129.80
broker-b.conf
# Licensed to the Apache Software Foundation(ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #所属集群名字 brokerClusterName=rocketmq-cluster #broker名字,注意此处不同的配置文件填写的不一样 例如:在a.properties 文件中写 broker-a 在b.properties 文件中写 broker-b brokerName=broker-b #0 表示 Master,>0 表示 Slave brokerId=0 #删除文件时间点,默认凌晨 4点 deleteWhen=04 #文件保留时间,默认 48 小时 fileReservedTime=168 #Broker 的角色,ASYNC_MASTER=异步复制Master,SYNC_MASTER=同步双写Master,SLAVE=slave节点 brokerRole=ASYNC_MASTER #刷盘方式,ASYNC_FLUSH=异步刷盘,SYNC_FLUSH=同步刷盘 flushDiskType=SYNC_FLUSH #Broker 对外服务的监听端口 listenPort=11911 #nameServer地址,这里nameserver是单台,如果nameserver是多台集群的话,就用分号分割(即namesrvAddr=ip1:port1;ip2:port2;ip3:port3) namesrvAddr=172.21.129.80:9876;172.21.129.80:9877 #每个topic对应队列的数量,默认为4,实际应参考consumer实例的数量,值过小不利于consumer负载均衡 defaultTopicQueueNums=8 #是否允许 Broker 自动创建Topic,生产建议关闭 autoCreateTopicEnable=true #是否允许 Broker 自动创建订阅组,生产建议关闭 autoCreateSubscriptionGroup=true #设置BrokerIP brokerIP1=172.21.129.80
broker-a-s.conf
# Licensed to the Apache Software Foundation(ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #所属集群名字 brokerClusterName=rocketmq-cluster #broker名字,注意此处不同的配置文件填写的不一样 例如:在a.properties 文件中写 broker-a 在b.properties 文件中写 broker-b brokerName=broker-a #0 表示 Master,>0 表示 Slave brokerId=1 #删除文件时间点,默认凌晨 4点 deleteWhen=04 #文件保留时间,默认 48 小时 fileReservedTime=168 #Broker 的角色,ASYNC_MASTER=异步复制Master,SYNC_MASTER=同步双写Master,SLAVE=slave节点 brokerRole=SLAVE #刷盘方式,ASYNC_FLUSH=异步刷盘,SYNC_FLUSH=同步刷盘 flushDiskType=SYNC_FLUSH #Broker 对外服务的监听端口 listenPort=12911 #nameServer地址,这里nameserver是单台,如果nameserver是多台集群的话,就用分号分割(即namesrvAddr=ip1:port1;ip2:port2;ip3:port3) namesrvAddr=172.21.129.80:9876;172.21.129.80:9877 #每个topic对应队列的数量,默认为4,实际应参考consumer实例的数量,值过小不利于consumer负载均衡 defaultTopicQueueNums=8 #是否允许 Broker 自动创建Topic,生产建议关闭 autoCreateTopicEnable=true #是否允许 Broker 自动创建订阅组,生产建议关闭 autoCreateSubscriptionGroup=true #设置BrokerIP brokerIP1=172.21.129.80
broker-b-s.conf
# Licensed to the Apache Software Foundation(ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. brokerClusterName=rocketmq-cluster brokerName=broker-b #slave brokerId=1 deleteWhen=04 fileReservedTime=168 brokerRole=SLAVE flushDiskType=ASYNC_FLUSH #Broker 对外服务的监听端口 listenPort=13911 #nameServer地址,这里nameserver是单台,如果nameserver是多台集群的话,就用分号分割(即namesrvAddr=ip1:port1;ip2:port2;ip3:port3) namesrvAddr=172.21.129.80:9876;172.21.129.80:9877 #每个topic对应队列的数量,默认为4,实际应参考consumer实例的数量,值过小不利于consumer负载均衡 defaultTopicQueueNums=8 #是否允许 Broker 自动创建Topic,生产建议关闭 autoCreateTopicEnable=true #是否允许 Broker 自动创建订阅组,生产建议关闭 autoCreateSubscriptionGroup=true #设置BrokerIP brokerIP1=172.21.129.80