Skip to content

Commit 40f3df4

Browse files
committed
refactor: support specify the broker IP (robustmq#1565)
1 parent 9701e2e commit 40f3df4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/broker-core/src/cluster.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ impl ClusterStorage {
6969
cache_manager: &Arc<BrokerCacheManager>,
7070
config: &BrokerConfig,
7171
) -> Result<BrokerNode, CommonError> {
72-
let local_ip = get_local_ip();
72+
let local_ip = config.broker_ip.clone()
73+
.unwrap_or_else(|| get_local_ip());
7374
let extend = NodeExtend {
7475
mqtt: MqttNodeExtend {
7576
grpc_addr: format!("{}:{}", local_ip, config.grpc_port),

src/common/config/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ pub struct BrokerConfig {
3939
#[serde(default = "default_broker_id")]
4040
pub broker_id: u64,
4141

42+
#[serde(default)]
43+
pub broker_ip: Option<String>,
44+
4245
#[serde(default = "default_roles")]
4346
pub roles: Vec<String>,
4447

0 commit comments

Comments
 (0)