dobbo QOS 端口占用问题


解决方案

QoS参数可以通过如下方式进行配置

  • 系统属性
    • -Ddubbo.application.qos.enable=true
    • -Ddubbo.application.qos.port=33333
    • -Ddubbo.application.qos.accept.foreign.ip=false
  • dubbo.properties
    • dubbo.application.qos.enable=true
    • dubbo.application.qos.port=33333
    • dubbo.application.qos.accept.foreign.ip=false
  • XML方式
    • <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
             xsi:schemaLocation="http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans.xsd
             http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
        <dubbo:application name="demo-provider">
          <dubbo:parameter key="qos.enable" value="true"/>
          <dubbo:parameter key="qos.accept.foreign.ip" value="false"/>
          <dubbo:parameter key="qos.port" value="33333"/>
        </dubbo:application>
        <dubbo:registry address="multicast://224.5.6.7:1234"/>
        <dubbo:protocol name="dubbo" port="20880"/>
        <dubbo:service interface="org.apache.dubbo.demo.provider.DemoService" ref="demoService"/>
        <bean id="demoService" class="org.apache.dubbo.demo.provider.DemoServiceImpl"/>
      </beans>

       

  • Spring-boot自动装配方式
    • dubbo.application.qosEnable=true
    • dubbo.application.qosPort=33333
    • dubbo.application.qosAcceptForeignIp=false

其中,上述方式的优先顺序为系统属性 > dubbo.properties > XML/Spring-boot自动装配方式。

 

注意:网上说的配置不生效的原因,如果你是使用dubbo.properties 配置端口配置为:dubbo.application.qos.port=33333

                如果使用的是spring配置文件,则配置方式为:dubbo.application.qosPort=33333

     


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM