各位大佬好,我想把dubbo服务提供者部署到阿里云上,然后在本地运行服务消费者,试了好多网上的方法,都不管用。阿里的安全组也放行了。
我用docker-compose部署的,而且设置了ip与端口,配置如下:
(我也试过docker-compose中不配置environment,不行。)
version: '3.1'
services:
provider-ucenter:
build: ./provider-ucenter/
image: provider-ucenter:1.0.0
restart: always
container_name: provider-ucenter
environment:
DUBBO_IP_TO_REGISTRY: 39.105.137.237
DUBBO_PORT_TO_REGISTRY: 8500
ports:
- "8500:8500"
provider-message:
build: ./provider-message/
image: provider-message:1.0.0
restart: always
container_name: provider-message
environment:
DUBBO_IP_TO_REGISTRY: 39.105.137.237
DUBBO_PORT_TO_REGISTRY: 8530
ports:
- "8530:8530"
运行后,nacos控制台显示服务均上线:
而且各服务的IP,端口都正确,如userservice:
然后,我在本地跑服务消费者,报错:
org.apache.dubbo.remoting.RemotingException: client(url: dubbo://39.105.137.237:8500/com.supermarket.manage.provider.api.ucenter.UserService?anyhost=true&application=business-cloud&bean.name=ServiceBean:com.supermarket.manage.provider.api.ucenter.UserService:1.0.0&category=providers&check=false&codec=dubbo&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&heartbeat=60000&interface=com.supermarket.manage.provider.api.ucenter.UserService&lazy=false&methods=getCountByPhone,getUserByUsername,bindPhone,updatePasswordById,getCountByUsername,insertUser,updateUserById,untiePhone,getUsernameByUserId,userLoginByUsername,getUserByUserId,getUserByBuyerId,register&path=com.supermarket.manage.provider.api.ucenter.UserService&pid=3176&protocol=dubbo&qos.enable=false®ister=true®ister.ip=192.168.18.1&release=2.7.3&remote.application=provider-ucenter&revision=1.0.0&serialization=kryo&side=consumer&sticky=false&timeout=5000×tamp=1584871255294&version=1.0.0) failed to connect to server /39.105.137.237:8500, error message is:Connection refused: no further information: /39.105.137.237:8500
但是把提供者和消费者放在同一个服务器上就能成功。
请问大佬们有没有什么好的建议