JBoss EAP 設置 Domain Mode
JBoss 提供免費版 WildFly 和商業版 JBoss EAP ,可以讓 Java 的應用系統 war 檔執行在此平台上,若是架設正式環境則建議使用 商業版 JBoss EAP ,不然就必需要有非常高深的功力了。商業版 JBoss EAP 提供有 Standalone Mode 與 Domain Mode 兩種,若希望 Java 的 war 檔可以自動佈署在不同的主機上,使用 Domain Mode 是一個不錯的建議。在建置 JBoss EAP 的 Domain Mode 前,本人還是比較傾向先規劃好架構,這樣才知道整體的運作。下面是規劃建置圖:
- 設定 Domain Control 主機 Hostname: dc-master / IP: 192.168.2.4
Host: 192.168.2.4 裡面裝兩個角色,一個角色是 Domain Controller 用來控制 server-one、server-two 及 server-three,另一個角色是 server-one。JBoss EAP 的 ZIP 壓縮檔解開放在 d:\AppServ\jboss-eap-6.2,所以修改d:\AppServ\jboss-eap-6.2\domain\configuration\host.xml,注意:host name 的值必需是唯一值。
<host name="EAP-Domain-Master" xmlns="urn:jboss:domain:1.5"> ...... <domain-controller> <local/> </domain-controller> <servers> <server name="server-one" group="main-server-group"/> </servers> </host>
- 建立 Domain Mode 主機間溝通用專用的帳號
在 Domain Control 主機 Host name: dc-master / ip: 192.168.2.4 建立 Domain Mode 主機間溝通用專用的帳號:domainMaster,並取得 secret key:UEBzc3cwcmQ=。
D:\AppServ\jboss-eap-6.2\bin>add-user.bat What type of user do you wish to add? a) Management User (mgmt-users.properties) b) Application User (application-users.properties) (a): a Enter the details of the new user to add. Using realm 'ManagementRealm' as discovered from the existing property files. Username : domainMaster Password : xxxxx Re-enter Password : xxxxx What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]: About to add user 'domainMaster' for realm 'ManagementRealm' Is this correct yes/no? yes Added user 'domainMaster' to file 'D:\AppServ\jboss-eap-6.2\standalone\configuration\mgmt-users.properties' Added user 'domainMaster' to file 'D:\AppServ\jboss-eap-6.2\domain\configuration\mgmt-users.properties' Added user 'domainMaster' with groups to file 'D:\AppServ\jboss-eap-6.2\standalone\configuration\mgmt-groups.properties' Added user 'domainMaster' with groups to file 'D:\AppServ\jboss-eap-6.2\domain\configuration\mgmt-groups.properties' Is this new user going to be used for one AS process to connect to another AS process? e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls. yes/no? yes To represent the user add the following to the server-identities definition <secret value="UEBzc3cwcmQ=" /> Press any key to continue . . .
- 設定 Slave 主機 Hostname: dc-slave / IP: 192.168.3.118 上的第一個 EAP 主機: EAP-instance-two
修改 D:\AppServ\jboss-eap-6.2-1\domain\configuration\host.xml,因為 EAP-instance-two & EAP-instance-three 是在同一台主機 Hostname: dc-slave / IP: 192.168.3.118 上,所以 management port 要作變動。修改 D:\AppServ\jboss-eap-6.2-1\domain\configuration\host.xml
<host name="EAP-instance-two" xmlns="urn:jboss:domain:1.5"> ... <management> <security-realms> <security-realm name="ManagementRealm"> <server-identities> <secret value="UEBzc3cwcmQ="/> </server-identities> ... <management-interfaces> <native-interface security-realm="ManagementRealm"> <socket interface="management" port="${jboss.management.native.port:9998}"/> </native-interface> <http-interface security-realm="ManagementRealm"> <socket interface="management" port="${jboss.management.http.port:9991}"/> </http-interface> </management-interfaces> </management> <domain-controller> <remote host="192.168.2.4" port="9999" security-realm="ManagementRealm" username="domainMaster" /> </domain-controller> <server name="server-two" group="main-server-group" auto-start="true"> <socket-bindings port-offset="100"/> </server> </host>
- 設定 Slave 主機 Hostname: dc-slave / IP: 192.168.3.118 上的第二個EAP主機: EAP-instance-three
因為在此 EAP Instance 上有兩個 server:server-three & server-four 所以要作 port-offset,修改 D:\AppServ\jboss-eap-6.2-1\domain\configuration\host.xml
<host name="EAP-instance-three" xmlns="urn:jboss:domain:1.5"> ... <management> <security-realms> <security-realm name="ManagementRealm"> <server-identities> <secret value="UEBzc3cwcmQ="/> </server-identities> ... <management-interfaces> <native-interface security-realm="ManagementRealm"> <socket interface="management" port="${jboss.management.native.port:9997}"/> </native-interface> <http-interface security-realm="ManagementRealm"> <socket interface="management" port="${jboss.management.http.port:9992}"/> </http-interface> </management-interfaces> </management> <domain-controller> <remote host="192.168.2.4" port="9999" security-realm="ManagementRealm" username="domainMaster" /> </domain-controller> <servers> <server name="server-three" group="main-server-group" auto-start="true"> <socket-bindings port-offset="200"/> </server> <server name="server-four" group="main-server-group" auto-start="true"> <socket-bindings socket-binding-group="ha-sockets" port-offset="300"/> </server> </servers> </host>
- 啟動 Domain Control 主機 Hostname: dc-master / IP: 192.168.2.4
d:/>domain.bat -b YourMasterHostName -bmanagement YourMasterHostName 例: d:/>domain.bat -b dc-master -bmanagement dc-master 或: d:/>domain.bat -b 192.168.2.4 -bmanagement 192.168.2.4
- 啟動 Slave 主機 Hostname: dc-slave / IP: 192.168.3.118 上的兩個EAP主機
在 Linux 平台執行的指令
./domain.sh -Djboss.domain.master.address=YourMasterHostName -b SlaveHostName -bmanagement SlaveHostName
在 Window 平台執行的指令
D:\>AppServ\jboss-eap-6.2-1\bin\domain.bat -Djboss.domain.master.address=192.168.2.4 -b 192.168.3.118 -bmanagement 192.168.3.118 與 D:\>AppServ\jboss-eap-6.2-2\bin\domain.bat -Djboss.domain.master.address=192.168.2.4 -b 192.168.3.118 -bmanagement 192.168.3.118
- 進入管理介面 http://192.168.2.4:9990/console 查看是否有依架構執行
若都有正常運行,那麼 JBoss EAP 的 Domain Mode 代表設置正常。
你必須 登入 才能發表評論。