配置hosts,修复注册中心不高可用的问题
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "192.168.100.26 www.config.com" >> /etc/hosts
|
||||
echo "192.168.100.26 www.register1.com" >> /etc/hosts
|
||||
echo "192.168.100.26 www.register2.com" >> /etc/hosts
|
||||
echo "192.168.100.26 www.upms.com" >> /etc/hosts
|
||||
echo "192.168.100.26 www.cms.com" >> /etc/hosts
|
||||
echo "192.168.100.26 www.ucenter.com" >> /etc/hosts
|
||||
echo "192.168.100.26 www.gateway.com" >> /etc/hosts
|
||||
echo "192.168.100.26 www.mall.com" >> /etc/hosts
|
||||
echo "192.168.100.26 www.pay.com" >> /etc/hosts
|
||||
echo "127.0.0.1 www.config.com" >> /etc/hosts
|
||||
echo "127.0.0.1 www.register1.com" >> /etc/hosts
|
||||
echo "127.0.0.1 www.register2.com" >> /etc/hosts
|
||||
echo "127.0.0.1 www.upms.com" >> /etc/hosts
|
||||
echo "127.0.0.1 www.cms.com" >> /etc/hosts
|
||||
echo "127.0.0.1 www.ucenter.com" >> /etc/hosts
|
||||
echo "127.0.0.1 www.gateway.com" >> /etc/hosts
|
||||
echo "127.0.0.1 www.mall.com" >> /etc/hosts
|
||||
echo "127.0.0.1 www.pay.com" >> /etc/hosts
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Register",
|
||||
name: 'Register',
|
||||
data () {
|
||||
return {
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export default new Router({
|
||||
path: '/',
|
||||
name: 'SignIn',
|
||||
component: SignIn
|
||||
},{
|
||||
}, {
|
||||
path: '/register',
|
||||
name: 'Register',
|
||||
component: Register
|
||||
|
||||
@@ -15,4 +15,4 @@ eureka:
|
||||
serviceUrl:
|
||||
defaultZone: http://micro:fast@3z3wg7.natappfree.cc:10002/eureka/,http://micro:fast@3z3wg7.natappfree.cc:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: 3z3wg7.natappfree.cc
|
||||
hostname: www.cms.com
|
||||
@@ -24,4 +24,3 @@ security:
|
||||
name: config
|
||||
password: server
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ spring:
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://micro:fast@3z3wg7.natappfree.cc:10002/eureka/,http://micro:fast@3z3wg7.natappfree.cc:10004/eureka/ #配置所有的注册中心
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: 3z3wg7.natappfree.cc
|
||||
hostname: www.config.com
|
||||
appname: config-server
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ spring:
|
||||
eureka:
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://micro:fast@3z3wg7.natappfree.cc:10002/eureka/,http://micro:fast@3z3wg7.natappfree.cc:10004/eureka/ #配置所有的注册中心
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: 3z3wg7.natappfree.cc
|
||||
hostname: www.gateway.com
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
###注册中心
|
||||
相同的hostname的注册中心eureka会认为是这些euraka在同一台物理机上,这些eureka会一共存储
|
||||
一份注册者的信息,而不是每个注册中心存储一份。所以在同一台机器上模拟高可用注册中心的时候
|
||||
必须修改hosts文件,注册中心使用不同的hostname
|
||||
@@ -2,13 +2,13 @@
|
||||
spring:
|
||||
cloud:
|
||||
config:
|
||||
uri: http://config:server@3z3wg7.natappfree.cc:10000/
|
||||
uri: http://config:server@www.config.com:10000/
|
||||
profile: dev
|
||||
label: master
|
||||
name: eureka-server
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://micro:fast@3z3wg7.natappfree.cc:10004/eureka #和其他注册中心连接
|
||||
defaultZone: http://micro:fast@www.register2.com:10004/eureka #和其他注册中心连接
|
||||
instance:
|
||||
hostname: 3z3wg7.natappfree.cc
|
||||
hostname: www.register1.com
|
||||
@@ -4,10 +4,10 @@ spring:
|
||||
name: eureka-server2
|
||||
profile: dev
|
||||
label: master
|
||||
uri: http://config:server@3z3wg7.natappfree.cc:10000/
|
||||
uri: http://config:server@www.config.com:10000/
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://micro:fast@3z3wg7.natappfree.cc:10002/eureka #和其他注册中心连接
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka #和其他注册中心连接
|
||||
instance:
|
||||
hostname: 3z3wg7.natappfree.cc
|
||||
hostname: www.register2.com
|
||||
@@ -13,6 +13,6 @@ spring:
|
||||
eureka:
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://micro:fast@3z3wg7.natappfree.cc:10002/eureka/,http://micro:fast@3z3wg7.natappfree.cc:10004/eureka/ #配置所有的注册中心
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: 3z3wg7.natappfree.cc
|
||||
hostname: www.ucenter.com
|
||||
|
||||
@@ -13,7 +13,7 @@ spring:
|
||||
eureka:
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://micro:fast@3z3wg7.natappfree.cc:10002/eureka/,http://micro:fast@3z3wg7.natappfree.cc:10004/eureka/ #配置所有的注册中心
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: 3z3wg7.natappfree.cc
|
||||
hostname: www.upms.com
|
||||
|
||||
|
||||
Reference in New Issue
Block a user