zoukankan      html  css  js  c++  java
  • Spring Cloud探路(一) Erueka服务器的建立

    组件名:Netflix Eureka 
    作用:支撑微服务的自注册、自发现,提供负载均衡能力

    开发环境使用IDEA

    1.新建Eureka Server,新建maven项目,配置pom.xml
    1. <parent>
    2. <groupId>org.springframework.cloud</groupId>
    3. <artifactId>spring-cloud-starter-parent</artifactId>
    4. <version>Camden.SR5</version>
    5. </parent>
    6. <dependencies>
    7. <dependency>
    8. <groupId>org.springframework.cloud</groupId>
    9. <artifactId>spring-cloud-starter</artifactId>
    10. </dependency>
    11. <dependency>
    12. <groupId>org.springframework.cloud</groupId>
    13. <artifactId>spring-cloud-starter-eureka-server</artifactId>
    14. </dependency>
    15. </dependencies>

    2.新建包及启动类
    1. @SpringBootApplication
    2. @EnableEurekaServer
    3. public class Application {
    4. public static void main(String[] args){
    5. SpringApplication.run(Application.class,args);
    6. }
    7. }

     3.新建配置文件application.yml
    1. server:
    2. port: 1000
    3. eureka:
    4. instance:
    5. hostname: localhost
    6. client:
    7. register-with-eureka: false
    8. fetch-registry: false
    9. spring:
    10. application:
    11. name: eureka-server
    这里主要注意我们的服务注册端口是1000

    4.运行程序,打开浏览器127.0.0.1:1000
     
    erueka服务器启动成功,目前还未有服务注册

    代码:https://github.com/tilv37/eureka-server





  • 相关阅读:
    TiDB架构特性
    TiDB入门
    ansible安装nginx
    linux命令之cowsay
    KeepAlived 搭建高可用的HAProxy集群
    HAProxy 实现镜像队列的负载均衡
    RabbitMQ高可用集群介绍
    docker安装phpMyAdmin
    centos7安装RabbitMQ
    Vim轻量级查看Java代码
  • 原文地址:https://www.cnblogs.com/tilv37/p/6560352.html
Copyright © 2011-2022 走看看