dubbo 端口协议复用支持rest吗

wyyhbhjk  于 4个月前  发布在  其他
关注(0)|答案(7)|浏览(64)
  • I have searched the issues of this repository and believe that this is not a duplicate.

Ask your question here

版本:dubbo 3.1.7
端口协议复用支持rest吗?比如使用以下配置

dubbo:
  protocol:
    name: dubbo
    port: 30060
    threads: 800
    ext-protocol: rest,

经过尝试,现在dubbo3.1.7会抛出下面的异常信息,貌似dubbo会新创建一个jetty来响应rest请求,而不会像文档中提到的一样通过切换netty的ServerPipeline来实现

ava.lang.IllegalStateException: Failed to start jetty server on 172.16.192.55:30060, cause: Failed to bind to 0.0.0.0/0.0.0.0:30060
	at org.apache.dubbo.remoting.http.jetty.JettyHttpServer.<init>(JettyHttpServer.java:90) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.remoting.http.jetty.JettyHttpBinder.bind(JettyHttpBinder.java:31) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.remoting.http.HttpBinder$Adaptive.bind(HttpBinder$Adaptive.java) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.protocol.rest.DubboHttpProtocolServer.doStart(DubboHttpProtocolServer.java:54) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.protocol.rest.BaseRestProtocolServer.start(BaseRestProtocolServer.java:47) ~[dubbo-3.1.7.jar:3.1.7]
	at com.gemantic.wealth.WealthRestProtocol.lambda$doExport$1(WealthRestProtocol.java:45) ~[dubbo-ext-rest-choosable-annotation-1.0.0-SNAPSHOT.jar:?]
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[?:1.8.0_221]
	at com.gemantic.wealth.WealthRestProtocol.doExport(WealthRestProtocol.java:42) ~[dubbo-ext-rest-choosable-annotation-1.0.0-SNAPSHOT.jar:?]
	at org.apache.dubbo.rpc.protocol.AbstractProxyProtocol.export(AbstractProxyProtocol.java:90) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.qos.protocol.QosProtocolWrapper.export(QosProtocolWrapper.java:77) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.protocol.ProtocolSecurityWrapper.export(ProtocolSecurityWrapper.java:80) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:66) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.cluster.filter.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:61) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.protocol.ProtocolSerializationWrapper.export(ProtocolSerializationWrapper.java:47) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.registry.integration.RegistryProtocol.lambda$doLocalExport$3(RegistryProtocol.java:297) ~[dubbo-3.1.7.jar:3.1.7]
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[?:1.8.0_221]
	at org.apache.dubbo.registry.integration.RegistryProtocol.doLocalExport(RegistryProtocol.java:295) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.registry.integration.RegistryProtocol.export(RegistryProtocol.java:241) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.qos.protocol.QosProtocolWrapper.export(QosProtocolWrapper.java:77) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.protocol.ProtocolSecurityWrapper.export(ProtocolSecurityWrapper.java:80) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:64) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.cluster.filter.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:58) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.protocol.ProtocolSerializationWrapper.export(ProtocolSerializationWrapper.java:47) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.ServiceConfig.doExportUrl(ServiceConfig.java:717) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.ServiceConfig.exportRemote(ServiceConfig.java:695) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.ServiceConfig.exportUrl(ServiceConfig.java:651) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:445) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:429) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:391) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:243) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.deploy.DefaultModuleDeployer.exportServiceInternal(DefaultModuleDeployer.java:350) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.deploy.DefaultModuleDeployer.exportServices(DefaultModuleDeployer.java:322) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.deploy.DefaultModuleDeployer.startSync(DefaultModuleDeployer.java:158) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.deploy.DefaultModuleDeployer.start(DefaultModuleDeployer.java:139) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onContextRefreshedEvent(DubboDeployApplicationListener.java:113) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:102) ~[dubbo-3.1.7.jar:3.1.7]
	at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:47) ~[dubbo-3.1.7.jar:3.1.7]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.25.jar:5.3.25]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.25.jar:5.3.25]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.25.jar:5.3.25]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.25.jar:5.3.25]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.25.jar:5.3.25]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.25.jar:5.3.25]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.25.jar:5.3.25]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.9.jar:2.7.9]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.9.jar:2.7.9]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.9.jar:2.7.9]
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164) ~[spring-boot-2.7.9.jar:2.7.9]
	at com.gemantic.wealth.user.server.Server.main(Server.java:39) ~[classes/:?]
Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:30060
	at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[jetty-util-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.server.Server.doStart(Server.java:401) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[jetty-util-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.apache.dubbo.remoting.http.jetty.JettyHttpServer.<init>(JettyHttpServer.java:87) ~[dubbo-3.1.7.jar:3.1.7]
	... 50 more
Caused by: java.net.BindException: Address already in use: bind
	at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_221]
	at sun.nio.ch.Net.bind(Net.java:433) ~[?:1.8.0_221]
	at sun.nio.ch.Net.bind(Net.java:425) ~[?:1.8.0_221]
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[?:1.8.0_221]
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[?:1.8.0_221]
	at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[jetty-util-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.server.Server.doStart(Server.java:401) ~[jetty-server-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[jetty-util-9.4.50.v20221201.jar:9.4.50.v20221201]
	at org.apache.dubbo.remoting.http.jetty.JettyHttpServer.<init>(JettyHttpServer.java:87) ~[dubbo-3.1.7.jar:3.1.7]
	... 50 more
vlurs2pr

vlurs2pr1#

目前rest不支持端口复用。
这里默认值是 jetty ,可以配置为 netty ,但是这个netty和端口复用没什么关系

gr8qqesn

gr8qqesn2#

目前rest不支持端口复用。 这里默认值是 jetty ,可以配置为 netty ,但是这个netty和端口复用没什么关系

目前端口复用支持哪些协议?未来还有可能会增加吗?

u4vypkhs

u4vypkhs3#

目前rest不支持端口复用。 这里默认值是 jetty ,可以配置为 netty ,但是这个netty和端口复用没什么关系

目前端口复用支持哪些协议?未来还有可能会增加吗?

目前支持 dubbo 、triple、telnet 理论上后续所有的都会接入

uujelgoq

uujelgoq4#

期待后续的接入

pdtvr36n

pdtvr36n5#

目前rest不支持端口复用。 这里默认值是 jetty ,可以配置为 netty ,但是这个netty和端口复用没什么关系

目前端口复用支持哪些协议?未来还有可能会增加吗?

目前支持 dubbo 、triple、telnet 理论上后续所有的都会接入

官网文档中提到的端口复用中的qos怎么使用
https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/advanced-features-and-usage/service/port-unification/

通过对protocol进行配置,dubbo3可以支持端口的协议复用。 比如使用Triple协议启动端口复用后,可以在相同的端口上为服务增加 Dubbo协议支持,以及Qos协议支持。这些协议的识别都是由一个统一的端口复用 服务器进行处理的,可以用于服务的协议迁移,并且可以节约端口以及相关的资源,减少运维的复杂性。

zrfyljdw

zrfyljdw6#

Member

目前我在3.1.8版本中使用以下配置,会报错

protocol:
    name: dubbo
    port: 30060
    threads: 800
    ext-protocol: tri,qos

异常错误

java.lang.IllegalStateException: No such extension org.apache.dubbo.rpc.Protocol by name qos, no related exception was found, please check whether related SPI module is missing.
	at org.apache.dubbo.common.extension.ExtensionLoader.findException(ExtensionLoader.java:760) ~[dubbo-3.1.8.jar:3.1.8]
	at org.apache.dubbo.common.extension.ExtensionLoader.createExtension(ExtensionLoader.java:767) ~[dubbo-3.1.8.jar:3.1.8]
	at org.apache.dubbo.common.extension.ExtensionLoader.getExtension(ExtensionLoader.java:561) ~[dubbo-3.1.8.jar:3.1.8]
	at org.apache.dubbo.common.extension.ExtensionLoader.getExtension(ExtensionLoader.java:535) ~[dubbo-3.1.8.jar:3.1.8]
	at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java) ~[dubbo-3.1.8.jar:3.1.8]
.....

相关问题