【问题标题】:Wildfly, restart server groupWildfly,重启服务器组
【发布时间】:2018-03-01 21:45:41
【问题描述】:

我需要使用 HTTP API 重新启动服务器组。我不知道正确的语法是什么。

我尝试了很多

HashMap<String, Object> requestMap = new HashMap<>();
requestMap.put("operation", "something-something");
requestMap.put("address", "something-something");

final Response response = managementContext
    .request()
    .header("X-Requested-By", WildflyUtils.class.getName())
    .post(Entity.json(requestMap));

或“手工”:

{"operation":"something-something", "address":"something-something",  "json.pretty":1}

我在猜测。有人知道哪个命令最好,地址的正确语法是什么,或者 HTTP API 的有用文档在哪里?官方文档(https://docs.jboss.org/author/display/WFLY10/The+HTTP+management+API)有点小。

【问题讨论】:

    标签: rest http wildfly


    【解决方案1】:

    我不知道它是否有帮助,但我尝试了 curl:

    curl --digest -u "username:password" 'http://localhost:9990/management' --header "Content-Type: application/json" -d '{"operation":"restart-servers","address":[{"server-group":"your_server_group"}]}'
    

    独立:

    curl --digest -u "username:password" 'http://localhost:9990/management' --header "Content-Type: application/json" -d '{"operation":"reload","address":[]}'
    

    【讨论】:

      【解决方案2】:

      你应该看看WildFly 11.0 Model Reference,不过这恐怕不包括域模式。

      我有一个小演示代码here。在您的情况下,您应该这样做:

      requestMap.put("address", "[\"server-group",\"myServerGroup\"]");
      requestMap.put("operation", "restart-servers");
      requestMap.put("blocking", "true/false");
      requestMap.put("start-mode", "normal/suspend");
      

      【讨论】:

        猜你喜欢
        • 2020-12-07
        • 2015-01-20
        • 2020-03-02
        • 1970-01-01
        • 2017-02-12
        • 2016-10-06
        • 2022-07-07
        • 2015-01-16
        • 2016-05-16
        相关资源
        最近更新 更多