Setting up multiple ports on a single JBoss instance?

余生颓废 提交于 2019-12-02 05:00:44

You need to modify Tomcat's configuration (JBoss uses an embedded version of Tomcat).

Relevant file is:

$ $JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml

There is a portion where you configure the binding ports. This is what comes by default:

  <!-- A HTTP/1.1 Connector on port 8080 -->
  <Connector port="8080" address="${jboss.bind.address}"
     maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
     emptySessionPath="true"
     enableLookups="false" redirectPort="8443" acceptCount="100"
     connectionTimeout="20000" disableUploadTimeout="true"/>

You can add several "connectors". One for each port you need.

Then restart your JBoss.

You will see something like this on the LOG:

16:29:13,803 INFO  [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8080
16:29:13,804 INFO  [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8091
16:29:13,805 INFO  [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8092
16:29:13,805 INFO  [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8093
16:29:13,805 INFO  [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8094

This is what you need to add on your server.xml file:

  <Connector port="8091" address="${jboss.bind.address}"
     maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
     emptySessionPath="true"
     enableLookups="false" redirectPort="8443" acceptCount="100"
     connectionTimeout="20000" disableUploadTimeout="true"/>

  <Connector port="8092" address="${jboss.bind.address}"
     maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
     emptySessionPath="true"
     enableLookups="false" redirectPort="8443" acceptCount="100"
     connectionTimeout="20000" disableUploadTimeout="true"/>

  ....

One XML tag for each new port.

One doubt, since all the connections are redirected to 8443, what is the point in giving multiple configuration? will it avoid port congestion?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!