Configure multiple instances on the jboss Server

Source: Internet
Author: User

The importance of jboss multi-instance Configuration

During development and testing, we often need to configure multiple running instances on the same host and server. The following are some advantages:

  • Resources can be saved to the maximum extent during project development and debugging.
  • Exceptions or errors in an instance do not affect the operation of other instances.
  • It is independent to restart or shut down an instance without affecting the running of the server.

This is the introduction to the importance. For more information about the jboss server, click here.

Jboss server Configuration

The key to solving this problem is actually allocating different ports for different instances.

In linux, go to the jboss server Directory and copy the instance data to modify the project name ,:

Different instances released by default at jboss startup require different port listening. After the project is copied, the same port causes a port conflict and cannot be started. The easiest way to solve this problem is to directly modify the port in the configuration file. This method is acceptable, but for the jboss server, each instance requires a large number of ports, including http 8080, AJP 8009, JNP 1099, and RMI 1098. These port configurations are distributed in different files, making manual modification highly error-prone.

With these factors in mind, the jboss server provides the Binding-Manager service, which can run multiple instances without the hassle of complicated configuration, without having to conflict ports. The procedure is as follows:

1. Deployment Environment

Take jboss 4.2.3 GA as an example. The server has two different instances, node1, node2 (custom name), and % JBOSS.HOME % indicates the jboss installation directory. The key file is % JBOSS.HOME %/docs/examples/binding-manager/sample-bindings.xml, this file defines four different port configurations (ports-default, ports-01, ports-02, and ports-03) by default ), by default, jboss supports four different jboss instances.

2. node2 Configuration

Go to the node2 directory and modify the node2/conf/jboss-service.xml file. The configuration is as follows:

    <mbean code="org.jboss.services.binding.ServiceBindingManager" name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">ports-01</attribute> <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute> <attribute name="StoreFactoryClassName"> org.jboss.services.binding.XMLServicesStoreFactory </attribute> </mbean>
Node2 is configured to use ports-01.

3. node1 Configuration

Node1 does not need to be configured by default. In this case, the default port 8080,800 provided by jboss is used. You can also refer to the configuration in step 1 by modifying "ServerName" and node2. Ps: only four groups of ports can be defined.

4. Custom Port

This step is not required. The running port has been specified during configuration in the previous step. If you want to modify the http service listening port of an instance, perform the following steps. Go to the node1 directory and modify node1/deploy/jboss-web.deployer/server. xml with the following Configuration:

    <Connector port="80" address="0.0.0.0"         maxThreads="250" maxHttpHeaderSize="8192"        emptySessionPath="true" protocol="HTTP/1.1"        enableLookups="false" redirectPort="8443" acceptCount="100"        connectionTimeout="20000" disableUploadTimeout="true" />
The port = "80" option can be changed to any port, as long as there is no conflict. Ps: the configuration of node2 is also consistent with that of node1.

5. Start the instance

After completing the preceding configuration, the instance is easy to start. As follows:

% JBOSS_HOME %/bin/run. sh-c node1-B IP address & % JBOSS_HOME %/bin/run. sh-c node2-B IP address &
The IP address refers to the Project address.

Configuration instructions

If no running port is specified and the default four port groups are used, the port is set as follows:

By default, the http service port is 8080. The ports of other instances are increased by 8080 based on 100. The corresponding relationship is as follows:

    ports-default      8080    ports-01           8180    ports-02           8280    ports-03           8380
The rules of other ports are the same as those of http ports. For example, the AJP ports are 8009, 8109, 8209, and 8309 respectively.

Notes
  • The above method also applies to deploying multiple jboss instances on the same machine instead of multiple instances under the same jboss.
  • If the four ports are not enough, you can add other port groups.
  • In the official environment, we recommend that you bind different instances to different IP addresses.
Scenario
  • The 32-bit JVM cannot use more than 2 GB of memory. You can use multiple instances to make full use of the large memory on the server (I don't understand it. Please inform anyone who understands it)
  • Different jboss are used for different purposes, such as development environment and test environment separation.
  • Use different jboss servers on the same machine
  • Deploy jboss based on different JVM on the same machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.