Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
332 views
in Technique[技术] by (71.8m points)

go-micro不能自动发现服务

环境:

  1. go1.14.7
  2. go-micro v2
  3. centos7

暂不涉及数据库等。

go-micro的组网方式:
走的127.0.0.1 或192.168这样的形式都试过。
服务注册方式:mdns

现像:

我用go-micro编写了微服务,编译后的文件上传到centos系统里。
当,我把firewall关掉后,服务功能正常,
当, 开启firewall后,就不能发现节点,找不不到服务。

测试方式:

需要的几个端口也已添加到firewall:
firewall-cmd --zone=public --add-port=5672/tcp --permanent
firewall-cmd --zone=public --add-port=5672/udp --permanent
firewall重启过,连服务器都重启过。
selinux是关闭的。

已经想了很久的办法了,还没搞定,请大佬指点一下。
谢谢!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

后来发现问题了,是centos7中,firewall和iptables的坑,其中iptables的规则链影响了。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...