您的位置:首页 > 其它

JBoss多实例端口冲突问题

2017-07-31 22:30 197 查看
一、背景介绍

操作系统为Linux CentOS 6.5,JDK为1.7.0_79,JBoss版本为4.3.0.GA,研发测试环境需要在一个机器上同时启用多个JBoss服务实例,部署好应用进行启动时,发现遇到端口冲突的现象。

二、解决方案

1、方案一:端口修改

有一个非常简单的办法,就是直接改涉及到冲突的端口号,以前使用tomcat就是这么干的,但Jboss要改的文件,搜罗了一下大致有以下几个要改:

1)$JBoss_home/server/default/deploy/ejb3.deployer/META-INF/jboss-service.xml
修改3873端口的值。

2)$JBoss_home/server/default/deploy/jboss-web.deployer/server.xml
修改8080,8009,8443端口值。

3)$JBoss_home/server/default/conf/jboss-service.xml
修改8083,1098,1099,4444,4445,4446端口值。

4)$JBoss_home/server/default/conf/jboss-minimal.xml
修改1099端口值,与3中保持一致。

5)$JBoss_home/server/default/deploy/jms/uil2-service.xml
修改8093端口值。

有十几个端口需要修改,如果还要多开几个服务实例,这端口的配置、维护管理简直就是恶梦啊!

其实Jboss提供了Binding-Manager服务,可以成套的切换端口和绑定的IP,再也不用一个一个端口来查找修改了,非常方便。

$JBoss_home/ports/bindings.xml
文件中,定义了多组端口,默认组名有
port-default,ports-01,ports-02
等,里面端口的编排是以100递增的,如ports-default的jboss:service=WebService端口号为8083,下一组ports-01的jboss:service=WebService的端口号就为8103,以此类推。如果默认的组不够,也可以自定义添加组,端口合理规划不冲突即可,建议遵循默认的端口递增规律。

注意JBoss 4.3.0.GA版本的bindings.xml的目录是$JBoss_home/ports,其他版本的不一定相同,请留意一下。

摘抄了一个ports-01的端口配置,仅供参考:

<!-- ********************************************************** -->
<!-- *                          ports-01                      * -->
<!-- ********************************************************** -->
<server name="ports-01">

<!-- EJB3 Remoting Connector ejb3.deployer/META-INF/jboss-service.xml -->

<service-config name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
<delegate-config>
<attribute name="InvokerLocator">socket://${jboss.bind.address}:3973</attribute>
</delegate-config>
<binding port="3973"/>
</service-config>

<!-- ********************* jboss-service.xml ****************** -->

<service-config name="jboss:service=Naming"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="Port" hostName="BindAddress">
<attribute name="RmiPort">1198</attribute>
</delegate-config>
<binding port="1199" host="${jboss.bind.address}"/>
</service-config>

<service-config name="jboss:service=WebService"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="Port"/>
<binding port="8183"/>
</service-config>

<service-config name="jboss:service=invoker,type=jrmp"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="RMIObjectPort"/>
<binding port="4544"/>
</service-config>

<service-config name="jboss:service=invoker,type=pooled"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="ServerBindPort"/>
<binding port="4545"/>
</service-config>

<!-- ********************* cluster-service.xml **************** -->

<service-config name="jboss:service=HAJNDI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
<delegate-config portName="Port" hostName="BindAddress">
<attribute name="RmiPort">1201</attribute>
</delegate-config>
<binding port="1200" host="${jboss.bind.address}"/>
</service-config>

<service-config name="jboss:service=invoker,type=jrmpha"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
<delegate-config portName="RMIObjectPort"/>
<binding port="4544"/>
</service-config>

<service-config name="jboss:service=invoker,type=pooledha"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
<delegate-config portName="ServerBindPort"/>
<binding port="4548"/>
</service-config>

<!-- ********************* iiop-service.xml ****************** -->

<service-config name="jboss:service=CorbaORB"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="Port"/>
<binding port="3628"/>
</service-config>

<!-- ********************* jmx-rmi-adaptor.sar **************** -->

<service-config name="jboss.jmx:type=Connector,name=RMI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="RMIObjectPort"/>
<binding port="19101"/>
</service-config>

<!-- ********************* snmp-adaptor.sar ****************** -->

<service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="Port"/>
<binding port="1262"/>
</service-config>

<service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="Port"/>
<binding port="1261"/>
</service-config>

<!-- ********************* jbossmq-service.xml **************** -->

