官术网_书友最值得收藏!

  • WildFly Cookbook
  • Luigi Fugaro
  • 276字
  • 2021-07-16 13:38:15

Checking the server-state via the CLI

In this recipe, we will learn how to check the server status. WildFly may have different status depending on its phase: starting, stopping, started, and stopped. Sometimes, just checking its status at the OS level by looking for its process might not be enough.

Getting ready

As the CLI is a management tool, you will need to have your WildFly instance up and running. Also for this recipe, we will rely on the default standalone configuration.

Open a terminal window and start WildFly:

$ cd $WILDFLY_HOME
$ ./bin/standalone.sh
...
22:12:23,600 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.0.Beta2 (WildFly Core 1.0.0.Beta2) started in 3226ms - Started 202 of 379 services (210 services are lazy, passive or on-demand)

How to do it…

In a new terminal window, type in the following:

$ ./bin/jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
[standalone@localhost:9990 /] :read-attribute(name=server-state)
{
    "outcome" => "success",
    "result" => "running"
}
[standalone@localhost:9990 /]

How it works…

As you connect to the host-controller, you are just in the root of your configuration. Thus, you can invoke an operation on it, and to do that, you need to start with the : (colon) symbol.

In our example we used the read-attribute method, but you could have any of the available ones. To see them is as easy as hitting the Tab key right after the colon symbol, as follows:

Getting back to our server state, we received two responses: one saying that our invocation was successful, and the second one reporting the result, running.

主站蜘蛛池模板: 兖州市| 长岭县| 泰顺县| 岳阳市| 澜沧| 肥乡县| 揭东县| 呼伦贝尔市| 克东县| 水城县| 新建县| 阿克陶县| 上犹县| 南澳县| 时尚| 五华县| 怀柔区| 峨山| 钟山县| 大连市| 富蕴县| 綦江县| 年辖:市辖区| 丘北县| 贺州市| 准格尔旗| 饶阳县| 曲松县| 营山县| 界首市| 宁阳县| 柏乡县| 北海市| 肇东市| 江华| 武清区| 蓬莱市| 琼结县| 循化| 泰来县| 昭通市|