GRPC服务启动时使用 127.0.0.0 地址和 0.0.0.0 不会报错 使用 47.242.66.148 IP地址出现下面的错误
47.242.66.148 50051
E0612 03:20:44.603134815 1787294 server_chttp2.cc:49] {“created”:"@1623439244.603096442",“description”:“No address added out of total 1 resolved”,“file”:“src/core/ext/transport/chttp2/server/chttp2_server.cc”,“file_line”:872,“referenced_errors”:[{“created”:"@1623439244.603084454",“description”:“Unable to configure socket”,“fd”:6,“file”:“src/core/lib/iomgr/tcp_server_utils_posix_common.cc”,“file_line”:216,“referenced_errors”:[{“created”:"@1623439244.603080477",“description”:“Cannot assign requested address”,“errno”:99,“file”:“src/core/lib/iomgr/tcp_server_utils_posix_common.cc”,“file_line”:190,“os_error”:“Cannot assign requested address”,“syscall”:“bind”}]}]}
Traceback (most recent call last):
File “/data/AlTrading/user_srv/server.py”, line 38, in
serve()
File “/data/AlTrading/user_srv/server.py”, line 24, in serve
server.add_insecure_port(f’{args.host}:{args.port}’)
File “/root/.virtualenvs/AlTrading/lib/python3.8/site-packages/grpc/_server.py”, line 970, in add_insecure_port
return _common.validate_port_binding_result(
File “/root/.virtualenvs/AlTrading/lib/python3.8/site-packages/grpc/_common.py”, line 166, in validate_port_binding_result
raise RuntimeError(_ERROR_MESSAGE_PORT_BINDING_FAILED % address)
RuntimeError: Failed to bind to address 47.242.66.148:50051; set GRPC_VERBOSITY=debug environment variable to see detailed error message.