JBOSS series-cluster-basic configuration (2)-server,
1. Slave Server configuration
Note: The Slave Server is configured on the JBOSS of another machine. A teng user is added to the master server and teng users are assigned to the slave Server, that is, the server code of the slave server is teng.
1. host. xml
Enter jboss_home \ domain \ configuration, rename the original host. xml backup, and then copy the host-slave.xml and rename it host. xml
2. Modify host. xml
1)
<span style="font-size:14px;"><domain-controller> <remote host="${jboss.domain.master.address:192.168.24.17}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/> </domain-controller></span>
Note that the IP address in this section is changed to the IP address on the master Server, so that the slave server knows which host to connect.
2)
<span style="font-size:14px;"><interfaces> <interface name="management"> <inet-address value="${jboss.bind.address.management:0.0.0.0}"/> </interface> <interface name="public"> <inet-address value="${jboss.bind.address:0.0.0.0}"/> </interface> <interface name="unsecure"> <!-- Used for IIOP sockets in the standard configuration. To secure JacORB you need to setup SSL --> <inet-address value="${jboss.bind.address.unsecure:0.0.0.0}"/> </interface> </interfaces></span>
Note that the IP address in this section is changed to 0.0.0.0 or to the IP address of the real slave server. Otherwise, the application grace on the slave can be accessed on the slave local machine.
3)
<span style="font-size:14px;"><servers> <server name="master-server-8082" group="my-group-1"> <socket-bindings port-offset="2"/> </server> <server name="master-server-8083" group="my-group-1"> <socket-bindings port-offset="3"/> </server> </servers></span>
Create two servers on the slave server and add them to my-group-2 (the group here must have been created on the master server, otherwise, the server on the slave server cannot be added to the master-related group during startup)
4)
<span style="font-size:14px;">
Add a name = "on the starting host node, and the name will be displayed on the jboss console of the master server.
Note: The name must be the same as the username created in JBOSS. Otherwise, it cannot be found.
3. Security Authentication
Modify the host. xml file
<span style="font-size:14px;"><server-identities> <!-- Replace this with either a base64 password of your own, or use a vault with a vault expression --> <!--<secret value="c2xhdmVfdXNlcl9wYXNzd29yZA=="/>--> <secret value="IXRlbmcxMjM="/> </server-identities></span>
Note: The encoding of this value must be the same as that of the above user name; otherwise, the authentication will fail.
In short, you need to create a teng username on the jboss of the master server, and create it as follows:
The username is the same as the name of 2.4, and the encoding is the same as the above value.
4. Start master server in domain mode in sequence, and jboss on slave server
The running result is as follows:
This slave server of teng is displayed, and the server is in my-group-1, which matches the content in the modification host. xml above. This step proves successful.
5. After configuring the Slave Server and Jboss
Slave Server:
Group:
Iii. Deployment
1. Add a package
2. Select a file
3. After successful addition, assignments is 0
4. Add the war package to the group to run it.
Click assign
Select the Group to add.
If you want to deploy an app to multiple groups, it's okay. Click assign again and assign it to another group.
5. Jboss instance diagram After configuring Master and Slave
The Master server is on machines 17, and the SlaveServer (teng) is on machines 42.
Group relationship:
6. Access
Taking my example as an example, if I put the app to my-group-1 and my-group-2, all the corresponding six URLs can be accessed, as shown below:
Http: // 192. *. * 17: 8080/itoo-base-cgform-all/cgFormHeadController. do? CgFormHeadList # (Master Server address)
Http: // 192. *. *. 17: 8081/itoo-base-cgform-all/cgFormHeadController. do? CgFormHeadList #
Http: // 192. *. *. 17: 8082/itoo-base-cgform-all/cgFormHeadController. do? CgFormHeadList #
Http: // 192. *. *. 17: 8083/itoo-base-cgform-all/cgFormHeadController. do? CgFormHeadList #
Http: // 192. *. *. 42: 8082/itoo-base-cgform-all/cgFormHeadController. do? CgFormHeadList # (Slave Server access address)
Http: // 192. *. *. 42: 8083/itoo-base-cgform-all/cgFormHeadController. do? CgFormHeadList #
Summary
The upgrade of the JBOSS version brings us great convenience. It enables unified management, configuration, and resource deployment of multiple servers through the domain. Through centralized management, the cluster is divided and deployed on this basis to achieve single-point configuration and management of multiple servers in the cluster, reducing the pressure on servers and achieving a perfect combination. Next we will continue to introduce JBOSS Server Load balancer.