ããã¯ããªã«ãããããŠæžãããã®ïŒ
WildFlyã®ãã¡ã€ã³ã¢ãŒãã§ãèªåã§ãµãŒããŒã°ã«ãŒããšãµãŒããŒãè¿œå ããããšããŠãé©åœã«ãã£ãŠãããã¡ãã£ãš
ããã£ãã®ã§ã¡ãããšç¢ºèªããŠãããããªãšæããŸããŠã
WildFlyã®ãã¡ã€ã³ã¢ãŒã
WildFlyã«ã¯ã2ã€ã®åäœã¢ãŒããããã¹ã¿ã³ãã¢ãã³ã¢ãŒããšãã¡ã€ã³ã¢ãŒãããããŸãã
ãµã ãã¯ã¹ã¿ã³ãã¢ãã³ã¢ãŒããã䜿ã£ãŠããªããã§ããã©ãã
ãã¡ã€ã³ã¢ãŒãã«ã€ããŠã¯ããã¡ãã
ãã¡ã€ã³ã¢ãŒãã«ã¯ã以äžã®æ§æèŠçŽ ããããŸãã
- ãã¡ã€ã³ã³ã³ãããŒã©ãŒ
- ãã¡ã€ã³ãå¶åŸ¡ãã圹å²ãæã¡ããã¹ãã³ã³ãããŒã©ãŒã§ããã
- ãã¹ãã³ã³ãããŒã©ãŒ
- ãã¡ã€ã³ã³ã³ãããŒã©ãŒãšå¯Ÿè©±ããŠããã¹ãäžã§å®è¡ãããŠãããµãŒããŒã€ã³ã¹ã¿ã³ã¹ã管çãã
- ãµãŒããŒã°ã«ãŒã
- ãµãŒããŒã€ã³ã¹ã¿ã³ã¹ã®éåã§ãèšå®ã¯ãã®ã°ã«ãŒãåäœã§ç®¡çããã
- ãµãŒããŒ
ãããããåãã¹ãäžã§åäœããŸãã
ãã®çšèªã®èª¬æã¯ãJBoss EAPã®ããã¥ã¡ã³ããèŠãæ¹ãããããããæ°ãããŸããã
第8章 ドメイン管理 7.4 | Red Hat Customer Portal
ä»åã¯ããã¡ã€ã³ã¢ãŒãã§åäœããWildFlyã«èªåã§ãµãŒããŒã°ã«ãŒãããµãŒããŒãè¿œå ããŠã¿ãããšæããŸãã
ç°å¢
ä»åã®ç°å¢ã¯ããã¡ãã§ãã
$ java --version openjdk 11.0.11 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing) $ mvn --version Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: $HOME/.sdkman/candidates/maven/current Java version: 11.0.11, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: ja_JP, platform encoding: UTF-8 OS name: "linux", version: "5.4.0-80-generic", arch: "amd64", family: "unix"
WildFlyã¯ã24.0.0.Finalã䜿ããŸãã
$ curl -OL https://download.jboss.org/wildfly/24.0.0.Final/wildfly-24.0.0.Final.zip $ unzip wildfly-24.0.0.Final.zip $ cd wildfly-24.0.0.Final
ããã©ã«ãã®æ§æãã¡ã€ã«ã§ãã¡ã€ã³ã¢ãŒããèµ·åãã
ãã¡ã€ã³ã¢ãŒãã§èµ·åããéã«ã¯bin/domain.sh
ã§WildFlyãèµ·åããã®ã§ããããã®æã«--host-config
ãªãã·ã§ã³ã§
ãã¹ãã®æ§æãã¡ã€ã«ãæå®ããå¿
èŠããããŸãã
Managed Domain Configuration Files
ããã©ã«ãïŒæªæå®ïŒã®å Žåã¯ãhost.xml
ãéžæãããŸãã
$ bin/domain.sh
管çCLIã§ãã°ã€ã³ãããš
$ bin/jboss-cli.sh -c [domain@localhost:9990 /]
2ã€ã®ãµãŒããŒã°ã«ãŒããš3ã€ã®ãµãŒããŒããããŸãã
[domain@localhost:9990 /] ls -l /server-group main-server-group other-server-group [domain@localhost:9990 /] ls -l /host=master/server-config server-one server-three server-two
ãã£ãããå
šéšåé€ããŠã¿ãŸããããæåã«ãµãŒããŒãæ¢ããŠïŒserver-three
ã¯ããã©ã«ãã§ã¯èµ·åããªãããã§ãïŒã
åé€ã
[domain@localhost:9990 /] /host=master/server=server-one:stop() [domain@localhost:9990 /] /host=master/server-config=server-one:remove() [domain@localhost:9990 /] /host=master/server=server-two:stop() [domain@localhost:9990 /] /host=master/server-config=server-two:remove() [domain@localhost:9990 /] /host=master/server-config=server-three:remove()
ãµãŒããŒãåé€ãããšããµãŒããŒã°ã«ãŒããåé€ã§ããããã«ãªããŸãã
[domain@localhost:9990 /] /server-group=main-server-group:remove() [domain@localhost:9990 /] /server-group=other-server-group:remove()
次ã«ãèªåã§ãµãŒããŒã°ã«ãŒããè¿œå ããŠã¿ãŸãã
[domain@localhost:9990 /] /server-group=server-group1:add(profile=default,socket-binding-group=standard-sockets) [domain@localhost:9990 /] /server-group=server-group2:add(profile=default,socket-binding-group=standard-sockets)
è¿œå ãããµãŒããŒã°ã«ãŒãã«ããµãŒããŒãäœæããŠå²ãåœãŠãŸããããŒãã®ãªãã»ããã¯ã2ã€ç®ä»¥éã¯100ãã€
ããããŠãããŸãã
[domain@localhost:9990 /] /host=master/server-config=server1-1:add(group=server-group1) [domain@localhost:9990 /] /host=master/server-config=server1-2:add(group=server-group1,socket-binding-port-offset=100) [domain@localhost:9990 /] /host=master/server-config=server2-1:add(group=server-group2,socket-binding-port-offset=200)
ãµãŒããŒãèµ·åã
[domain@localhost:9990 /] /host=master/server=server1-1:start() [domain@localhost:9990 /] /host=master/server=server1-2:start() [domain@localhost:9990 /] /host=master/server=server2-1:start()
ã¢ããªã±ãŒã·ã§ã³ããããã€ããŠã¿ãŸããäž¡æ¹ã®ãµãŒããŒã°ã«ãŒãã«ãããã€ããããšæãã®ã§--all-server-groups
ã
䜿ã£ãŠãããã®ã§ãããä»åã¯æåã«ã²ãšã€ã®ãµãŒããŒã°ã«ãŒãã«ãããã€ããŠã次ã«å¥ã®ãµãŒããŒã°ã«ãŒãã«ã
ãããã€ã¡ã³ããå²ãåœãŠãããšããæ¹æ³ã§ãã£ãŠã¿ãŸãã
[domain@localhost:9990 /] deploy /path/to/target/ROOT.war --server-groups=server-group1 [domain@localhost:9990 /] deployment enable ROOT.war --server-groups=server-group2
ãããã€ããã¢ããªã±ãŒã·ã§ã³èªäœã¯ãæåŸã«ç°¡åã«èŒããŸããããã§ã¯ã/hello
ã«HTTP GETã§ã¢ã¯ã»ã¹ãããš
Hello World!!
ãšè¿ã£ãŠãããã®ãåäœãããã®ãšããŠãã ããã
確èªã
$ curl localhost:8080/hello Hello World!! $ curl localhost:8180/hello Hello World!! $ curl localhost:8280/hello Hello World!!
OKã§ããã
host-master.xmlã䜿ã
次ã«ãã¡ãã£ãšè©Šãã«ãšhost-master.xml
ã䜿ã£ãŠã¿ãŸãã
â»ãããŸã§ã®æäœã®å
容ã¯ããã£ããåé€ããŠãŸã£ãããªWildFlyã§ããçŽããŠããŸã
host-master.xml
ã®èª¬æãèŠããšãå®ç°å¢ã®ãã¹ã¿ãŒãšãªããã¡ã€ã³ã³ã³ãããŒã©ãŒãæ³å®ããèšå®ãã¡ã€ã«ã®ããã§ãã
Managed Domain Configuration Files
ãšãããããèµ·åããŠã¿ãŸãã
$ bin/domain.sh --host-config=host-master.xml
管çCLIã§æ¥ç¶ã
$ bin/jboss-cli.sh -c [domain@localhost:9990 /]
ãµãŒããŒã°ã«ãŒãã¯ãããŸããããµãŒããŒã®å®çŸ©ã¯ãããŸããã
[domain@localhost:9990 /] ls -l /server-group main-server-group other-server-group [domain@localhost:9990 /] ls -l /host=master/server-config
å
ã»ã©ã®host.xml
ã䜿ã£ãæãšãåãããšãããŠã¿ãŸãããã
ä»ã®ãµãŒããŒã°ã«ãŒããåé€ã
[domain@localhost:9990 /] /server-group=main-server-group:remove() [domain@localhost:9990 /] /server-group=other-server-group:remove()
ãµãŒããŒãšãµãŒããŒã°ã«ãŒããè¿œå ã
[domain@localhost:9990 /] /server-group=server-group1:add(profile=default,socket-binding-group=standard-sockets) [domain@localhost:9990 /] /server-group=server-group2:add(profile=default,socket-binding-group=standard-sockets) [domain@localhost:9990 /] /host=master/server-config=server1-1:add(group=server-group1) [domain@localhost:9990 /] /host=master/server-config=server1-2:add(group=server-group1,socket-binding-port-offset=100) [domain@localhost:9990 /] /host=master/server-config=server2-1:add(group=server-group2,socket-binding-port-offset=200)
ããã§ããµãŒããŒãèµ·åããããšãããš
[domain@localhost:9990 /] /host=master/server=server1-1:start()
ãµãŒããŒã®èµ·åã«å€±æããŸãããã°ãã¡ã€ã«ïŒdomain/servers/server1-1/log/server.log
ïŒãèŠããšããããªæãã«ã
2021-07-23 22:25:06,379 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("socket-binding-group" => "standard-sockets")]) - failure description: { "WFLYCTL0412: Required services that are not installed:" => ["org.wildfly.network.interface.public"], "WFLYCTL0180: Services with missing/unavailable dependencies" => ["org.wildfly.management.socket-binding-manager is missing [org.wildfly.network.interface.public]"] } 2021-07-23 22:25:06,380 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([ ("subsystem" => "remoting"), ("http-connector" => "http-remoting-connector") ]) - failure description: { "WFLYCTL0412: Required services that are not installed:" => ["jboss.http-upgrade-registry.default"], "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.remoting.remoting-http-upgrade-service.http-remoting-connector is missing [jboss.http-upgrade-registry.default]"] } 2021-07-23 22:25:06,382 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("subsystem" => "jca")]) - failure description: { "WFLYCTL0412: Required services that are not installed:" => ["org.wildfly.transactions.global-default-local-provider"], "WFLYCTL0180: Services with missing/unavailable dependencies" => ["org.wildfly.jca.transaction-integration is missing [org.wildfly.transactions.global-default-local-provider]"] } 2021-07-23 22:25:06,384 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([ ("subsystem" => "ejb3"), ("service" => "timer-service"), ("file-data-store" => "default-file-store") ]) - failure description: { "WFLYCTL0412: Required services that are not installed:" => ["org.wildfly.transactions.global-default-local-provider"], "WFLYCTL0180: Services with missing/unavailable dependencies" => ["org.wildfly.ejb3.timer-service.timer-persistence-service.default-file-store is missing [org.wildfly.transactions.global-default-local-provider]"] } 2021-07-23 22:25:06,502 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report WFLYCTL0184: New missing/unsatisfied dependencies: service jboss.http-upgrade-registry.default (missing) dependents: [service jboss.remoting.remoting-http-upgrade-service.http-remoting-connector] service org.wildfly.network.interface.public (missing) dependents: [service org.wildfly.management.socket-binding-manager] service org.wildfly.transactions.global-default-local-provider (missing) dependents: [service org.wildfly.jca.transaction-integration, service org.wildfly.ejb3.timer-service.timer-persistence-service.default-file-store] WFLYCTL0448: 24 additional services are down due to their dependencies being missing or failed
äŸåé¢ä¿ã足ããªãããã§ãã
ããã§ãhost.xml
ãšhost-master.xml
ãæ¯èŒããŠã¿ãŸãã
$ diff domain/configuration/host.xml domain/configuration/host-master.xml 68,70d67 < <interface name="public"> < <inet-address value="${jboss.bind.address:127.0.0.1}"/> < </interface> 82,92d78 < <servers> < <server name="server-one" group="main-server-group"/> < <server name="server-two" group="main-server-group" auto-start="true"> < <jvm name="default"/> < <socket-bindings port-offset="150"/> < </server> < <server name="server-three" group="other-server-group" auto-start="false"> < <jvm name="default"/> < <socket-bindings port-offset="250"/> < </server> < </servers>
ãµãŒããŒã®å®çŸ©ããªãã®ã¯ãããšããŠãinterface
ã®å®çŸ©ããpublic
ãšãããŠãããã®ïŒã®inet-address
ã®å®çŸ©ïŒããããŸããã
確ãã«ãªããããªã®ã§
[domain@localhost:9990 /] ls -l /interface=public ATTRIBUTE VALUE TYPE any undefined OBJECT any-address undefined BOOLEAN inet-address undefined STRING link-local-address undefined BOOLEAN loopback undefined BOOLEAN loopback-address undefined STRING multicast undefined BOOLEAN name public STRING nic undefined STRING nic-match undefined STRING not undefined OBJECT point-to-point undefined BOOLEAN public-address undefined BOOLEAN site-local-address undefined BOOLEAN subnet-match undefined STRING up undefined BOOLEAN virtual undefined BOOLEAN
ãã®ã¯è©Šããšinet-address
ãè¿œå ããŠã¿ãŸãã
[domain@localhost:9990 /] /interface=public:write-attribute(name=inet-address,value="${jboss.bind.address:127.0.0.1}")
ãã¹ããåèµ·åã
[domain@localhost:9990 /] reload --host=master
ãããšãä»åºŠã¯ãµãŒããŒãèµ·åããããã«ãªããŸããä»ã®èšå®ã ãšãauto-start
ãtrue
ã«ãªã£ãŠããã®ã§ãå
šãµãŒããŒã
èµ·åããŠããŸããâŠã
ãããã€ãš
[domain@localhost:9990 /] deploy /path/to/target/ROOT.war --server-groups=server-group1 [domain@localhost:9990 /] deployment enable ROOT.war --server-groups=server-group2
åäœç¢ºèªã
$ curl localhost:8080/hello Hello World!! $ curl localhost:8180/hello Hello World!! $ curl localhost:8280/hello Hello World!!
OKã§ããã
ããŠãèšå®ãå€ãããåããããã§ããããã£ãããšãèšå®ãã¡ã€ã«ã®æå³ãšåããŠããæ°ãããŸãã
ãã¡ãã®èª¬æãèŠãŠãããšããã¡ã€ã³ã³ã³ãããŒã©ãŒã¯ãã¹ãã³ã³ãããŒã©ãŒã§ããããããªã®ã§ããµãŒããŒã°ã«ãŒããš
ãµãŒããŒãè¿œå ãããåããšæã£ãŠããã®ã§ããã
host-master.xml
ã®èª¬æãèŠãŠãããã¡ã€ã³ã³ã³ãããŒã©ãŒã§ããããšãšããµãŒããŒãèµ·åããããã«æ§æãããŠããªã
ãšããæãã§æžãããŠããã ããªæ°ãããŸãã
Managed Domain Configuration Files
管ç察象ãã¡ã€ã³èšå®ãã¡ã€ã«
ããã§ãhost-slave.xml
ãšã®å·®åãèŠãŠã¿ãŸãããã
$ diff domain/configuration/host-master.xml domain/configuration/host-slave.xml 3c3 < <host xmlns="urn:jboss:domain:17.0" name="master"> --- > <host xmlns="urn:jboss:domain:17.0"> 11a12,14 > <server-identities> > <secret value="c2xhdmVfdXMzcl9wYXNzd29yZA=="/> > </server-identities> 62c65,69 < <local/> --- > <remote security-realm="ManagementRealm"> > <discovery-options> > <static-discovery name="primary" protocol="${jboss.domain.master.protocol:remote+http}" host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9990}"/> > </discovery-options> > </remote> 67a75,77 > <interface name="public"> > <inet-address value="${jboss.bind.address:127.0.0.1}"/> > </interface> 78a89,94 > <servers> > <server name="server-one" group="main-server-group"/> > <server name="server-two" group="other-server-group"> > <socket-bindings port-offset="150"/> > </server> > </servers>
ãã¡ãã«ã¯ãµãŒããŒã®å®çŸ©ããããpublic
ã«ãinet-address
ã®å®çŸ©ããããŸãã
ãšããããšã¯ããªã¯ãšã¹ãããã³ããªã³ã°ããã®ã¯ãhost-slave.xml
ã§å®çŸ©ãããŠãããã¹ãã³ã³ãããŒã©ãŒç®¡çäžã®
ãµãŒããŒã§è¡ãããšãæ³å®ããŠããæ°ãããŸããã
ãããŠãµãŒããŒãè¿œå ããã®ããhost-slave.xml
ã§ç®¡çãããŠãããã¹ãã³ã³ãããŒã©ãŒåŽã§ããã¹ããªã®ã§ãããã
ãã¡ãã®èª¬æãèªãã§ããŠããã¡ã€ã³å
ã®ãã¹ãã³ã³ãããŒã©ãŒã®ã²ãšã€ããã¡ã€ã³ã³ã³ãããŒã©ãŒãšãªããšãã
ã€ã¡ãŒãžã ã£ãã®ã§ããã
ãããªããšããã¡ã€ã³ã³ã³ãããŒã©ãŒã¯ãã¡ã€ã³å ã§ãç¬ç«ããŠæ±ã£ãæ¹ãè¯ããããªæãã§ããããã
åèãŸã§ã«ãhost.xml
ãšhost-slave.xml
ã®å·®åãèŠãŠã¿ãŸãããã
$ diff domain/configuration/host.xml domain/configuration/host-slave.xml 3c3 < <host xmlns="urn:jboss:domain:17.0" name="master"> --- > <host xmlns="urn:jboss:domain:17.0"> 11a12,14 > <server-identities> > <secret value="c2xhdmVfdXMzcl9wYXNzd29yZA=="/> > </server-identities> 62c65,69 < <local/> --- > <remote security-realm="ManagementRealm"> > <discovery-options> > <static-discovery name="primary" protocol="${jboss.domain.master.protocol:remote+http}" host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9990}"/> > </discovery-options> > </remote> 84,85c91 < <server name="server-two" group="main-server-group" auto-start="true"> < <jvm name="default"/> --- > <server name="server-two" group="other-server-group"> 87,90d92 < </server> < <server name="server-three" group="other-server-group" auto-start="false"> < <jvm name="default"/> < <socket-bindings port-offset="250"/>
host-slave.xml
ã«ã¯ãã¡ã€ã³ã³ã³ãããŒã©ãŒãåç
§ãã«ããå®çŸ©ãããããŸããµãŒããŒã®å®çŸ©ãå°ã
ç°ãªããŸããã
ãŸãããã¡ã€ã³èªäœã®èšå®ãã¡ã€ã«ã¯domain.xml
ã§ç®¡çãããŠãããããã¯domain.sh
ã®åŒæ°ã§æå®ããããšãã§ããŸãã
-c <config>, -c=<config> Name of the domain configuration file to use (default is "domain.xml") (Same as --domain-config) --domain-config=<config> Name of the domain configuration file to use (default is "domain.xml") (Same as -c)
ãã®ãã¡ã€ã«ã¯ããã¹ã¿ãŒãšãªããã¡ã€ã³ã³ã³ãããŒã©ãŒãåç §ããããã§ãã
Domain Wide Configuration â domain.xml
domain/configuration/domain.xml
ã§ã®interface
ã®å®çŸ©ãèŠããšä»¥äžã®ããã«ãªã£ãŠãããpublic
ãšmanagement
ã空ã§ãã
<interfaces> <interface name="management"/> <interface name="private"> <inet-address value="${jboss.bind.address.private:127.0.0.1}"/> </interface> <interface name="public"/> <interface name="unsecure"> <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/> </interface> </interfaces>
äžæ¹ã§host-master.xml
ã§ã¯interfaces
ã¯ãããªã£ãŠãã
<interfaces> <interface name="management"> <inet-address value="${jboss.bind.address.management:127.0.0.1}"/> </interface> </interfaces>
host.xml
ããã³host-slave.xml
ã§ã¯ãã®ããã«ãªã£ãŠããŸãã
<interfaces> <interface name="management"> <inet-address value="${jboss.bind.address.management:127.0.0.1}"/> </interface> <interface name="public"> <inet-address value="${jboss.bind.address:127.0.0.1}"/> </interface> </interfaces>
domain.xml
ã¯ãã¡ã€ã³ã³ã³ãããŒã©ãŒã§ããèªã¿èŸŒãŸãªããšããããšã§ããããã®å·®åãäžæžãã§ããä»çµã¿ã«ã§ã
ãªã£ãŠãããã§ããããïŒ
ãªãããã¹ãã³ã³ãããŒã©ãŒã¯ã²ãšã€ã®ãã¹ãã«ã€ãã²ãšã€ãæ³å®ããŠããããã§ãããã§ããã®æ§æãè¡ã£ãŠã¿ããå Žåã¯
ãã¡ããèŠããšããããã§ãã
1 å°ã®ãã·ã³ã§ç®¡ç察象ãã¡ã€ã³ãèšå®
å察ã«ã2ã€ã®ãã¹ãã§ãã¡ã€ã³ãæ§æãããå ŽåïŒhost-master.xml
ãhost-slave.xml
ã䜿ãå ŽåïŒã¯ããã¡ããèŠããš
ããããã§ãã
2 å°ã®ãã·ã³ã§ç®¡ç察象ãã¡ã€ã³ãèšå®
ãŸãšã
WildFlyã®ãã¡ã€ã³ã¢ãŒãã§ããµãŒããŒã°ã«ãŒããšãµãŒããŒãèªåã§è¿œå ããŠã¿ãããªãšæãããããŠæ°è»œã«host-master.xml
ã
æ±ã£ãŠã¿ããšãããããããã
çµæãšããŠãå皮圹å²ã ã£ãã2ã€ã®host-xxxxx.xml
ã®åœ¹å²ã®éããªã©ã調ã¹ãããšã«ãªããæå€ãšç解ãé²ãã ãããª
æ°ãããŸãã
ãŸããåäžã®ãã¹ãã§å®è¡ããå Žåã¯ãçŽ çŽã«host.xml
ã䜿ãã®ãè¯ãããã§ããã
2ã€ä»¥äžã®ãã¹ãã§æ§æããå Žåã¯ããµãŒããŒãåäœããã®ã¯host-slave.xml
ã«ãªããã§ããããã