美文网首页
携程Apollo部署

携程Apollo部署

作者: 于飞_d529 | 来源:发表于2019-11-05 15:21 被阅读0次

    Apollo部署

    版本

    JDK 1.8.0_161
    mysql 5.7
    apollo 1.4.0
    

    服务器

    192.168.20.23 apollo-configservice apollo-configservice mysql
    192.168.20.25 apollo-portal
    

    安装目录

    /usr/local/apollo/
    

    应用对应端口

    apollo-configservice 24000
    apollo-adminservice  24001
    apollo-portal        24000
    

    apollo-configservice部署

    • 下载所需资源包
      https://github.com/ctripcorp/apollo/releases/tag/v1.4.0
      apollo-adminservice-1.4.0-github.zip
      apollo-configservice-1.4.0-github.zip
      apollo-portal-1.4.0-github.zip
      
    • 解压
      [root@cn2023 apollo]# unzip apollo-configservice-1.4.0-github.zip /usr/local/apollo/apollo-configservice/
      [root@cn2023 apollo]# unzip apollo-adminservice-1.4.0-github.zip -d /usr/local/apollo/apollo-adminservice/
      [root@cn2023 apollo-configservice]# ll
      total 60496
      -rwxr-xr-x. 1 root root 61898966 May  3 19:17 apollo-configservice-1.4.0.jar
      -rwxr-xr-x. 1 root root    39040 May  3 19:17 apollo-configservice-1.4.0-sources.jar
      -rw-r--r--. 1 root root       57 Apr 20  2017 apollo-configservice.conf
      drwxr-xr-x. 2 root root       63 Nov  1 13:35 config
      drwxr-xr-x. 2 root root       41 Apr 19  2019 scripts
      [root@cn2023 apollo-adminservice]# ll
      total 56936
      -rwxr-xr-x. 1 root root 58267291 May  3 19:17 apollo-adminservice-1.4.0.jar
      -rwxr-xr-x. 1 root root    26042 May  3 19:17 apollo-adminservice-1.4.0-sources.jar
      -rw-r--r--. 1 root root       57 Apr 20  2017 apollo-adminservice.conf
      drwxr-xr-x. 2 root root       63 Nov  1 13:36 config
      drwxr-xr-x. 2 root root       41 Apr 19  2019 scripts
      
    • 导入sql脚本
      mysql> source ~/apollo/V1.0.0__initialization.sql
      
    • 验证
      mysql> select `Id`, `Key`, `Value`, `Comment` from `ApolloConfigDB`.`ServerConfig` limit 1;
      +----+--------------------+-------------------------------+------------------------------------------------------+
      | Id | Key                | Value                         | Comment                                              |
      +----+--------------------+-------------------------------+------------------------------------------------------+
      |  1 | eureka.service.url | http://localhost:8080/eureka/ | Eureka服务Url,多个service以英文逗号分隔             |
      +----+--------------------+-------------------------------+------------------------------------------------------+
      1 row in set (0.00 sec)
      
    • 修改apollo-configservice数据库连接配置
      [root@cn2023 config]# cd /usr/local/apollo/apollo-configservice/config
      [root@cn2023 config]# vim application-github.properties
      # DataSource
      spring.datasource.url = jdbc:mysql://192.168.20.23:3306/ApolloConfigDB?characterEncoding=utf8
      spring.datasource.username = root
      spring.datasource.password = cmcc1234
      
    • 服务器双网卡的情况需要修改启动脚本防止不可达网卡被注册
      [root@cn2023 scripts]# vim startup.sh 
      -Deureka.instance.ip-address=192.168.20.23
      
    • 启动
      [root@cn2023 scripts]# ./startup.sh 
      Fri Nov  1 14:26:48 CST 2019 ==== Starting ==== 
      Started [32756]
      Waiting for server startup.......
      Fri Nov  1 14:27:24 CST 2019 Server started in 35 seconds!
      

    apollo-adminservice部署

    • 修改apollo-adminservice数据库连接配置
      [root@cn2023 config]# cd /usr/local/apollo/apollo-adminservice/config/
      [root@cn2023 config]# vim application-github.properties
      # DataSource
      spring.datasource.url = jdbc:mysql://192.168.20.23:3306/ApolloConfigDB?characterEncoding=utf8
      spring.datasource.username = root
      spring.datasource.password = cmcc1234
      
    • 服务器双网卡的情况需要修改启动脚本防止不可达网卡被注册
      [root@cn2023 scripts]# vim startup.sh 
      -Deureka.instance.ip-address=192.168.20.23
      
    • 启动
      [root@cn2023 scripts]# ./startup.sh 
      Fri Nov  1 14:26:48 CST 2019 ==== Starting ==== 
      Started [32756]
      Waiting for server startup.......
      Fri Nov  1 14:27:24 CST 2019 Server started in 35 seconds!
      

    apollo-portal部署

    • 导入apollo-portal的sql脚本
      mysql> source ~/apollo/V1.0.0__initialization_portal.sql
      
    • 验证
      mysql> select `Id`, `Key`, `Value`, `Comment` from `ApolloPortalDB`.`ServerConfig` limit 1;
      +----+--------------------+-------+--------------------------+
      | Id | Key                | Value | Comment                  |
      +----+--------------------+-------+--------------------------+
      |  1 | apollo.portal.envs | dev   | 可支持的环境列表         |
      +---+--------------------+-------+--------------------------+
      1 row in set (0.00 sec)
      
    • 修改apollo-portal数据库连接配置
      [root@cn2025 config]# vim application-github.properties
      # DataSource
      spring.datasource.url = jdbc:mysql://192.168.20.23:3306/ApolloPortalDB?characterEncoding=utf8
      spring.datasource.username = root
      spring.datasource.password = xxxx1234
      
    • 配置apollo-portal的meta service信息
      [root@cn2025 config]# vim apollo-env.properties 
      #local.meta=http://localhost:8080
      dev.meta=http://192.168.20.23:24000
      #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@cn2023 scripts]# ./startup.sh 
      Fri Nov  1 14:26:48 CST 2019 ==== Starting ==== 
      Started [32756]
      Waiting for server startup.......
      Fri Nov  1 14:27:24 CST 2019 Server started in 35 seconds!
      

    相关文章

      网友评论

          本文标题:携程Apollo部署

          本文链接:https://www.haomeiwen.com/subject/tqtebctx.html