Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 容器ip和宿主机ip怎么指定 #3335

Open
zhengduoru opened this issue Feb 16, 2024 · 1 comment
Open

[BUG] 容器ip和宿主机ip怎么指定 #3335

zhengduoru opened this issue Feb 16, 2024 · 1 comment

Comments

@zhengduoru
Copy link

我在一个容器中启动了 client,该容器的ip是172.18.0.xxx,容器对应的宿主机ip是 10.148.18.xxx。以下的问题就是关于这两个ip的。

我启动client的命令是java -Dcsp.sentinel.dashboard.server=10.37.135.xxx:8080 -Dproject.name=appA -Dserver.port=7001 -Dspring.application.name=cluster-client-1 -Dcsp.sentinel.heartbeat.client.ip=10.148.18.xxx -jar target/sentinel-cluster-client-1-1.0.0-SNAPSHOT.jar
这里我专门加了一个-Dcsp.sentinel.heartbeat.client.ip参数,把ip指向我的容器对应的宿主机(因为我开了dashboard的机器只能ping到宿主机的ip,ping不通容器的ip)。

但是我发现这个client起来之后,我在开dashboard机器的日志里看到了Failed to fetch metric from http://10.148.18.xxx:8719/metric?startTime=1708088169000&endTime=1708088175000&refetch=false (ConnectionException: Connection refused)

看到这个报错,我就去client的容器里,curl了一下,curl http://10.148.18.xxx:8719/metric\?startTime=1708088169000\&endTime=1708088175000\&refetch=false,显示 Failed to connect to 10.148.18.xxx port 8719: Connection refused

但是 curl了一下,curl http://172.18.0.xxx:8719/metric\?startTime=1708088169000\&endTime=1708088175000\&refetch=false,就显示了正常的日志1708088365000|__system_load__|499200|0|0|0|0|0|0|0
1708088365000|cpu_usage|1563|0|0|0|0|0|0|0

说明这个client起来之后,向dashboard发送日志的服务还是用 172.18.0.xxx 这个ip起来的,不是用我指定的-Dcsp.sentinel.heartbeat.client.ip=10.148.18.xxx起来的,想问下这个问题应该怎么解呀?

@zhengduoru zhengduoru changed the title [BUG] [BUG] 容器ip和宿主机ip怎么指定 Feb 16, 2024
@sirius19
Copy link

sirius19 commented Mar 7, 2024

看一下HeartbeatSender具体使用的哪一个。SpringMvcHttpHeartbeatSender和HttpHeartbeatSender应该都是可以的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants