zoukankan      html  css  js  c++  java
  • Apollo演进及实践

    一、Apollo调用过程

     二、功能模块

    1. ConfigService: 配置获取接口,配置推送接口,服务Apollo客户端(/services/admin...)
    2. AdminService:配置管理,修改发布接口,服务管理界面Portal
    3. Client:应用获取配置(支持实时更新,通过MetaServer获取ConfigService的服务列表,使用客户端软负载SLB方式调用ConfigService)
    4. Portal:配置管理界面,通过MetaServer获取AdminService的服务列表,使用客户端软负载SLB方式调用AdminService
    5.  MetaServer:相当于一个Eureka Proxy,和ConfigService一起部署
    Portal通过域名访问MetaServer获取AdminService的地址列表
    Client通过域名访问MetaServer获取ConfigService的地址列表
    1. NginxLB:和域名系统配合
    协助Portal访问MetaServer获取AdminService地址列表
    协助Client访问MetaServer获取ConfigService地址列表
    协助用户访问Portal进行配置管理
     
    三、架构演进
    • Client和ConfigService保持长连接,通过一种拖拉结合(push & pull)的模式,实现配置实时更新的同时,保证配置更新不丢失。
    • Client通过 ConfigService进行配置获取、Portal通过调用AdminService进行配置管理和发布。
    • ConfigService和AdminService共享ConfigDB,ConfigDB中存放项目在某个环境的配置信息。
    • Protal有一个独立的PortalDB,存放用户权限、项目和配置的元数据信息。Protal只需部署一份,它可以管理多套环境。
    •  Client怎么找到ConfigService?Portal怎么找到AdminService?注册中心
    •  完善成形,妥妥的微服务架构
    • 引入MetaServer,将Eureka的服务发现接口以更简单明确的HTTP接口的形式暴露出来,方便Client/Protal通过简单的HTTPClient就可以查询到Config/AdminService的地址列表。获取到服务实例地址列表之后,再以简单的客户端软负载(Client SLB)策略路由定位到目标实例,并发起调用。
    • MetaServer无状态部署,可为MetaServer集群配置一个域名,指向NginxLB集群,NginxLB再对MetaServer进行负载均衡和流量转发。
    • 用户通过域名+NginxLB间接访问MetaServer集群
    四、实践
    1. 源码 :https://github.com/ctripcorp/apollo.git
    2. SpringSecurity鉴权放过(permitAll)
    @Order(99)
    //  @Profile("auth")
      @Configuration
      @EnableWebSecurity
      @EnableGlobalMethodSecurity(prePostEnabled = true)
      static class SpringSecurityConfigurer extends WebSecurityConfigurerAdapter {
        @Override
        protected void configure(HttpSecurity http) throws Exception {
          http.csrf().disable();
          http.headers().frameOptions().sameOrigin();
          http.authorizeRequests()
              .antMatchers("/**").permitAll();
        }
      }

      3.  启动参数:

      • apollo-admin.jar  -Dapollo_profile=github
      • apollo-configservice.jar   -Dapollo_profile=github
      • apollo-portal.jar -Dapollo_profile=github,auth
    1. 数据库:
      • 注册中心 apolloconfigdb_dev
    update serverconfig
    set `Value` = "http://localhost:30000/eureka/"
    WHERE `Key` = "eureka.service.url"
      • 部门列表 applloportaldb,
                修改部门信息organizations,
                apollo.portal.envs和configView.memberOnly.envs配置相对应环境,逗号隔开
    1. 配置文件整合
      • 将bootstrap.yml,application.yml,adminservice.properties整合到application-github.properties(注意common也会引入这个文件,相同名称会覆盖,改为其他文件数据库会找不到)
      • 启动添加@PropertySource(value = {"file:${APOLLO_CONFIG_PATH}/application-github.properties"})
     
    转载请注明地址:http://www.cnblogs.com/handsomecui/
     
  • 相关阅读:
    ASP.NET Forms验证(自定义、角色提供程序)B
    SPSiteDataQuery使用说明
    moss2010 仿内容查询部件代码
    微软CRM系统二次开发步骤以及注意事项
    sap ABAP关于Data Reference的使用FIELDSYMBOLS
    selectoptions 模拟parmater
    ABAP "FOR ALL ENTRIES IN" 使用指南
    ABAP/4中参数的传递
    用接口CL_GUI_FRONTEND_SERVICES弹出选择文件对话框
    深入浅出理解索引结构
  • 原文地址:https://www.cnblogs.com/handsomecui/p/13717467.html
Copyright © 2011-2022 走看看