MicroServices Architecture Springcloud (iii) EUREKA (Registration center cluster chapter)

Source: Internet
Author: User

A: Cluster environment construction
First step: We create a new two registry project called Eureka_register_service_master, another called Eureka_register_service_backup

The application.properties configuration for Eureka_register_service_master is as follows

    server.port=7998    eureka.client.register-with-eureka=false    eureka.client.fetch-registry=false    spring.application.name=eureka-server    eureka.instance.hostname=master    eureka.client.serviceUrl.defaultZone=http://backup:7999/eureka/    #这里配置的是backup的地址    eureka_register_service_backup的application.properties配置如下

The application.properties configuration for Eureka_register_service_backup is as follows

`    server.port=7999eureka.client.register-with-eureka=falseeureka.client.fetch-registry=falsespring.application.name=eureka-servereureka.instance.hostname=backup#这里配置的是master的地址eureka.client.serviceUrl.defaultZone=http://master:7998/eureka/`    上面的配置端口分别是     master端口是7998

BACKUPR Port is 7999

Because I'm using the same machine, I need to bind the host.

127.0.0.1 Master

127.0.0.1 Backup

The second step: Add boot files are Applicationmaster.java,applicationbackup.java

The contents of the code are the same

        @EnableEurekaServer    @SpringBootApplication    public class ApplicationMaster {        public static void main(String[] args) {            SpringApplication.run(ApplicationMaster.class, args);         }    }    @EnableEurekaServer    @SpringBootApplication    public class ApplicationBackUp {        public static void main(String[] args) {            SpringApplication.run(ApplicationBackUp.class, args);        }    }   

Step Three: Start

If the jar is started, the parameter--spring.profiles.active=matser or--spring.profiles.active=backup is required.

The first method is to start with the jar command

' Java-jar Eureka_register_service_matser-1.0.0.jar--spring.profiles.active=matser

 java -jar eureka_register_service_backup-1.0.0.jar --spring.profiles.active=backup`     架构代码如下:     ![](http://i2.51cto.com/images/blog/201802/08/e143be457842bf385ec7e011c6f70093.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

MicroServices Architecture Springcloud (iii) EUREKA (Registration center cluster chapter)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.