zoukankan      html  css  js  c++  java
  • Apollo系列(一):分布式配置中心Apollo安装(Linux、Docker)

    一.介绍

    Apollo(阿波罗)是携程框架部门研发的分布式配置中心,能够集中化管理应用不同环境、不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限、流程治理等特性,适用于微服务配置管理场景。

    服务端基于Spring Boot和Spring Cloud开发,打包后可以直接运行,不需要额外安装Tomcat等应用容器。

    Java客户端不依赖任何框架,能够运行于所有Java运行时环境,同时对Spring/Spring Boot环境也有较好的支持。

    .Net客户端不依赖任何框架,能够运行于所有.Net运行时环境。

    二.安装

    1.创建ApolloPortalDB

    下载地址:https://github.com/ctripcorp/apollo/blob/master/scripts/sql/apolloportaldb.sql

    2.创建ApolloConfigDB

    下载地址:https://github.com/ctripcorp/apollo/blob/master/scripts/sql/apolloconfigdb.sql

    创建完之后

     3.下载安装包

    下载:apollo-adminservice-1.7.1-github.zipapollo-configservice-1.7.1-github.zipapollo-portal-1.7.1-github.zip

    下载地址:https://github.com/ctripcorp/apollo/releases

    4.Linux下解压运行

    执行命令:

    mkdir admin portal config

    解压:

    unzip apollo-configservice-1.7.1-github.zip -d config/
    unzip apollo-adminservice-1.7.1-github.zip  -d admin/
    unzip apollo-portal-1.7.1-github.zip  -d portal/

    创建config日志文件:

    [root@VM-0-8-centos apollo-start]# cd config/
    [root@VM-0-8-centos config]# ls
    apollo-configservice-1.7.1.jar          apollo-configservice.conf  apollo-configservice_usrlocalapplicationapolloapollo-startconfig.pid  scripts
    apollo-configservice-1.7.1-sources.jar  apollo-configservice.jar   config
    [root@VM-0-8-centos config]# cat apollo-configservice.conf 
    MODE=service
    PID_FOLDER=.
    LOG_FOLDER=/opt/logs/100003171/[root@VM-0-8-centos config]# mkdir /opt/logs/100003171/

    进入config文件夹,修改配置,具体配置如下:

    [root@VM-0-8-centos config]# cd config/
    [root@VM-0-8-centos config]# ls
    application-github.properties  app.properties
    [root@VM-0-8-centos config]# cat application-github.properties 
    # DataSource
    spring.datasource.url = jdbc:mysql://localhost:3306/ApolloConfigDB?characterEncoding=utf8
    spring.datasource.username =username
    spring.datasource.password =password
    [root@VM-0-8-centos config]# 

    启动config-service:

    [root@VM-0-8-centos config]# cd ../
    [root@VM-0-8-centos config]# cd scripts/
    [root@VM-0-8-centos scripts]# ls
    shutdown.sh  startup.sh
    [root@VM-0-8-centos scripts]# sh startup.sh 

    admin-service和这个操作一样,就不演示了

    portal操作:

    [root@VM-0-8-centos apollo-start]# cd portal/
    [root@VM-0-8-centos portal]# ls
    apollo-portal-1.7.1.jar  apollo-portal-1.7.1-sources.jar  apollo-portal.conf  apollo-portal.jar  apollo-portal_usrlocalapplicationapolloapollo-startportal.pid  config  scripts
    [root@VM-0-8-centos portal]# cat apollo-portal.conf 
    MODE=service
    PID_FOLDER=.
    LOG_FOLDER=/opt/logs/100003173/[root@VM-0-8-centos portal]# cd config/
    [root@VM-0-8-centos config]# ls
    apollo-env.properties  application-github.properties  app.properties
    [root@VM-0-8-centos config]# cat apollo-env.properties 
    local.meta=http://localhost:8080
    dev.meta=http://localhost:8080
    #fat.meta=http://fill-in-fat-meta-server:8080
    #uat.meta=http://fill-in-uat-meta-server:8080
    #lpt.meta=${lpt_meta}
    #pro.meta=http://fill-in-pro-meta-server:8080
    [root@VM-0-8-centos config]# cat application-github.properties 
    # DataSource
    spring.datasource.url = jdbc:mysql://localhost:3306/ApolloPortalDB?characterEncoding=utf8
    spring.datasource.username = username
    spring.datasource.password =password

    之后进去scripts文件夹启动

    [root@VM-0-8-centos config]# cd ../
    [root@VM-0-8-centos portal]# cd scripts/
    [root@VM-0-8-centos scripts]# ls
    shutdown.sh  startup.sh
    [root@VM-0-8-centos scripts]# sh startup.sh 

    5.Docker运行

    运行apollo-configservice:

    docker run -p 8080:8080 
        -e SPRING_DATASOURCE_URL="jdbc:mysql://localhost:3306/ApolloConfigDB_DEV?characterEncoding=utf8" 
        -e SPRING_DATASOURCE_USERNAME=username -e SPRING_DATASOURCE_PASSWORD=password 
        -d -v /tmp/logs:/opt/logs --name apollo-configservice apolloconfig/apollo-configservice

    运行apollo-adminservice:

    docker run -p 8090:8090 
        -e SPRING_DATASOURCE_URL="jdbc:mysql://localhost:3306/ApolloConfigDB_DEV?characterEncoding=utf8" 
        -e SPRING_DATASOURCE_USERNAME=username -e SPRING_DATASOURCE_PASSWORD=password 
        -d -v /tmp/logs:/opt/logs --name apollo-adminservice apolloconfig/apollo-adminservice

    运行apollo-partal:

    docker run -p 8070:8070 
        -e SPRING_DATASOURCE_URL="jdbc:mysql://localhost:3306/ApolloPortalDB?characterEncoding=utf8" 
        -e SPRING_DATASOURCE_USERNAME=username -e SPRING_DATASOURCE_PASSWORD=password 
        -e APOLLO_PORTAL_ENVS=dev 
        -e DEV_META=http://localhost:8070 -e 
        -d -v /tmp/logs:/opt/logs --name apollo-portal apolloconfig/apollo-portal
  • 相关阅读:
    John Resig 见面会视频
    《程序员羊皮卷》书评
    用 JavaScript 对 JSON 进行模式匹配 (Part 2 实现)
    工具:开发者使用,企业埋单
    「云端 JavaScript 漫游指南」
    如何让你的网站支持 IE9 Pinned Site (Part 1 理论)
    世界顶级黑客自传:Ghost in the Wires
    MVP Summit 2010 Trip (WA)
    Apple 谈论产品 vs Microsoft 谈论技术
    IBatisNet开发使用小结 之二
  • 原文地址:https://www.cnblogs.com/vic-tory/p/13736192.html
Copyright © 2011-2022 走看看