问题现象
项目引入
<dependency>
<groupId>com.taobao.arthas</groupId>
<artifactId>arthas-spring-boot-starter</artifactId>
<version>3.5.4</version>
</dependency>
后,本地启动1个服务没问题,当启动2个服务时,第2个服务报错如下:
Arthas failed to bind telnet or http port! Telnet port: 3658, http port: 8563


解决方案
官方给出答案:

增加配置
#如果配置 arthas.telnetPort为 -1 ,则不listen telnet端口。arthas.httpPort类似
arthas.telnetPort=-1
arthas.httpPort=-1
原因
服务器启动 Arthas Server 后,其他人可以使用 telnet 远程连接上去进程诊断,telnet 的默认ip 和 端口 分别是是 127.0.0.1 和 3658。
Arthas 目前支持 两种连接方式,其中Web Console方式会在程序启动后attach 自身进程,用户在 attach 成功之后,可以直接访问:http://127.0.0.1:8563/。
因此增加配置后即可解决多服务无法一起启动的问题。
github:https://github.com/alibaba/arthas/issues/1775
Arthas Properties:https://arthas.aliyun.com/en/doc/arthas-properties.html#supported-configuration-items
Arthas多实例启动问题与解决方案
当在项目中引入Arthas的spring-boot-starter依赖并启动多个服务时,第二个服务会因为端口冲突报错。官方建议在配置中设置`arthas.telnetPort=-1`和`arthas.httpPort=-1`,以禁止监听telnet和http端口,从而解决多服务同时启动的问题。Arthas提供telnet和WebConsole两种连接方式,未禁用时可能导致远程诊断端口被占用。
1322

被折叠的 条评论
为什么被折叠?



