Symantec IGA

 View Only

Toolbelt:  Running multiple JBOSS instances on same OS

  • 1.  Toolbelt:  Running multiple JBOSS instances on same OS

    Posted Sep 08, 2015 01:37 AM



    I thought I would share my thoughts and processes on co-locating solutions on one (1) server. 

    This is one approach to address the challenge of server footprint growth due to complexity that require unique J2EE tiers for each solution.

    The below process meets the requirements of keeping unique J2EE (JBOSS) instances separate for each solution; but allows co-location on the same virtual/physical server.



    How to have simultaneous instances of JBOSS running on the same server.


    1) Adequate memory

    -  Each JVM (Java Virtual Machine) needs a minimal and maximum of memory.   If you plan on running three (3) solutions on different JBOSS instances, with each having a maximum memory of 8 GB, ensure the OS has enough (3 x 8GB = 24 GB + add memory for the OS of 4-8 GB = total of 28-32 GB)


    2) Ensure PATHING of each JBOSS instance are independent

    -  /opt/jboss/jboss01    /opt/jboss/jboss02    /opt/jboss/jboss03

    - E:\jboss\jboss01   E:\jboss\jboss02   E:\jboss\jboss03    

    -  To limit I/O due to each instance, review placement of each JBOSS on separate SANs drives.


    3) Decide on using common or independent JDK/JRE instances.

    - Some solutions have different version levels of support for Oracle Java, including bit level.

    - Recommend independent JDK/JRE with the correct JCE libraries (increase security for FIPS usage)

    -  /opt/java/jdk1.7.0_71_x86   /opt/java/jdk1.7.0_71_x64   /opt/java/jdk1.6.0_49_x86


    4) Avoid PORT collisions for STARTUP and SHUTDOWN for the simultaneous instances.

    - Default STARTUP port for JBOSS is 8080

    - Default SHUTDOWN port for JBOSS is 9999

    -  Recommendation, to avoid making multiple configuration file changes for PORTS, do the following:


    a)  Update  JBOSS_HOME\bin\  (startup.bat) with the following string:   

    1st JBOSS:       -Djboss.socket.binding.port-offset=0         (STARTING PORT = 8080 )

    2nd JBOSS:      -Djboss.socket.binding.port-offset=100    (STARTING PORT = 8180 )

    3rd JBOSS:      -Djboss.socket.binding.port-offset=200     (STARTING PORT = 8280 )


    b)  Update JBOSS_HOME\bin\jboss-cli.xml  with the following values   (to ensure it matches the offset above)

    1st JBOSS:         <port>9999</port>                (SHUTDOWN PORT = 9999 )

    2nd JBOSS:        <port>10099</port>             (SHUTDOWN PORT = 10099)

    3rd JBOSS:        <port>10199</port>              (SHUTDOWN PORT = 10199)


    5) Validate

    Startup JBOSS for each independently by  JBOSS_HOME\bin\ (startup.bat)     [Both MS Windows OS and UNIX/Linux]

    Shutdown via JBOSS_HOME/bin/  --connect  command=:shutdown          [UNIX/Linux]

    Shutdown via JBOSS_HOME\bin\jboss-cli.bat  --connect  command=:shutdown          [MS Win OS]

    Another Example:   sudo sh $JBOSS_HOME/bin/ --connect command=:shutdown

    - Note:  If this process does NOT shutdown JBOSS, validate the PID files has been created successfully upon Startup and the PORT number is correct.


    6)  Run all instances together; start 1st, 2nd, and 3rd  JBOSS

    - Monitor for any PORT collisions due to hard coded values in  JBOSS_HOME\standalone\configuration\standalone-full.xml  (view JBOSS_HOME\bin\ to check the correct configuration file being called)

    -netstat -an   or   netstat  -lnp

    - Update standalone-full.xml  as needed to avoid port collisions; monitor via JBOSS logs   \standalone\logs\


    7)  To enable HA across these JBOSS instances, to two (2) virtual/physical servers, e.g. sandbox01 and sandbox02

    -  Ensure that the JMS 's hostnames are followed by the correct PORT  (assumes use of local file store option for JMS configuration, e.g. no database required & TCP)

    -  Note:  these values w/[port] may be used in silent install CLI processes.

    1st JBOSS:        DEFAULT_JBOSS_CLUSTER_UNICAST_HOSTNAMES=sandbox01[7600],sandbox02[7600]

    2nd JBOSS:       DEFAULT_JBOSS_CLUSTER_UNICAST_HOSTNAMES=sandbox01[7700],sandbox02[7700]

    3rd JBOSS:        DEFAULT_JBOSS_CLUSTER_UNICAST_HOSTNAMES=sandbox01[7800],sandbox02[7800]






    Updated 9/8/2015 to clarify the below exercise is for non-production use only.   Use for training/knowledge sharing.




    An interesting exercise is using this process to stand up HA configuration for a solution.

    I would recommend standing up HA configuration ONLY for a SANDBOX environment to increase one's knowledge and experience with HA configurations.




    Solution installation wizards will complain the solution is already installed, when executed a 2nd time for same solution.

    CA installation check files, e.g.  /var/.com.zerog.registry.xml  will record only the last installation;  Uninstalls will fail for the 1st install.


    Ways to address for SANDBOX testing:

    a) Install solution once on JBOSS  /opt/jboss/jboss_im01

    b) Copy complete JBOSS folder to a new JBOSS folder;   cp -r -p  /opt/jboss/jboss_im01   /opt/jboss/jboss_im02

    c) Update the file.on 2nd HA instances with new PORT offset & update of jboss-cli.xml SHUTDOWN PORT

    d) Update the hardcoded values in JBOSS_HOME\standalone\configuration\standalone-full.xml on 2nd HA instance.  

    e) Reserve uninstall for 2nd JBOSS instance via   rm -rf  /opt/jboss/jboss_im02  

    f) Reserve universal updates (for both JBOSS instances) for 2nd JBOSS instance with a new copy from 1st JBOSS instances (plus re-update ports)

    g) Create 2nd hostname in local host file  /etc/hosts    tied to the same IP address    sandbox01  sandbox02

    h) Update JMS to isolate PORT COLLISION within the script

          , e.g. DEFAULT_JBOSS_CLUSTER_UNICAST_HOSTNAMES=sandbox01[7600],sandbox02[7700]



    *** ***


    Comments are welcome.


    I have used the above processes to setup HA for various solutions on customer's sandbox environments as part of a knowledge training exercise & ongoing lab.