Skip to content

Commit 7df29b2

Browse files
committed
ISSUE #6264: Add updateBrokerConfig admin command
Introduce a broker admin subcommand for updating broker configuration on one broker or across an entire cluster. Allow either a single key/value pair or multiple KEY=VALUE entries so operators can apply related config changes in one operation. Validate inputs before applying updates, including empty-value checks and compatibility checks against existing value types, to reduce avoidable misconfiguration risk. Show old and new values per broker before execution for safer change confirmation, and add rollback support for partial failures to preserve cluster consistency.
1 parent 1f8ec58 commit 7df29b2

File tree

4 files changed

+708
-0
lines changed

4 files changed

+708
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- **feat(tools):** Add `broker` command group with `GetBrokerConfigSubCommand` for querying broker configuration by broker address or cluster, with optional `--keyPattern` regex filtering
1313
- **feat(tools):** Add `CleanExpiredCQSubCommand` under broker commands with broker/cluster/topic target scan, dry-run preview, and cleanup summary reporting
14+
- **feat(tools):** Add `UpdateBrokerConfigSubCommand` under broker commands with single/multi key updates, value validation, broker or cluster targeting, old/new diff display, and rollback on partial failures
1415
- **test(remoting):** Add comprehensive test coverage for `GetMaxOffsetRequestHeader` including required fields, optional nested headers, trait implementation methods, and edge cases
1516
- **feat(tools):** Add `SetConsumeModeSubCommand` for setting consumer group consumption mode (PULL/POP) ([#5650](https://github.com/mxsm/rocketmq-rust/issues/5650))
1617
- **feat(tools):** Add `ListAclSubCommand` for ACL enumeration and subject filtering ([#5663](https://github.com/mxsm/rocketmq-rust/issues/5663))

rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ impl CommandExecute for ClassificationTablePrint {
212212
command: "switchTimerEngine",
213213
remark: "Switch the engine of timer message in broker.",
214214
},
215+
Command {
216+
category: "Broker",
217+
command: "updateBrokerConfig",
218+
remark: "Update broker config by broker or cluster.",
219+
},
215220
Command {
216221
category: "Consumer",
217222
command: "consumerStatus",

rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/broker_commands.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mod get_broker_config_sub_command;
1919
mod reset_master_flush_offset_sub_command;
2020
mod send_msg_status_sub_command;
2121
mod switch_timer_engine_sub_command;
22+
mod update_broker_config_sub_command;
2223
mod update_cold_data_flow_ctr_group_config_sub_command;
2324

2425
use std::sync::Arc;
@@ -34,6 +35,7 @@ use crate::commands::broker_commands::get_broker_config_sub_command::GetBrokerCo
3435
use crate::commands::broker_commands::reset_master_flush_offset_sub_command::ResetMasterFlushOffsetSubCommand;
3536
use crate::commands::broker_commands::send_msg_status_sub_command::SendMsgStatusSubCommand;
3637
use crate::commands::broker_commands::switch_timer_engine_sub_command::SwitchTimerEngineSubCommand;
38+
use crate::commands::broker_commands::update_broker_config_sub_command::UpdateBrokerConfigSubCommand;
3739
use crate::commands::broker_commands::update_cold_data_flow_ctr_group_config_sub_command::UpdateColdDataFlowCtrGroupConfigSubCommand;
3840
use crate::commands::CommandExecute;
3941

@@ -94,6 +96,13 @@ pub enum BrokerCommands {
9496
long_about = None,
9597
)]
9698
UpdateColdDataFlowCtrGroupConfig(UpdateColdDataFlowCtrGroupConfigSubCommand),
99+
100+
#[command(
101+
name = "updateBrokerConfig",
102+
about = "Update broker config by special broker or all brokers in cluster.",
103+
long_about = None,
104+
)]
105+
UpdateBrokerConfigSubCommand(UpdateBrokerConfigSubCommand),
97106
}
98107

99108
impl CommandExecute for BrokerCommands {
@@ -107,6 +116,7 @@ impl CommandExecute for BrokerCommands {
107116
BrokerCommands::SendMsgStatus(value) => value.execute(rpc_hook).await,
108117
BrokerCommands::SwitchTimerEngine(value) => value.execute(rpc_hook).await,
109118
BrokerCommands::UpdateColdDataFlowCtrGroupConfig(value) => value.execute(rpc_hook).await,
119+
BrokerCommands::UpdateBrokerConfigSubCommand(cmd) => cmd.execute(rpc_hook).await,
110120
}
111121
}
112122
}

0 commit comments

Comments
 (0)