SpringCloud学习踩坑记<一>
SpringCloud版本迭代实在太快,学习起来也是各种坑,博主用的是"当前"的最新版本,借鉴周立老大的Spring Cloud与Docker微服务架构实战一书进行学习.
1.JDK版本→1.8.0_171
2.Springboot版本→2.0.4.RELEASE
3.SpringCloud版本→Finchley.SR1
4.IDE→idea
5.系统→Windows7
以下是各种坑:)
1.eureka集群配置:
application.yml文件:
之前:
##服务器参数配置
spring:
application:
name: microservice-discovery-eureka-ha
---
spring:
#指定profile为peer1
profiles: peer1
server:
port: 8761
eureka:
instance:
#指定当profile为peer1时,主机名是peer1
hostname: peer1
client:
serviceUrl:
#将自己注册到peer2这个的eureka上面
defaultZone: http://peer2:8762/eureka/ ---
spring:
#指定profile为peer2
profiles: peer2
server:
port: 8762
eureka:
instance:
#指定当profile为peer2时,主机名是peer2
hostname: peer2
client:
serviceUrl:
#将自己注册到peer1这个的eureka上面
defaultZone: http://peer1:8761/eureka/
之后:
##服务器参数配置
spring:
application:
name: microservice-discovery-eureka-ha
--- server:
port: 8761
spring:
#指定profile为peer1
profiles: peer1
eureka:
instance:
#指定当profile为peer1时,主机名是peer1
hostname: peer1
client:
serviceUrl:
#将自己注册到peer2这个的eureka上面
defaultZone: http://peer2:8762/eureka/ --- server:
port: 8762
spring:
#指定profile为peer2
profiles: peer2
eureka:
instance:
#指定当profile为peer2时,主机名是peer2
hostname: peer2
client:
serviceUrl:
#将自己注册到peer1这个的eureka上面
defaultZone: http://peer1:8761/eureka/
================================================================================
server:
port:
需放在外层