<!-- JMS related services -->
<service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="ServerBindPort"/>
<binding port="8193"/>
</service-config>

<!-- ********************* jbossmq-httpil.sar **************** -->
<service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="URLPort"/>
<binding port="8180"/>
</service-config>

<!-- ********************* hajndi-jms-ds.xml **************** -->

<!-- The JMS provider loader -->
<service-config name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
<!--
MAKE SURE java.naming.provider.url
PORT IS SAME AS HA-JNDI ABOVE !!!
-->
<delegate-config>
<attribute name="Properties"><![CDATA[
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=${jboss.bind.address:localhost}:1200
jnp.disableDiscovery=false
jnp.partitionName=${jboss.partition.name:DefaultPartition}
jnp.discoveryGroup=${jboss.partition.udpGroup:230.0.0.4}
jnp.discoveryPort=1102
jnp.discoveryTTL=16
jnp.discoveryTimeout=5000
jnp.maxRetries=1
]]>
</attribute>
</delegate-config>
<!-- NOTE: YOU MUST ADD THIS ELEMENT, BUT THE VALUE DOESN'T MATTER
BE SURE THE CORRECT VALUE IS IN java.naming.provider.url ABOVE -->
<binding port="1200"/>
</service-config>

<!-- **************** http-invoker.sar & httpha-invoker.sar*************** -->
<!-- EJBInvoker -->
<service-config name="jboss:service=invoker,type=http"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config>
<attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
</delegate-config>
<!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
<binding port="8180"/>
</service-config>

<!-- JMXInvoker -->
<service-config name="jboss:service=invoker,type=http,target=Naming"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config>
<attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
</delegate-config>
<!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
<binding port="8180"/>
</service-config>

<!-- readonly JMXInvoker -->
<service-config name="jboss:service=invoker,type=http,target=Naming,readonly=true"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config>
<attribute name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
</delegate-config>
<!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
<binding port="8180"/>
</service-config>

<!-- **************** httpha-invoker.sar*************** -->
<!-- EJBInvokerHA -->
<service-config name="jboss:service=invoker,type=httpHA"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config>
<attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
</delegate-config>
<binding port="8180"/>
</service-config>

<!-- JMXInvokerHA -->
<service-config name="jboss:service=invoker,type=http,target=HAJNDI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config>
<attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
</delegate-config>
<binding port="8180"/>
</service-config>

<!-- ********************* jboss-ws4ee.sar **************** -->

<!-- Web Service related services -->
<service-config name="jboss.ws4ee:service=AxisService"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="WebServicePort" hostName="WebServiceHost"/>
<binding port="8180" host="${jboss.bind.address}"/>
</service-config>

<!-- ********************* remoting **************** -->

<!-- *** remoting connector *** -->
<service-config name="jboss.remoting:service=Connector,transport=socket"
delegateClass="org.jboss.services.binding.XSLTConfigDelegate">
<delegate-config>
<xslt-config configName="Configuration"><![CDATA[
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

<xsl:output method="xml" />
<xsl:param name="port"/>

<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="attribute[@name='serverBindPort']">
<attribute type="java.lang.String" name="serverBindPort"><xsl:value-of select='$port'/></attribute>
</xsl:template>

<xsl:template match="*|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
]]>
</xslt-config>
</delegate-config>
<binding port="5446" />
</service-config>

<!-- ********************* hsqldb-ds.xml ********************** -->

<!-- Hypersonic related services

Only if using TCP setup (local file setup by default)

<service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
>
<delegate-config>
<xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

<xsl:output method="xml" />
<xsl:param name="host"/>
<xsl:param name="port"/>

<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="config-property[@name='ConnectionURL']">
<config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
</xsl:template>

<xsl:template match="*|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
]]>
</xslt-config>
</delegate-config>
<binding host="localhost" port="1801" />
</service-config>

<service-config name="jboss:service=Hypersonic"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
>
<delegate-config portName="Port" />
<binding port="1801" />
</service-config>

-->

<!-- ********************* tomcat ********************** -->

<service-config name="jboss.web:service=WebServer"
delegateClass="org.jboss.services.binding.XSLTFileDelegate"
>
<delegate-config>
<xslt-config configName="ConfigFile"><![CDATA[
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

<xsl:output method="xml" />
<xsl:param name="port"/>

<xsl:variable name="portAJP" select="$port - 71"/>
<xsl:variable name="portHttps" select="$port + 363"/>

<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match = "Connector">
<Connector>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="(name() = 'port' and . = '8080')">
<xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
</xsl:when>
<xsl:when test="(name() = 'port' and . = '8009')">
<xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
</xsl:when>
<xsl:when test="(name() = 'redirectPort')">
<xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
</xsl:when>
<xsl:when test="(name() = 'port' and . = '8443')">
<xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:apply-templates/>
</Connector>
</xsl:template>

<xsl:template match="*|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
]]>
</xslt-config>
</delegate-config>
<binding port="8180"/>
</service-config>

