Springcloud-01-eureka

Source: Internet
Author: User
Tags zookeeper

In the Dubbo Project (http://www.cnblogs.com/wenbronk/p/6774539.html), we used zookeeper as the cluster's registry, and in Springcloud, you can also use zookeeper , but the good plan is Eureka

About the principle of Eureka, have seen a few good blog

http://itmuch.com/spring-cloud-1/http://baike.renwuyi.com/2016-12/18938.htmlhttp://blog.csdn.net/jenny8080/ article/details/52448403http://blog.csdn.net/zipo/article/details/60588647

Next, create a new module named Eureka-discovery

Installation: 1, Pom.xml
        <!--Springcloude-eureka Server-side dependency-        <dependency>            <groupId>org.springframework.cloud< /groupid>            <artifactId>spring-cloud-starter-eureka-server</artifactId>        </dependency >
2, MainClass
Package Com.wenbronk.eureka;import Org.springframework.boot.springapplication;import Org.springframework.boot.autoconfigure.springbootapplication;import Org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; /*  */@SpringBootApplication @enableeurekaserverpublicclass  eurekaapplication {    publicstaticvoid  main (string[] args) {        Springapplication.run (eurekaapplication. class , args);}    }
3, Application.yml
Server:   8761 #  Context-path:/Eurekaeureka:  client:   # do not use    register false as client     fetchfalse    service-URL:      defaultzone:http://  localhost:8761/eureka/

Eureka start, will default to themselves register a copy of their own application, here we use a stand-alone, so it can be banned

4, Log4j2.yml

Self-configuring ...

In this way, launching the app will allow you to have a Eureka registration center.

Access via web:

Password Login configuration:

With Springcloud's official documentation, you can see that the Springcloud can be password-logged via URL::

Added in Pom.xml:
        <!--Add this dependency to set the password--        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-security</artifactId>        </dependency>

Then change the application.yml to the following:

Security:  basic:    true  User:    name:wenbronk    password:a75767626server:   8761 #  Context-path:/Eurekaeureka:  client:   # do not use    register as Client False    fetchfalse    service-URL:      defaultzone:http:  //wenbronk:[email protected]:8761/eureka/

At this time through the browser access, you need to enter a user name and password to login

Springcloud-01-eureka

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.