docker容器提示The character [_] is never valid in a domain name
Closed this issue · 3 comments
qlanto224 commented
Which Component
Sentinel 1.8.0
Describe the bug
同样的docker-compose配置,本地微服务可以在sentinel中识别到,但是生产(虚拟机内的docker容器)提示:
2024-11-25 15:29:31.862 INFO 1 --- [io-8858-exec-10] o.apache.coyote.http11.Http11Processor : The host [docker-sentinel-1.docker_by_net] is not valid
Note: further occurrences of request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: The character [_] is never valid in a domain name.
at org.apache.tomcat.util.http.parser.HttpParser$DomainParseState.next(HttpParser.java:946) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.tomcat.util.http.parser.HttpParser.readHostDomainName(HttpParser.java:842) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.tomcat.util.http.parser.Host.parse(Host.java:66) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.tomcat.util.http.parser.Host.parse(Host.java:40) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.coyote.AbstractProcessor.parseHost(AbstractProcessor.java:286) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.coyote.http11.Http11Processor.prepareRequest(Http11Processor.java:1203) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:776) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_202]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_202]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_202]
yuluo-yx commented
看样子和 sca 没啥关系?
qlanto224 commented
看样子和 sca 没啥关系?
生产使用sentinel的过程中的问题。物理机->虚拟机->容器
sca中配置spring.cloud.sentinel.transport.dashboard
虚拟机的ip,可以正确连接,当改成sentinel的容器ip时会出现这个错误。
qlanto224 commented
看样子和 sca 没啥关系?
生产使用sentinel的过程中的问题。物理机->虚拟机->容器 sca中配置
spring.cloud.sentinel.transport.dashboard
虚拟机的ip,可以正确连接,当改成sentinel的容器ip时会出现这个错误。
看样子是sentinel是去解析本地网卡时,去解析hosts了,而docker的网卡配置名称是有下划线的,导致解析异常。例如:
version: '3'
services:
sentinel:
image: sentinel-dashboard:1.8.0
hostname: "sentinel"
environment:
- TZ=Asia/Shanghai
ports:
- 8858:8858
restart: on-failure
networks:
by_net:
ipv4_address: 132.30.0.58
networks:
by_net:
driver: bridge
ipam:
config:
- subnet: 132.30.0.0/16