Eureka多网卡选择
ip注册
eureka:
instance:
prefer-ip-address: true
表示将自己的ip注册到EurekaServer上。不配置或false,表示将操作系统的hostname注册到server
服务器有多个网卡
eh0,eh1,eh2,只有eh0可以让外部其他服务访问进来,而Eureka client将eh1和eh2注册到Eureka server上,这样其他服务就无法访问该微服务了
指定Ip
eureka:
instance:
prefer-ip-address: true
ip-address: 实际能访问到的Ip
如果设置了此时的ip-address,在元数据查看到就是此ip,其他服务也通过此ip来调用
{
"host": "127.0.0.1",
"port": 8084,
"metadata": {
"yueyi": "2019",
"user.password": "root",
"management.port": "8084",
"jmx.port": "61378",
"user.name": "root"
},
"secure": false,
"uri": "http://127.0.0.1:8084",
"instanceId": "api-listen-order:30.136.133.11:port",
"serviceId": "API-LISTEN-ORDER",
"instanceInfo": {
"instanceId": "api-listen-order:30.136.133.11:port",
"app": "API-LISTEN-ORDER",
"appGroupName": null,
"ipAddr": "127.0.0.1",
"sid": "na",
"homePageUrl": "http://127.0.0.1:8084/",
"statusPageUrl": "http://127.0.0.1:8084/actuator/info",
"healthCheckUrl": "http://127.0.0.1:8084/actuator/health",
"secureHealthCheckUrl": null,
"vipAddress": "api-listen-order",
"secureVipAddress": "api-listen-order",
"countryId": 1,
"dataCenterInfo": {
"@class": "com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo",
"name": "MyOwn"
},
"hostName": "127.0.0.1",
"status": "UP",
"overriddenStatus": "UNKNOWN",
"leaseInfo": {
"renewalIntervalInSecs": 1,
"durationInSecs": 1,
"registrationTimestamp": 1579489514655,
"lastRenewalTimestamp": 1579489524146,
"evictionTimestamp": 0,
"serviceUpTimestamp": 1579489514147
},
"isCoordinatingDiscoveryServer": false,
"metadata": {
"yueyi": "2019",
"user.password": "root",
"management.port": "8084",
"jmx.port": "61378",
"user.name": "root"
},
"lastUpdatedTimestamp": 1579489514655,
"lastDirtyTimestamp": 1579489514111,
"actionType": "ADDED",
"asgName": null
},
"scheme": null
}
论读书
睁开眼,书在面前 闭上眼,书在心里
睁开眼,书在面前 闭上眼,书在心里