springCould 基础服务搭建

gitlab 创建项目

gitlab 或github 创建项目组,并且下载到本地
在这里插入图片描述

  • itoken-eureka 服务注册与发现
  • itoken-config 项目配置
  • itoken-config-respo 项目配置文件存放的位置
  • itoken-zipkin 服务追踪
  • itoken-zuul api网关
  • itoken-admin 服务监控
  • itoken-dependecies pom依赖管理

使用分布式配置中心搭建

这里拿itoken-config 和 itoken-eureka 做解释

# itoken-eureka.yml
spring:
  cloud:
    config:
      name: itoken-eureka
      profile: dev
      uri: http://localhost:8888/
      label: master

这里之前是部署了gitlab的,但是有个坑自己没有解决。就是gitlab上面的项目我无法读取到配置,相同的代码我github就能读取到,暂时还未解决

# itoken-config.yml
spring:
  application:
    name: itoken-config
  cloud:
    config:
      label: master
      server:
        git:
          uri: https://github.com/itoken-test/itoken-config-respo/
          search-paths: respo
          username: [email protected]
          password: sjm69362877
#          uri: http://192.168.0.146/itoken/itoken-config-respo.git    #项目名称
#          search-paths: config-repo         #资源文件 文件夹
#          username: [email protected]
#          password: xxxx
  zipkin:
    base-url: http://localhost:9411

server:
  port: 8888

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/


# itoken-config-repso 远程git仓库
# itoken-eureka-dev.yml
# 这也是 eureka 真正的配置
spring:
  application:
    name: itoken-eureka

server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      default-zone: http://${eureka.instance.hostname}:${server.port}/eureka/

本博客只是记录一下,自己在学习分布式配置中心时遇到的坑
还有为何能读到github上的配置,却无法读取自己部署在公司内网上的gitlab上的配置

发布了46 篇原创文章 · 获赞 6 · 访问量 2667

猜你喜欢

转载自blog.csdn.net/renguiriyue/article/details/102756028