<!-- ********************* jboss messaging ********************** -->

<service-config name="jboss.messaging:service=Connector,transport=bisocket"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
<delegate-config>
<attribute name="Configuration"><![CDATA[
<config>
<invoker transport="bisocket">
<attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
<attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
<attribute name="dataType" isParam="true">jms</attribute>
<attribute name="socket.check_connection" isParam="true">false</attribute>
<attribute name="timeout" isParam="true">0</attribute>
<attribute name="serverBindAddress">${jboss.bind.address}</attribute>
<attribute name="serverBindPort">4557</attribute>
<attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
<attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
<attribute name="numberOfCallRetries" isParam="true">1</attribute>
<attribute name="pingFrequency" isParam="true">214748364</attribute>
<attribute name="pingWindowFactor" isParam="true">10</attribute>
<attribute name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</attribute>
<attribute name="stopLeaseOnFailure" isParam="true">true</attribute>
<attribute name="clientLeasePeriod" isParam="true">10000</attribute>
<attribute name="timeout" isParam="true">0</attribute>
<attribute name="numberOfRetries" isParam="true">10</attribute>
<attribute name="JBM_clientMaxPoolSize" isParam="true">200</attribute>
<attribute name="callbackTimeout">10000</attribute>
</invoker>
<handlers>
<handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
</handlers>
</config>
]]></attribute>
</delegate-config>
<binding port="4557"/>
</service-config>

</server>


了解了bindings.xml文件后,我们接下来的配置工作就非常简单了,修改新增的实例目录下的jboss-service配置文件,xxx为示例的部署应用名,$JBoss_HOME/server/xxx/conf/jboss-service.xml文件,搜索“ServerName”,找到相应的mbean,如下:

<!--
| Binding service manager for port/host mapping. This is a sample
| config that demonstrates a JBoss instances with a server name 'ports-01'
| loading its bindings from an XML file using the ServicesStoreFactory
| implementation returned by the XMLServicesStoreFactory.
|
| ServerName: The unique name assigned to a JBoss server instance for
| lookup purposes. This allows a single ServicesStore to handle mulitiple
| JBoss servers.
|
| StoreURL: The URL string passed to org.jboss.services.binding.ServicesStore
| during initialization that specifies how to connect to the bindings store.
| StoreFactory: The org.jboss.services.binding.ServicesStoreFactory interface
| implementation to create to obtain the ServicesStore instance.

<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>
-->


默认这项配置是关闭的,把注释去掉,在ServerName配置项上写上组名,就可以使用该组名下维护的成套端口了。注意这里填写的组名必须是在bindings.xml里面定义的组名。

使用Binding-Manager的好处显而易见,工作量减少了很多,运维实施起来也方便,而且不容易出错。

另外有一个地方要提一下,之前bindings.xml配置文件里,每个组里面都有关于jboss-web的http端口和ajp端口的配置,就是service-config的名称是jboss.web:service=WebServer的那一段,那个要求$JBoss_HOME/server/xxx/deploy/jboss-web.deployer/server.xml文件内的http和ajp端口必须是默认的8080和8009,不能修改,否则无法进行替换,具体的替换逻辑可以参照上文给出的ports-01的代码。

2、方案二:绑定不同的IP

在套接字层的底端,绑定一个端口需要两条信息:端口号和IP地址。

我们启动JBoss实例时,IP地址有时候会写成0.0.0.0,这个特殊地址的意思:绑定定义到系统中的所有IP地址。如果服务器上只有一块网卡,那么所有的端口都会绑定到该IP地址上。如果有多块网卡或是设定了虚拟IP地址,那么使用0.0.0.0作为启动时绑定的IP地址会导致端口绑定到所有的IP地址上。

但有些场景并不期望端口绑定到所有的IP地址上,比如说有两个IP地址,一个IP用来处理外部的HTTP请求,另一个IP来处理内部系统之间的调用,从而达到一个分流的目的。

