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