-
Notifications
You must be signed in to change notification settings - Fork 73
[ISSUE #305]feat: Introduce Standalone Mode by Allowing Meta Module Disabling #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HeartLinked
wants to merge
11
commits into
apache:main
Choose a base branch
from
HeartLinked:dev_disable_meta
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
877fd70
add config and basic will
HeartLinked 8c3da0c
add will close
HeartLinked 09a4d6d
fixed most of the notifymanager
HeartLinked 7751747
fixed the notifymanager(todo: test
HeartLinked 84e0940
add local address
HeartLinked 73ce8ed
format
HeartLinked 682c066
revert
HeartLinked 23fb0bc
v1.0(no test
HeartLinked 7de89ef
modify readme
HeartLinked 6d25d59
remove connectconf
HeartLinked 500cd24
modify readme
HeartLinked File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,14 @@ For example, set the following parameters to true in broker.conf | |
| enableLmq = true | ||
| enableMultiDispatch = true | ||
| ``` | ||
|
|
||
| ### Deployment Modes | ||
| RocketMQ-MQTT supports two deployment modes: | ||
|
|
||
| + Cluster-Ready Mode (Meta Enabled, Default): This is the default and full-featured mode. It relies on a meta service (based on RocketMQ's KV storage) for dynamic configuration, cluster node discovery, and advanced features like Retain Messages and Will Messages. This mode is suitable for production and high-availability environments. | ||
|
|
||
| + Standalone Mode (Meta Disabled): This is a simplified mode designed for single-node deployments or scenarios where advanced features are not required. It operates without any dependency on the meta service, making configuration and deployment much simpler. In this mode, features like Retain Messages and Will Messages are disabled. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mqtt proxy is still deployed in a cluster |
||
|
|
||
| ### Build Requirements | ||
| The current project requires JDK 1.8.x. When building on MAC arm64 the recommended JDK 1.8 must be based on 386 architecture or use Maven flag `-Dos.arch=x86_64` when building with Maven. | ||
|
|
||
|
|
@@ -43,15 +51,17 @@ cd conf | |
| ``` | ||
| Some important configuration items in the **service.conf** configuration file | ||
|
|
||
| | **Config Key** | **Instruction** | | ||
| |-----------------------|---------------------------------------------------------------| | ||
| | username | used for auth | | ||
| | secretKey | used for auth | | ||
| | NAMESRV_ADDR | specify namesrv address | | ||
| | eventNotifyRetryTopic | notify event retry topic | | ||
| | clientRetryTopic | client retry topic | | ||
| | metaAddr | meta all nodes ip:port. Same as membersAddress in meta.config | | ||
|
|
||
| | **Config Key** | **Instruction** | | ||
| |-----------------------|----------------------------------------------------------------------------------------------------------------------------------| | ||
| | username | used for auth | | ||
| | secretKey | used for auth | | ||
| | NAMESRV_ADDR | specify namesrv address | | ||
| | eventNotifyRetryTopic | notify event retry topic | | ||
| | clientRetryTopic | client retry topic | | ||
| | enableMetaModule | (Optional) Switch for meta module. Defaults to true. Set to `false` to enable Standalone Mode. | | ||
| | metaAddr | meta all nodes ip:port. Same as membersAddress in meta.config. **Required when `enableMetaModule` is `true`.** | | ||
| | staticFirstTopics | A comma-separated list of all first-level MQTT topics. E.g., `chat,iot`. **Required when `enableMetaModule` is `false`.** | | ||
| | localAddress | The address for the server's internal RPC loopback. `127.0.0.1` is recommended. **Required when `enableMetaModule` is `false`.** | | ||
|
|
||
| And some configuration items in the **meta.conf** configuration file | ||
|
|
||
|
|
@@ -80,6 +90,7 @@ sh mqadmin updateKvConfig -s LMQ -k ALL_FIRST_TOPICS -v {topic1,topic2} -n {name | |
| sh mqadmin updateKvConfig -s LMQ -k {topic} -v {topic/+} -n {namesrv} | ||
| ``` | ||
| 6. Start Process | ||
| Note: In standalone mode, Only mqtt.sh is needed to start. | ||
| ```shell | ||
| cd bin | ||
| sh meta.sh start | ||
|
|
||
26 changes: 26 additions & 0 deletions
26
mqtt-common/src/main/java/org/apache/rocketmq/mqtt/common/model/MqttRetainException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| package org.apache.rocketmq.mqtt.common.model; | ||
|
|
||
| public class MqttRetainException extends RuntimeException { | ||
| public MqttRetainException() { } | ||
|
|
||
| public MqttRetainException(String message) { | ||
| super(message); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,10 @@ public class ServiceConf { | |
| private String metaAddr; | ||
| private long retainMsgExpire = 3 * 24 * 60 * 60 * 1000L; | ||
|
|
||
| private boolean enableMetaModule = true; | ||
| private String staticFirstTopics; | ||
| private String localAddress; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need staticFirstTopics and localAddress? |
||
|
|
||
| @PostConstruct | ||
| public void init() throws IOException { | ||
| ClassPathResource classPathResource = new ClassPathResource(CONF_FILE_NAME); | ||
|
|
@@ -62,8 +66,17 @@ public void init() throws IOException { | |
| if (StringUtils.isBlank(eventNotifyRetryTopic)) { | ||
| throw new RemoteException("eventNotifyRetryTopic is blank"); | ||
| } | ||
| if (StringUtils.isBlank(metaAddr)) { | ||
| throw new RemoteException("metaAddr is blank"); | ||
| if (this.enableMetaModule) { | ||
| if (StringUtils.isBlank(metaAddr)) { | ||
| throw new IOException("metaAddr is blank when meta module is enabled"); | ||
| } | ||
| } else { | ||
| if (StringUtils.isBlank(staticFirstTopics)) { | ||
| throw new IOException("When meta module is disabled, staticFirstTopics cannot be blank."); | ||
| } | ||
| if (StringUtils.isBlank(localAddress)) { | ||
| throw new IOException("When meta module is disabled, localAddress cannnot be blank."); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -158,4 +171,28 @@ public long getRetainMsgExpire() { | |
| public void setRetainMsgExpire(long retainMsgExpire) { | ||
| this.retainMsgExpire = retainMsgExpire; | ||
| } | ||
|
|
||
| public String getStaticFirstTopics() { | ||
| return staticFirstTopics; | ||
| } | ||
|
|
||
| public void setStaticFirstTopics(String staticFirstTopics) { | ||
| this.staticFirstTopics = staticFirstTopics; | ||
| } | ||
|
|
||
| public boolean isEnableMetaModule() { | ||
| return enableMetaModule; | ||
| } | ||
|
|
||
| public void setEnableMetaModule(boolean enableMetaModule) { | ||
| this.enableMetaModule = enableMetaModule; | ||
| } | ||
|
|
||
| public String getLocalAddress() { | ||
| return localAddress; | ||
| } | ||
|
|
||
| public void setLocalAddress(String localAddress) { | ||
| this.localAddress = localAddress; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can't be called a deployment mode.