根据这个思路,JBoss的不同实例,可以绑定到不同的IP上面,这样Jboss的多个实例,可以共享端口,如192.168.1.100:8080和192.168.1.101:8080,在处理HTTP请求时,他们都可以使用8080端口,这种情况下是不会冲突的,因为每一个端口都绑定到不同的IP地址上。

四、演示示例

1、方案一示例

拷贝jboss的all实例,分别为all-01,all-02,根据方案一的步骤,修改conf/jboss-service.xml,all-01实例的文件修改如下:

<mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">ports-01</attribute>
<attribute name="StoreURL">${jboss.home.url}/ports/bindings.xml</attribute>
<attribute name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>


all-02实例的文件修改如下:

<mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">ports-02</attribute>
<attribute name="StoreURL">${jboss.home.url}/ports/bindings.xml</attribute>
<attribute name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>


预期的结果是all-01绑定的是8180这一组端口,all-02绑定的是8280端口组,实例启动时的其他端口信息不赘述。

启动命令如下:

run.bat -c all-01 -b 192.168.1.103

run.bat -c all-02 -b 192.168.1.103

all-01实例的启动日志 (部分)

2017-07-30 22:08:03,390 DEBUG [org.jboss.web.tomcat.service.JBossWeb] Saw org.jboss.system.server.started notification, starting connectors

2017-07-30 22:08:03,397 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8180

2017-07-30 22:08:03,422 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-0.0.0.0-8109

all-02实例的启动日志 (部分)

2017-07-30 22:10:47,406 DEBUG [org.jboss.web.tomcat.service.JBossWeb] Saw org.jboss.system.server.started notification, starting connectors

2017-07-30 22:10:47,417 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8280

2017-07-30 22:10:47,439 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-0.0.0.0-8209

日志显示与预期的端口是一致的,两个实例可以同时运行,并且没有端口冲突的错误日志出现。

2、方案二示例

拷贝的实例与上一个示例相同,配置文件中的ServerName统一设置为ports-01,同时启动两个实例,看端口占用情况,为了简单起见,实际IP为192.168.1.103 ,新增加一个虚拟IP192.168.1.137,启动命令如下:

run.bat -c all-01 -b 192.168.1.137

run.bat -c all-02 -b 192.168.1.103

2017-07-30 22:40:54,080 DEBUG [org.jboss.web.tomcat.service.JBossWeb] Saw org.jboss.system.server.started notification, starting connectors

2017-07-30 22:40:54,090 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-192.168.1.137-8180

2017-07-30 22:40:54,115 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-192.168.1.137-8109

2017-07-30 22:33:46,836 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.firstpass] Local XARecoveryModule - first pass

2017-07-30 22:33:46,843 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-192.168.1.103-8180

2017-07-30 22:33:46,858 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-192.168.1.103-8109

从日志上可以证实,两个实例都正常启动,并且无端口冲突的异常日志。

示例结论:两种方案均可行。

四、补充虚拟IP创建方法

1、Windows平台

打开网络和共享中心,找到连接的网络



点击属性,双击IPv4,如果是自动获取IP的,改成手动,然后点击高级



在IP地址上点击添加IP即可



设置完成后,在cmd命令行中输入ipconfig,就可以看到两个IP了



注意几点:

1、一定要改成手动获取IP,DHCP方式的无法新增虚拟IP。

2、自己新增的虚拟IP要保证在局域网内没有冲突。

3、DNS若填写不正确,可能会无法正常连接网络。

2、Linux平台

需要root权限,在/etc/sysconfig/network-scripts下新增一个文件ifcfg-eth0:1,内容如下:

DEVICE="eth0:1"
IPADDR="192.168.1.107"
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT="yes"
TYPE="Ethernet"


保存后重启服务器,用ifconfig命令查看网络,可以发现新增的虚拟IP已经加上了:

[root@bogon network-scripts]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:79:3A:FD
inet addr:192.168.1.106  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe79:3afd/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:43 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6356 (6.2 KiB)  TX bytes:4447 (4.3 KiB)

eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:79:3A:FD
inet addr:192.168.1.107  Bcast:192.168.1.255  Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING  MTU:16436  Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:816 (816.0 b)  TX bytes:816 (816.0 b)


五、总结

修改端口和绑定多个IP地址方案在应用中,要考虑实际的环境需求,总的来说,修改端口是最直接的方案,只需要修改jboss自身的端口即可,绑定多个IP操作在稍微复杂一些,需要增加物理网卡或是在操作系统层面增加虚拟IP的配置,但在解决此次问题也有他的用处,可以完成反向代理服务器的工作,也可以当作是一个新的解决思路。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  jboss