Skip to content

Commit bae016a

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 61c399e commit bae016a

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
@@ -197,6 +197,11 @@ impl CommandExecute for ClassificationTablePrint {
197197
command: "switchTimerEngine",
198198
remark: "Switch the engine of timer message in broker.",
199199
},
200+
Command {
201+
category: "Broker",
202+
command: "updateBrokerConfig",
203+
remark: "Update broker config by broker or cluster.",
204+
},
200205
Command {
201206
category: "Consumer",
202207
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
@@ -17,6 +17,7 @@ mod clean_unused_topic_command;
1717
mod get_broker_config_sub_command;
1818
mod send_msg_status_command;
1919
mod switch_timer_engine_sub_command;
20+
mod update_broker_config_sub_command;
2021

2122
use std::sync::Arc;
2223

@@ -29,6 +30,7 @@ use crate::commands::broker_commands::clean_unused_topic_command::CleanUnusedTop
2930
use crate::commands::broker_commands::get_broker_config_sub_command::GetBrokerConfigSubCommand;
3031
use crate::commands::broker_commands::send_msg_status_command::SendMsgStatusCommand;
3132
use crate::commands::broker_commands::switch_timer_engine_sub_command::SwitchTimerEngineSubCommand;
33+
use crate::commands::broker_commands::update_broker_config_sub_command::UpdateBrokerConfigSubCommand;
3234
use crate::commands::CommandExecute;
3335

3436
#[derive(Subcommand)]
@@ -67,6 +69,13 @@ pub enum BrokerCommands {
6769
long_about = None,
6870
)]
6971
SwitchTimerEngine(SwitchTimerEngineSubCommand),
72+
73+
#[command(
74+
name = "updateBrokerConfig",
75+
about = "Update broker config by special broker or all brokers in cluster.",
76+
long_about = None,
77+
)]
78+
UpdateBrokerConfigSubCommand(UpdateBrokerConfigSubCommand),
7079
}
7180

7281
impl CommandExecute for BrokerCommands {
@@ -77,6 +86,7 @@ impl CommandExecute for BrokerCommands {
7786
BrokerCommands::GetBrokerConfigSubCommand(cmd) => cmd.execute(rpc_hook).await,
7887
BrokerCommands::SendMsgStatus(value) => value.execute(rpc_hook).await,
7988
BrokerCommands::SwitchTimerEngine(value) => value.execute(rpc_hook).await,
89+
BrokerCommands::UpdateBrokerConfigSubCommand(cmd) => cmd.execute(rpc_hook).await,
8090
}
8191
}
8292
}

0 commit comments

Comments
 (0)