One
of the Primary Features of JBoss 7 is the ability to manage multiple
JBoss Instances from a Central point. A Collection of Such JBoss
servers are said to be members of a Domain which will have a Single
Control point for managing the Domain like restarting , applying
config changes e.t.c.
In
this article we will see how we can run a JBoss Server in a Domain
mode.
For
the article purpose we will have
2
machine ( 2 IP address)
2
JBoss Servers ( 1 acting as a Domain and other JBoss server running
on a Different Host)
Here
are the Sequence of steps
1.Unzip
the JBoss 7.
2.Make
2 copies of that as “DC” which is a Domain Controller and “HC”
as a Host Controller.
3.First Make Changes on the Domain Controller Side
3.First Make Changes on the Domain Controller Side
in
the DC/Domain/configuration/domain.xml , make the changes as
<server-group
name="ha-server-group" profile="ha">
<jvm name="default">
<heap size="256m" max-size="256m"/>
<permgen max-size="128m"/>
</jvm>
<socket-binding-group ref="ha-sockets"/>
</server-group>
<jvm name="default">
<heap size="256m" max-size="256m"/>
<permgen max-size="128m"/>
</jvm>
<socket-binding-group ref="ha-sockets"/>
</server-group>
We
here added a new server Group by the name “ha-server-group”.
4.Next
for the hosts.xml file in the DC make changes like
Change the Host Name to
<host name="masterOne" xmlns="urn:jboss:domain:1.4">
Add The Servers
<server name="ha-server-1" group="ha-server-group" auto-start="true">
<socket-bindings port-offset="300"/>
</server>
5.Once the Changes on the DC side are done , make changes on the HC side like
in the Host.xml , change the Host Name to “host1”
<host name="host1" xmlns="urn:jboss:domain:1.4">
This the host that we manage from the Domain Controller
Now
the most important thing is to make changes to the
<domain-controller> element.
As
we need to communicate with the Domain controller we would have to
make sure we replace the “<local/>” tag from the
“domain-controller” element in the “host.xml” file, when you
are creating a host controller.
The changes to the Domain-controller include
<domain-controller>
<!-- <local/>
<remote host="${jboss.domain.master.address:172.16.101.235}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/>
</domain-controller>
172.16.101.235
: This is the IP where the Domain System will be running
9999:
Port where Domain is running.
Once
we are aware of the Domain and where it is running , and also
configuring the host and ports in host.xml. We need to now create a
secret value and use it in the host configuration file so that domain
can perform management operations on the host.
This
is used much like a secret key between Domain and Host.
Create
a Management User in DC box
[root@vx111a
bin]# ./add-user.sh
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a):
Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : master
Password :
Re-enter Password :
About to add user 'master' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'master' to file '/soa/DC/standalone/configuration/mgmt-users.properties'
Added user 'master' to file '/soa/DC/domain/configuration/mgmt-users.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="bWFzdGVyMTIzQA==" />
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a):
Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : master
Password :
Re-enter Password :
About to add user 'master' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'master' to file '/soa/DC/standalone/configuration/mgmt-users.properties'
Added user 'master' to file '/soa/DC/domain/configuration/mgmt-users.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="bWFzdGVyMTIzQA==" />
Now
copy the Secret value at the bottom to the host.xml file in
/DC/hots.xml file
like
<management>
<security-realms>
<security-realm name="ManagementRealm">
<server-identities>
<secret value="aG9zdDEyM0A=" />
</server-identities>
….
<management>
<security-realms>
<security-realm name="ManagementRealm">
<server-identities>
<secret value="aG9zdDEyM0A=" />
</server-identities>
….
….
</management>
The
Secret identity is used when a slave domain controller needs to
establish a connection to a secured master domain controller.
The
value specified for the secret is the password encoded using Base64.
On attempting to connect to the remote domain controller the Base64
password will be decoded and the connection will authenticate using
the name of the host and the password obtained from the secret. The
master domain controller will also need to be configured with a realm
that contains the user 'slave' with the specified password.
Once
these changes are done. Start the instance using
Start DC using
./domain.sh -b 172.16.101.235 -bmanagement 172.16.101.235
and start the HC Using
./domain.sh -Djboss.domain.master.address=172.16.101.235 -b 172.16.101.196 -bmanagement 172.16.101.196
Once they are started , we can see the logs using
[Host Controller] 17:02:57,178 INFO [org.jboss.as.domain] (slave-request-threads - 1) JBAS010918: Registered remote slave host "host1", JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8)
and we can also see the admin console like
Happy
learning :-)