3.6.10. 使用管理 CLI 配置属性

介绍

write-attribute 操作是用来写入或修改资源属性的全局操作。您可以使用这个操作来进行持久性修改并修改管理的服务器实例的配置设置。请求属性包含下列参数。

请求属性

name
需要设置值的所选资源属性的名称。
value
所选资源里属性的值。如果底层模型支持 null 值的话可以为 null。

过程 3.21. 使用管理 CLI 配置资源属性

  • 运行 write-attribute 操作

    在管理 CLI 里,使用 write-attribute 操作修改资源属性的值。这个擦作可以运行在资源的子节点或管理 CLI 的根节点上(指定完整资源路径)。

例 3.16. 用 write-attribute 操作禁用部署扫描器。

下面的例子使用了 write-attribute 操作来禁用部署扫描器。这个操作从根节点运行,使用 Tab Completion 来协助填充正确的资源路径。
[standalone@localhost:9999 /] /subsystem=deployment-scanner/scanner=default:write-attribute(name=scan-enabled,value=false)
{"outcome" => "success"}

操作的结果可以直接用 read-attribute 操作确认。
[standalone@localhost:9999 /] /subsystem=deployment-scanner/scanner=default:read-attribute(name=scan-enabled)
{
    "outcome" => "success",
    "result" => false
}

read-resource 操作列出节点的所有可用资源属性可以确认资源。在下列例子里,这个特定的配置展示了 scan-enabled 属性被设置为 false
[standalone@localhost:9999 /] /subsystem=deployment-scanner/scanner=default:read-resource                                 
{
    "outcome" => "success",
    "result" => {
        "auto-deploy-exploded" => false,
        "auto-deploy-xml" => true,
        "auto-deploy-zipped" => true,
        "deployment-timeout" => 600,
        "path" => "deployments",
        "relative-to" => "jboss.server.base.dir",
        "scan-enabled" => false,
        "scan-interval" => 5000
    }
}

结果

更新了资源属性