close

JBoss EAP(Enterprise Application Platform) 提供 Domain Mode ,可以讓應用系統佈署簡單化,也可以讓應用系統不會因一台主機掛了,而導致使用者就無法登入,至於 Domain Mode 的概念在 JBoss EAP 與 JBoss AS/Community edition 及 WildFly 的差異 有提了一下,現在我們來實作,整個架構如下圖。

 

 JBoss_Domain_plan.png  

 Step 01: 設定 Domain Control 主機 Host name: dc-master / ip: 192.168.2.4

修改d:\AppServ\jboss-eap-6.2-master\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>

 

Step 02:在 Domain Control 主機 Host name: dc-master / ip: 192.168.2.4 建立 Domain Mode 主機間溝通用專用的帳號:domainMaster,並取得 secret key

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 . . .

 

接下來的 Step03 & Step04 因為是在同一台主機 Host name: dc-slave / ip: 192.168.3.118 上,所以 management port 要作變動

Step03: 設定 Slave 主機 Host name: dc-slave / ip: 192.168.3.118 上的第一個EAP主機: EAP-instance-two

修改 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>

 

Step04: 設定 Slave 主機 Host name: dc-slave / ip: 192.168.3.118 上的第二個EAP主機: EAP-instance-three,因為在此 EAP Instance 上有兩個 server:server-threeserver-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>

 

Step05:啟動 Domain Control 主機 Host name: 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

 

Step06:啟動 Slave 主機 Host name: dc-slave / ip: 192.168.3.118 上的兩個EAP主機
./domain.sh -Djboss.domain.master.address=YourMasterHostName -b SlaveHostName -bmanagement SlaveHostName

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

 

Step07:進入管理介面 http://192.168.2.4:9990/console

JBoss_Domain_RealCase.png  

 

附記:

Configuring a Domain Controller 相關設定文件

Configuration

domain.xml

host.xml

<extensions>

X

 

<system-properties>

X

X

<paths>

X

X

<management>

 

X

<profiles>

X

 

<interfaces>

X

X

<domain-controller>

 

X

<jvms>

 

X

<servers>

 

X

<socket-binding-groups>

X

 

<server-groups>

X

 

<deployments>

X

 

 

 

參考

How to setup EAP6 in Domain Mode with Remote Host Controllers ?

http://wei-meilin.blogspot.tw/2012/07/jeap-6-standalone-domain-mode.html

arrow
arrow
    文章標籤
    JBoss EAP Domain Mode
    全站熱搜
    創作者介紹
    創作者 MIS 的頭像
    MIS

    MISTECH 技術手抄本

    MIS 發表在 痞客邦 留言(1) 人氣()