赞
踩
[root@localhost ~]# vi /etc/sysconfig/network
[root@localhost ~]# vi /etc/hosts
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]# date
Sun Jun 12 14:42:31 UTC 2022
[root@localhost ~]# yum install ntp -y
Complete!
[root@localhost ~]# vi /etc/ntp.conf
[root@localhost ~]# service ntpd start
Redirecting to /bin/systemctl start ntpd.service
[root@localhost ~]# chkconfig ntpd on
Note: Forwarding request to 'systemctl enable ntpd.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
[root@localhost ~]# date
Sun Jun 12 14:45:16 UTC 2022
[root@localhost bin]# cd /soft
[root@localhost soft]# ll
total 198368
-rw-r--r--. 1 root root 170023183 Jun 12 11:39 jdk-8u181-linux-x64.rpm
drwxr-xr-x. 6 root root 103 Feb 22 01:25 rocketmq-4.9.3
-rw-r--r--. 1 root root 26892203 Feb 26 17:10 rocketmq-all-4.9.3-bin-release.zip
[root@localhost soft]# rpm -i jdk-8u181-linux-x64.rpm
warning: jdk-8u181-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
[root@localhost soft]# cd /usr/java
[root@localhost java]# ll
total 0
lrwxrwxrwx. 1 root root 16 Jun 12 12:38 default -> /usr/java/latest
drwxr-xr-x. 8 root root 258 Jun 12 12:38 jdk1.8.0_181-amd64
lrwxrwxrwx. 1 root root 28 Jun 12 12:38 latest -> /usr/java/jdk1.8.0_181-amd64
[root@localhost java]# cd default/
[root@localhost default]# ll
total 25976
drwxr-xr-x. 2 root root 4096 Jun 12 12:38 bin
-rw-r--r--. 1 root root 3244 Jul 7 2018 COPYRIGHT
drwxr-xr-x. 3 root root 132 Jun 12 12:38 include
-rw-r--r--. 1 root root 5207314 Jun 27 2018 javafx-src.zip
drwxr-xr-x. 5 root root 185 Jun 12 12:38 jre
drwxr-xr-x. 5 root root 245 Jun 12 12:38 lib
-rw-r--r--. 1 root root 40 Jul 7 2018 LICENSE
drwxr-xr-x. 4 root root 47 Jun 12 12:38 man
-rw-r--r--. 1 root root 159 Jul 7 2018 README.html
-rw-r--r--. 1 root root 424 Jul 7 2018 release
-rw-r--r--. 1 root root 21099920 Jul 7 2018 src.zip
-rw-r--r--. 1 root root 106782 Jun 27 2018 THIRDPARTYLICENSEREADME-JAVAFX.txt
-rw-r--r--. 1 root root 154222 Jul 7 2018 THIRDPARTYLICENSEREADME.txt
[root@localhost default]# vi /etc/profile
[root@localhost default]# echo $PATH
/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/soft/redis5/bin:/root/bin
[root@localhost default]# source /etc/profile
[root@localhost default]# echo $PATH
/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/soft/redis5/bin:/root/bin:/opt/soft/redis5/bin:/usr/java/default/bin
[root@localhost default]# java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
[root@localhost default]# cd /soft
[root@localhost soft]# ll
total 198368
-rw-r--r--. 1 root root 170023183 Jun 12 11:39 jdk-8u181-linux-x64.rpm
drwxr-xr-x. 6 root root 103 Feb 22 01:25 rocketmq-4.9.3
-rw-r--r--. 1 root root 3722978 Feb 26 17:10 rocketmq-all-4.9.3-source-release.zip
[root@localhost soft]# cd rocketmq-4.9.3/
[root@localhost rocketmq-4.9.3]# ll
total 40
drwxr-xr-x. 2 root root 126 Feb 22 01:25 benchmark
drwxr-xr-x. 3 root root 4096 Jun 12 12:37 bin
drwxr-xr-x. 7 root root 201 Feb 22 00:25 conf
drwxr-xr-x. 2 root root 4096 Feb 22 01:25 lib
-rw-r--r--. 1 root root 17327 Feb 22 00:25 LICENSE
-rw-r--r--. 1 root root 1338 Feb 22 00:25 NOTICE
-rw-r--r--. 1 root root 6069 Feb 22 00:25 README.md
[root@localhost rocketmq-4.9.3]# cd bin
[root@localhost bin]# ll
total 116
-rwxr-xr-x. 1 root root 1654 Feb 22 00:25 cachedog.sh
-rwxr-xr-x. 1 root root 845 Feb 22 00:25 cleancache.sh
-rwxr-xr-x. 1 root root 1116 Feb 22 00:25 cleancache.v1.sh
drwxr-xr-x. 2 root root 25 Feb 22 00:25 dledger
-rwxr-xr-x. 1 root root 2523 Feb 22 00:25 export.sh
-rwxr-xr-x. 1 root root 1400 Feb 22 00:25 mqadmin
-rwxr-xr-x. 1 root root 1029 Feb 22 00:25 mqadmin.cmd
-rwxr-xr-x. 1 root root 1394 Feb 22 00:25 mqbroker
-rwxr-xr-x. 1 root root 1084 Feb 22 00:25 mqbroker.cmd
-rwxr-xr-x. 1 root root 1373 Feb 22 00:25 mqbroker.numanode0
-rwxr-xr-x. 1 root root 1373 Feb 22 00:25 mqbroker.numanode1
-rwxr-xr-x. 1 root root 1373 Feb 22 00:25 mqbroker.numanode2
-rwxr-xr-x. 1 root root 1373 Feb 22 00:25 mqbroker.numanode3
-rwxr-xr-x. 1 root root 1396 Feb 22 00:25 mqnamesrv
-rwxr-xr-x. 1 root root 1088 Feb 22 00:25 mqnamesrv.cmd
-rwxr-xr-x. 1 root root 1571 Feb 22 00:25 mqshutdown
-rwxr-xr-x. 1 root root 1398 Feb 22 00:25 mqshutdown.cmd
-rwxr-xr-x. 1 root root 2222 Feb 22 00:25 os.sh
-rwxr-xr-x. 1 root root 1148 Feb 22 00:25 play.cmd
-rwxr-xr-x. 1 root root 1008 Feb 22 00:25 play.sh
-rwxr-xr-x. 1 root root 772 Feb 22 00:25 README.md
-rwxr-xr-x. 1 root root 2159 Feb 22 00:25 runbroker.cmd
-rwxr-xr-x. 1 root root 4528 Feb 22 00:25 runbroker.sh
-rwxr-xr-x. 1 root root 1799 Feb 22 00:25 runserver.cmd
-rwxr-xr-x. 1 root root 4093 Feb 22 00:25 runserver.sh
-rwxr-xr-x. 1 root root 1156 Feb 22 00:25 setcache.sh
-rwxr-xr-x. 1 root root 1408 Feb 22 00:25 startfsrv.sh
-rwxr-xr-x. 1 root root 1543 Feb 22 00:25 tools.cmd
-rwxr-xr-x. 1 root root 1820 Feb 22 00:25 tools.sh
[root@localhost bin]# ./mqnamesrv
Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
The Name Server boot success. serializeType=JSON
[root@localhost ~]# jps
2502 Jps
2430 NamesrvStartup
[root@localhost ~]# netstat -natp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 680/redis-server 12
tcp 0 0 127.0.0.1:6380 0.0.0.0:* LISTEN 683/redis-server 12
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 398/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 672/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 889/master
tcp 0 0 192.168.56.200:22 192.168.56.1:54513 ESTABLISHED 924/sshd: vagrant [
tcp 0 52 192.168.56.200:22 192.168.56.1:65247 ESTABLISHED 1254/sshd: vagrant
tcp6 0 0 :::111 :::* LISTEN 398/rpcbind
tcp6 0 0 :::9876 :::* LISTEN 2430/java
tcp6 0 0 :::22 :::* LISTEN 672/sshd
tcp6 0 0 ::1:25 :::* LISTEN 889/master
[root@localhost ~]# cd /soft/rocketmq-4.9.3/
[root@localhost rocketmq-4.9.3]# ll
total 40
drwxr-xr-x. 2 root root 126 Feb 22 01:25 benchmark
drwxr-xr-x. 3 root root 4096 Jun 12 12:37 bin
drwxr-xr-x. 7 root root 201 Feb 22 00:25 conf
drwxr-xr-x. 2 root root 4096 Feb 22 01:25 lib
-rw-r--r--. 1 root root 17327 Feb 22 00:25 LICENSE
-rw-r--r--. 1 root root 1338 Feb 22 00:25 NOTICE
-rw-r--r--. 1 root root 6069 Feb 22 00:25 README.md
[root@localhost rocketmq-4.9.3]# cd bin
[root@localhost bin]# ./mqbroker -n localhost:9876 --> 注册到本机namesrv
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000005c0000000, 8589934592, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 8589934592 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /soft/rocketmq-4.9.3/bin/hs_err_pid2773.log
[root@localhost bin]# cat mqbroker
#!/bin/sh
# 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.
if [ -z "$ROCKETMQ_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*->
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
ROCKETMQ_HOME=`dirname "$PRG"`/..
# make it fully qualified
ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd`
cd "$saveddir"
fi
export ROCKETMQ_HOME
sh ${ROCKETMQ_HOME}/bin/runbroker.sh org.apache.rocketmq.broker.BrokerStartup $@
[root@localhost bin]# vi runbroker.sh --> 本地测试调整最大内存为1g
[root@localhost bin]# ./mqbroker -n localhost:9876
The broker[localhost.localdomain, 10.0.2.15:10911] boot success. serializeType=JSON and name server is localhost:9876
[root@localhost ~]# jps
3095 Jps
2430 NamesrvStartup
2895 BrokerStartup
[root@localhost ~]# netstat -natp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 680/redis-server 12
tcp 0 0 127.0.0.1:6380 0.0.0.0:* LISTEN 683/redis-server 12
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 398/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 672/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 889/master
tcp 0 0 192.168.56.200:22 192.168.56.1:54513 ESTABLISHED 924/sshd: vagrant [
tcp 0 52 192.168.56.200:22 192.168.56.1:56264 ESTABLISHED 3019/sshd: vagrant
tcp 0 0 192.168.56.200:22 192.168.56.1:65247 ESTABLISHED 1254/sshd: vagrant
tcp6 0 0 :::111 :::* LISTEN 398/rpcbind
tcp6 0 0 :::9876 :::* LISTEN 2430/java
tcp6 0 0 :::22 :::* LISTEN 672/sshd
tcp6 0 0 ::1:25 :::* LISTEN 889/master
tcp6 0 0 :::10909 :::* LISTEN 2895/java
tcp6 0 0 :::10911 :::* LISTEN 2895/java
tcp6 0 0 :::10912 :::* LISTEN 2895/java
tcp6 0 0 127.0.0.1:33422 127.0.0.1:9876 ESTABLISHED 2895/java
tcp6 0 0 127.0.0.1:9876 127.0.0.1:33422 ESTABLISHED 2430/java
[root@localhost bin]# ./mqnamesrv
Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
The Name Server boot success. serializeType=JSON
[root@localhost ~]# cd /soft/rocketmq-4.9.3/bin
[root@localhost bin]# ./mqbroker -n 192.168.56.200:6379
The broker[localhost.localdomain, 10.0.2.15:10911] boot success. serializeType=JSON and name server is 192.168.56.200:6379
[root@localhost soft]# cd ~
[root@localhost ~]# ll
total 20
-rw-------. 1 root root 5570 Apr 30 2020 anaconda-ks.cfg
drwxr-xr-x. 3 root root 26 Jun 12 12:54 logs
-rw-------. 1 root root 5300 Apr 30 2020 original-ks.cfg
drwxr-xr-x. 5 root root 100 Jun 12 13:02 store
-rwxr-xr-x. 1 root root 73 Jun 11 04:15 test.sh
[root@localhost ~]# cd logs
[root@localhost logs]# ll
total 4
drwxr-xr-x. 2 root root 4096 Jun 12 13:02 rocketmqlogs
[root@localhost logs]# cd ~
[root@localhost ~]# cd store
[root@localhost store]# ll
total 8
-rw-r--r--. 1 root root 0 Jun 12 13:02 abort
-rw-r--r--. 1 root root 4096 Jun 12 13:43 checkpoint
drwxr-xr-x. 2 root root 6 Jun 12 13:02 commitlog
drwxr-xr-x. 2 root root 193 Jun 12 13:43 config
drwxr-xr-x. 2 root root 6 Jun 12 13:02 consumequeue
-rw-r--r--. 1 root root 4 Jun 12 13:02 lock
[root@localhost store]# cd commitlog
[root@localhost commitlog]# ll
total 0
[root@localhost commitlog]# cd .
[root@localhost commitlog]# cd ..
[root@localhost store]# cd consumequeue/
[root@localhost consumequeue]# ll
total 0
Simple Message Example - Apache RocketMQ
- @Test
- public void admin() throws MQClientException, RemotingException, InterruptedException {
- DefaultMQAdminExt admin = new DefaultMQAdminExt();
- admin.setNamesrvAddr("192.168.56.200:9876");
- admin.start();
-
- TopicList topicList = admin.fetchAllTopicList();
- Set<String> sets = topicList.getTopicList();
- sets.forEach(s -> System.out.println(s));
-
- System.out.println("topic route | info");
- TopicRouteData wula = admin.examineTopicRouteInfo("wula");
- System.out.println(wula);
- }
- SCHEDULE_TOPIC_XXXX
- RMQ_SYS_TRANS_HALF_TOPIC
- DefaultCluster_REPLY_TOPIC
- BenchmarkTest
- OFFSET_MOVED_EVENT
- TBW102
- localhost.localdomain
- SELF_TEST_TOPIC
- DefaultCluster
- topic route | info
-
- org.apache.rocketmq.client.exception.MQClientException: CODE: 17 DESC: No topic route info in name server for the topic: wula
- See http://rocketmq.apache.org/docs/faq/ for further details.
-
- at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1387)
- at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicRouteInfoFromNameServer(MQClientAPIImpl.java:1357)
- at org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl.examineTopicRouteInfo(DefaultMQAdminExtImpl.java:333)
- at org.apache.rocketmq.tools.admin.DefaultMQAdminExt.examineTopicRouteInfo(DefaultMQAdminExt.java:264)
- at rocketmq.SimpleRocketMQ.admin(SimpleRocketMQ.java:121)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:498)
- at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
- at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
- at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
- at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
- at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
- at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
- at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
- at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
- at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
- at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
- at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
- at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
- at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
- at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
- at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
- at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
- at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
- at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
-
上述结果:首次运行admin
- @Test
- public void consumerPull() throws MQClientException, IOException {
- DefaultLitePullConsumer consumer = new DefaultLitePullConsumer("ooxx");
- consumer.setNamesrvAddr("192.168.56.200:9876");
- consumer.start();
-
- Collection<MessageQueue> mqs = consumer.fetchMessageQueues("wula");
- System.out.println("queues:");
- mqs.forEach(messageQueue -> System.out.println(messageQueue));
- System.out.println("poll...");
- // consumer.assign(mqs);
-
- Collection<MessageQueue> queue = new ArrayList<>();
- queue.add(new MessageQueue("wula", "node01", 0));
- consumer.assign(queue);
- List<MessageExt> poll = consumer.poll();
- poll.forEach(messageExt -> System.out.println(messageExt));
- System.in.read();
- }
-
- @Test
- public void consumerPush() throws Exception {
- DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("consumer_ox");
- consumer.setNamesrvAddr("192.168.56.200:9876");
- consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
-
- consumer.subscribe("wula", "*");
- consumer.registerMessageListener(new MessageListenerConcurrently() {
- @Override
- public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
- list.forEach(messageExt -> {
- byte[] body = messageExt.getBody();
- String message = new String(body);
- System.out.println(message);
- });
- return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
- }
- });
- consumer.start();
- // 自测 加个 无线循环或阻塞
- }
常识理论:防火墙关闭,主机名,hosts设置
注意:主机名不要包含下划线 _ 但是 - 是可以的
node01~04
4个配置文件
自动去ns上注册
store、logs文件路径的规划
[root@node01 ~]# mkdir -p /var/rocketmq/{logs,store/{commitlog,consumequeue,index}}
[root@node01 ~]# cd /var/rocketmq/
[root@node01 rocketmq]# ll
total 0
drwxr-xr-x. 2 root root 6 Jun 14 14:05 logs
drwxr-xr-x. 5 root root 56 Jun 14 14:05 store
[root@node01 rocketmq]# cd store
[root@node01 store]# ll
total 0
drwxr-xr-x. 2 root root 6 Jun 14 14:05 commitlog
drwxr-xr-x. 2 root root 6 Jun 14 14:05 consumequeue
drwxr-xr-x. 2 root root 6 Jun 14 14:05 index
[root@node01 store]# cd
[root@node01 ~]# cd /soft/rocketmq-4.9.3/conf
[root@node01 conf]# ll
total 32
drwxr-xr-x. 2 root root 118 Feb 22 00:25 2m-2s-async
drwxr-xr-x. 2 root root 118 Feb 22 00:25 2m-2s-sync
drwxr-xr-x. 2 root root 91 Feb 22 00:25 2m-noslave
drwxr-xr-x. 2 root root 27 Feb 22 00:25 acl
-rw-r--r--. 1 root root 949 Feb 22 00:25 broker.conf
drwxr-xr-x. 2 root root 72 Feb 22 00:25 dledger
-rw-r--r--. 1 root root 15362 Feb 22 00:25 logback_broker.xml
-rw-r--r--. 1 root root 3836 Feb 22 00:25 logback_namesrv.xml
-rw-r--r--. 1 root root 3761 Feb 22 00:25 logback_tools.xml
-rw-r--r--. 1 root root 834 Feb 22 00:25 tools.yml
[root@node01 conf]# cp -r 2m-2s-sync/ 22ms-sync-bak
[root@node01 conf]# ll
total 32
drwxr-xr-x. 2 root root 118 Jun 14 14:28 22ms-sync-bak
drwxr-xr-x. 2 root root 118 Feb 22 00:25 2m-2s-async
drwxr-xr-x. 2 root root 118 Feb 22 00:25 2m-2s-sync
drwxr-xr-x. 2 root root 91 Feb 22 00:25 2m-noslave
drwxr-xr-x. 2 root root 27 Feb 22 00:25 acl
-rw-r--r--. 1 root root 949 Feb 22 00:25 broker.conf
drwxr-xr-x. 2 root root 72 Feb 22 00:25 dledger
-rw-r--r--. 1 root root 15362 Feb 22 00:25 logback_broker.xml
-rw-r--r--. 1 root root 3836 Feb 22 00:25 logback_namesrv.xml
-rw-r--r--. 1 root root 3761 Feb 22 00:25 logback_tools.xml
-rw-r--r--. 1 root root 834 Feb 22 00:25 tools.yml
[root@node01 conf]# cd 22ms-sync-bak/
[root@node01 22ms-sync-bak]# ll
total 16
-rw-r--r--. 1 root root 928 Jun 14 14:28 broker-a.properties
-rw-r--r--. 1 root root 922 Jun 14 14:28 broker-a-s.properties
-rw-r--r--. 1 root root 928 Jun 14 14:28 broker-b.properties
-rw-r--r--. 1 root root 922 Jun 14 14:28 broker-b-s.properties
- brokerClusterName=DefaultCluster
- #这个要主从一致
- brokerName=broker-a
- #master是0,slave是>0的
- brokerId=0
- deleteWhen=04
- fileReservedTime=48
- # SYNC_MASTER,ASYNC_MASTER, SLAVE
- brokerRole=SYNC_MASTER
- # 降低机器的磁盘的IO瓶颈
- flushDiskType=ASYNC_FLUSH
- namesrvAddr=192.168.56.200:9876;192.168.56.201:9876;192.168.56.202:9876;
- storePathRootDir=/var/rocketmq/store
- storePathCommitLog=/var/rocketmq/store/commitlog
- storePathIndex=/var/rocketmq/store/index
- storePathConsumeQueue=/var/rocketmq/store/consumequeue
[root@node01 22ms-sync-bak]# vi broker-a.properties
[root@node01 22ms-sync-bak]# vi broker-a-s.properties
[root@node01 22ms-sync-bak]# vi broker-b.properties
[root@node01 22ms-sync-bak]# vi broker-b-s.properties
[root@node01 22ms-sync-bak]# pwd
/soft/rocketmq-4.9.3/conf/22ms-sync-bak
[root@node01 22ms-sync-bak]# cd /soft/rocketmq-4.9.3/conf
[root@node01 conf]# grep user.home ./*
grep: ./22ms-sync-bak: Is a directory
grep: ./2m-2s-async: Is a directory
grep: ./2m-2s-sync: Is a directory
grep: ./2m-noslave: Is a directory
grep: ./acl: Is a directory
grep: ./dledger: Is a directory
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/broker_default.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/broker_default.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/broker.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/broker.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/protection.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/protection.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/watermark.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/watermark.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/store.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/store.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/remoting.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/remoting.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/storeerror.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/storeerror.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/transaction.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/transaction.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/lock.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/lock.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/filter.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/filter.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/stats.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/stats.%i.log.gz</fileNamePattern>
./logback_broker.xml: <file>${user.home}/logs/rocketmqlogs/${brokerLogDir}/commercial.log</file>
./logback_broker.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/${brokerLogDir}/commercial.%i.log.gz</fileNamePattern>
./logback_namesrv.xml: <file>${user.home}/logs/rocketmqlogs/namesrv_default.log</file>
./logback_namesrv.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/namesrv_default.%i.log.gz</fileNamePattern>
./logback_namesrv.xml: <file>${user.home}/logs/rocketmqlogs/namesrv.log</file>
./logback_namesrv.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/namesrv.%i.log.gz</fileNamePattern>
./logback_tools.xml: <file>${user.home}/logs/rocketmqlogs/tools_default.log</file>
./logback_tools.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/tools_default.%i.log.gz</fileNamePattern>
./logback_tools.xml: <file>${user.home}/logs/rocketmqlogs/tools.log</file>
./logback_tools.xml: <fileNamePattern>${user.home}/logs/rocketmqlogs/otherdays/tools.%i.log.gz</fileNamePattern>
[root@node01 conf]# sed -i 's#${user.home}#/var/rocketmq#g' *.xml
[root@node01 conf]# grep user.home ./*
grep: ./22ms-sync-bak: Is a directory
grep: ./2m-2s-async: Is a directory
grep: ./2m-2s-sync: Is a directory
grep: ./2m-noslave: Is a directory
grep: ./acl: Is a directory
grep: ./dledger: Is a directory
[root@node01 conf]# cd /soft/rocketmq-4.9.3/bin
- nameserver:
- node01~node03
- broker
- node01~node02 broker-a 0,1 master slave
- node01:
- mqbroker -c /soft/rocketmq-4.9.3/conf/22ms-sync-bak/broker-a.properties
- node02:
- mqbroker -c /soft/rocketmq-4.9.3/conf/22ms-sync-bak/broker-a-s.properties
- node03~node04 broker-b 0,1 master slave
- node03:
- mqbroker -c /soft/rocketmq-4.9.3/conf/22ms-sync-bak/broker-b.properties
- node04:
- mqbroker -c /soft/rocketmq-4.9.3/conf/22ms-sync-bak/broker-b-s.properties
brokerRole=SYNC_MASTER | ASYNC_MASTER
message.setWaitStoreMsgOK(true);
SYNC_MASTER: producer send 到 master后,master同步给slave,然后给producer返回ok
ASYNC_MASTER: producer send 到 master后,master异步给slave,并给producer返回ok
message.setWaitStoreMsgOK(false);
集群也是该sync,或者async的同步形式,只不过ok不需要等了
不只解决自己生产消息的事务能力 ---> 一批操作
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。