1.将eureka部署在一台服务器A
2.将Zuul注册eureka,部署在第二台服务器B
Zuul配置服务中一定要加url,否则访问不到,url是服务部署的服务器,比如user服务的C服务器
user:
path: /user/**
serviceId: user
sensitiveHeaders: "*"
url: http://服务部署的IP地址:端口号/
3.将user服务注册eureka,部署在第三台服务器C
最后便可以成功访问user服务:
{
"status": 0,
"data": {
"id": 59,
"username": "cay",
"email": "wqeqw@wqewq",
"phone": "123131321",
"question": "name",
"answer": "111",
"role": 1,
"createTime": "2020-02-25T02:01:05.000+0000",
"updateTime": "2020-02-25T02:01:08.000+0000",
"ip": ""
},
"count": 0
}