动态加载配置
Ozone支持在不重启服务的情况下动态加载某些配置。如果某个属性支持热加载,就可以先在配置文件(ozone-site.xml
)中修改它然后调用命令使之刷新到内存。
命令:
ozone admin reconfig --address=<ip:port> start|status|properties
命令项的含义:
- –address: 一台服务所在的主机与客户端通信的RPC地址
- 提供3中操作:
- start: 开始异步执行动态加载配置
- status: 查看最近一次动态加载的状态
- properties: 列出支持动态加载的配置项
获取可动态加载的属性列表
要获取 Ozone 中指定组件的可动态加载属性列表, 可以使用命令 ozone admin reconfig --address=<ip:port> properties
。 这个命令将会列出所有可以在运行时动态加载的属性。
例如, 获取 Ozone OM 可动态加载属性列表
$
ozone admin reconfig --address=hadoop1:9862 properties
OM: Node [hadoop1:9862] Reconfigurable properties:
ozone.administrators
OM动态配置
例如, 在
ozone-site.xml
文件中修改ozone.administrators
的值并执行:$
ozone admin reconfig --address=hadoop1:9862 start
OM: Started reconfiguration task on node [hadoop1:9862].$
ozone admin reconfig --address=hadoop1:9862 status
OM: Reconfiguring status for node [hadoop1:9862]: started at Wed Dec 28 19:04:44 CST 2022 and finished at Wed Dec 28 19:04:44 CST 2022.
SUCCESS: Changed property ozone.administrators
From: “hadoop”
To: “hadoop,bigdata”$
ozone admin reconfig --address=hadoop1:9862 properties
OM: Node [hadoop1:9862] Reconfigurable properties:
ozone.administrators
SCM动态配置
例如, 在
ozone-site.xml
文件中修改ozone.administrators
的值并执行:$
ozone admin reconfig --address=hadoop1:9860 start
SCM: Started reconfiguration task on node [hadoop1:9860].$
ozone admin reconfig --address=hadoop1:9860 status
SCM: Reconfiguring status for node [hadoop1:9860]: started at Wed Dec 28 19:04:44 CST 2022 and finished at Wed Dec 28 19:04:44 CST 2022.
SUCCESS: Changed property ozone.administrators
From: “hadoop”
To: “hadoop,bigdata”$
ozone admin reconfig --address=hadoop1:9860 properties
SCM: Node [hadoop1:9860] Reconfigurable properties:
ozone.administrators
Datanode 动态配置
例如, 在
ozone-site.xml
文件中修改ozone.example.config
的值并执行:$
ozone admin reconfig --address=hadoop1:19864 start
Datanode: Started reconfiguration task on node [hadoop1:19864].$
ozone admin reconfig --address=hadoop1:19864 status
Datanode: Reconfiguring status for node [hadoop1:19864]: started at Wed Dec 28 19:04:44 CST 2022 and finished at Wed Dec 28 19:04:44 CST 2022.
SUCCESS: Changed property ozone.example.config
From: “old”
To: “new”$
ozone admin reconfig --address=hadoop1:19864 properties
Datanode: Node [hadoop1:19864] Reconfigurable properties:
ozone.example.config
批量操作
如果要对 Datanode 执行批操作,你可以设置 --in-service-datanodes
标志. 这将向所有 operational state 为 “IN_SERVICE” 的可用 Datanode 发送 reconfig 请求。
目前只有 Datanode 支持批量操作
例如, 列出 Datanode 所有可配置的属性:
$ozone admin reconfig --in-service-datanodes properties
Datanode: Node [hadoop1:19864] Reconfigurable properties:
ozone.example.config
Datanode: Node [hadoop2:19864] Reconfigurable properties:
ozone.example.config
Datanode: Node [hadoop3:19864] Reconfigurable properties:
ozone.example.config
Reconfig successfully 3 nodes, failure 0 nodes.