以debug(调试)方式启动会报错 Warning: stream_socket_server(): unable to connect to tcp://xxxxxxxxx:2903 (Cannot assign requested address) 不知道是哪里的配置没对应上,服务器的安全组已经加上了这端口了的
监听的IP不属于本机。本机拥有哪些IP用 ifconfig命令查看
IP就是服务器的外网IP
我换成本地的IP127.0.0.1就可以
[root@hecs-x-large-2-linux-20210330100122 GatewayWorker]# ifconfig docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0 ether 02:42:25:d9:4f:40 txqueuelen 0 (Ethernet) RX packets 812119 bytes 1563367274 (1.4 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 674506 bytes 205203633 (195.6 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.154 netmask 255.255.255.0 broadcast 192.168.0.255 ether fa:16:3e:e3:f4:09 txqueuelen 1000 (Ethernet) RX packets 8794694 bytes 5843409276 (5.4 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9111807 bytes 3253656652 (3.0 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1000 (Local Loopback) RX packets 5995178 bytes 2567933836 (2.3 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 5995178 bytes 2567933836 (2.3 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth6640ac8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether a6:ed:e6:91:f7:c8 txqueuelen 0 (Ethernet) RX packets 39 bytes 28999 (28.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 45 bytes 17302 (16.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
说明外网ip不属于本机,所以监听不了。你这个外网ip应该只是一个类似代理设备,云服务器一般都这样。
监听的IP不属于本机。本机拥有哪些IP用 ifconfig命令查看
IP就是服务器的外网IP
我换成本地的IP127.0.0.1就可以
[root@hecs-x-large-2-linux-20210330100122 GatewayWorker]# ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
ether 02:42:25:d9:4f:40 txqueuelen 0 (Ethernet)
RX packets 812119 bytes 1563367274 (1.4 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 674506 bytes 205203633 (195.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.154 netmask 255.255.255.0 broadcast 192.168.0.255
ether fa:16:3e:e3:f4:09 txqueuelen 1000 (Ethernet)
RX packets 8794694 bytes 5843409276 (5.4 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9111807 bytes 3253656652 (3.0 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 5995178 bytes 2567933836 (2.3 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5995178 bytes 2567933836 (2.3 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth6640ac8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether a6:ed:e6:91:f7:c8 txqueuelen 0 (Ethernet)
RX packets 39 bytes 28999 (28.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 45 bytes 17302 (16.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
说明外网ip不属于本机,所以监听不了。你这个外网ip应该只是一个类似代理设备,云服务器一般都这样。