Comments (4)
@hurukawatinami 您好,将peer1注册到peer2,peer2注册到peer1即可。
您在两台机器无法成功注册,考虑是网络问题,例如A机器不知道B的主机名。可以去掉主机名(hostname)配置,直接用IP。
from spring-cloud-docker-microservice-book-code-docker.
@eacdy 我试过用ip地址,不行。
两个独立的eureka地址分别是:
下面是eureka的yml配置文件:
server:
port: 7021
spring:
profiles: test-211
eureka:
instance:
hostname: discovery-211 #Eureka实例的主机名
prefer-ip-address: true
instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}
client:
serviceUrl:
defaultZone: http://192.168.159.212:7022/eureka/ #Eureka节点相互注册
register-with-eureka: true
---
server:
port: 7022
spring:
profiles: test-212
eureka:
instance:
hostname: discovery-212 #Eureka实例的主机名
prefer-ip-address: true
instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}
client:
serviceUrl:
defaultZone: http://192.168.159.211:7021/eureka/ #Eureka节点相互注册
register-with-eureka: true
from spring-cloud-docker-microservice-book-code-docker.
我的意思是 你在192.168.159.211 机器上ping discovery-212
看能不能通;在192.168.159.212
上ping下ping discovery-211
能不能通;如果不能通,要么配置主机名,让它能ping通,要么就直接改成:
# 公共部分
---
server:
port: 7021
spring:
profiles: test-211
eureka:
instance:
prefer-ip-address: true
instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}
client:
serviceUrl:
defaultZone: http://192.168.159.212:7022/eureka/ #Eureka节点相互注册
register-with-eureka: true
---
server:
port: 7022
spring:
profiles: test-212
eureka:
instance:
prefer-ip-address: true
instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}
client:
serviceUrl:
defaultZone: http://192.168.159.211:7021/eureka/ #Eureka节点相互注册
register-with-eureka: true
或者简写:
eureka:
instance:
prefer-ip-address: true
instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}
client:
serviceUrl:
defaultZone: http://192.168.159.212:7022/eureka/,http://192.168.159.211:7021/eureka/
---
server:
port: 7021
spring:
profiles: test-211
---
server:
port: 7022
spring:
profiles: test-212
from spring-cloud-docker-microservice-book-code-docker.
好的,谢谢老师。我先试试
from spring-cloud-docker-microservice-book-code-docker.
Related Issues (3)
- springcloud群满了 HOT 1
- docker-1-simple build failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud-docker-microservice-book-code-docker.