系统编译安装

  • ubuntu16.11
  • java 1.8

系统规划

  • Portal共用
  • 其它环境每个两台机器
  • mysql都做主从,所以每个环境的机器上都会安装admin 服务,config服务,以及一个mysql服务

env ip usage
all 192.168.1.1 portal
dev 192.168.2.1 admin+config+configdb
dev 192.168.2.2 admin+config+configdb
test 192.168.3.1 admin+config+configdb
test 192.168.3.2 admin+config+configdb
pre 192.168.4.1 admin+config+configdb
pre 192.168.4.2 admin+config+configdb
pro 192.168.5.1 admin+config+configdb
pro 192.168.5.2 admin+config+configdb

#!/bin/bash
## 先安装jdk1.8以上到/usr/local/java 并设置系统环境变量
java -version
base_home="/home/test/Desktop"
############################################################################
dev_meta="http://192.168.2.1:8080,http://192.168.2.2:8080"
fat_meta="http://192.168.3.1:8080,http://192.168.3.2:8080"
uat_meta="http://192.168.4.1:8080,http://192.168.4.2:8080"
pro_meta="http://192.168.5.1:8080,http://192.168.5.2:8080" ########### portal 数据库 ,共用一个
# apollo portal db info
apollo_portal_db_url=jdbc:mysql://192.168.1.1:3306/ApolloPortalDB?characterEncoding=utf8
apollo_portal_db_password=portal_root_db_password ############ 四个环境的配置数据库
# apollo dev config db info
dev_apollo_config_db_url=jdbc:mysql://192.168.2.1:3306/ApolloConfigDB?characterEncoding=utf8
dev_apollo_config_db_password=dev_config_root_db_password
# apollo fat config db info
fat_apollo_config_db_url=jdbc:mysql://192.168.3.1:3306/ApolloConfigDB?characterEncoding=utf8
fat_apollo_config_db_password=fat_config_root_db_password
# apollo uat config db info
uat_apollo_config_db_url=jdbc:mysql://192.168.4.1:3306/ApolloConfigDB?characterEncoding=utf8
uat_apollo_config_db_password=uat_config_root_db_password
# apollo pro config db info
pro_apollo_config_db_url=jdbc:mysql://192.168.5.1:3306/ApolloConfigDB?characterEncoding=utf8
pro_apollo_config_db_password=pro_config_root_db_password ########################## 以下勿更改
build_sh() {
cd "$base_home/apollo"
cp -pr apollo apollo_$1
cd apollo_$1/scripts
# apollo config db info
apollo_config_db_url=$2
apollo_config_db_username=root
apollo_config_db_password=$3
# apollo portal db info
apollo_portal_db_url=$4
apollo_portal_db_username=root
apollo_portal_db_password=$5
# meta server url, different environments should have different meta server addresses
dev_meta=$6
fat_meta=$7
uat_meta=$8
pro_meta=$9
META_SERVERS_OPTS="-Ddev_meta=$dev_meta -Dfat_meta=$fat_meta -Duat_meta=$uat_meta -Dpro_meta=$pro_meta"
# =============== Please do not modify the following content =============== #
# go to script directory
cd "${0%/*}"
cd ..
# package config-service and admin-service
echo "==== starting to build config-service and admin-service ===="
mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github -Dspring_datasource_url=$apollo_config_db_url -Dspring_datasource_username=$apollo_config_db_username -Dspring_datasource_password=$apollo_config_db_password
echo "==== building config-service and admin-service finished ===="
echo "==== starting to build portal ===="
mvn clean package -DskipTests -pl apollo-portal -am -Dapollo_profile=github,auth -Dspring_datasource_url=$apollo_portal_db_url -Dspring_datasource_username=$apollo_portal_db_username -Dspring_datasource_password=$apollo_portal_db_password $META_SERVERS_OPTS
echo "==== building portal finished ===="
echo "==== starting to build client ===="
mvn clean install -DskipTests -pl apollo-client -am $META_SERVERS_OPTS
echo "==== building client finished ====" } ####################初始化环境,下载apollo
sudo apt-get install -y maven git
sudo sed -i '/<mirrors>/a\<mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url></mirror>' /etc/maven/settings.xml
mkdir -p apollo
cd apollo
git clone https://github.com/ctripcorp/apollo.git
source /etc/profile
sudo mv /usr/bin/java /usr/bin/java_bak
sudo ln -s /usr/local/java/bin/java /usr/bin/
########################################### ##### dev
build_sh "dev" "$dev_apollo_config_db_url" \
"$dev_apollo_config_db_password" \
"$apollo_portal_db_url" \
"$apollo_portal_db_password" \
"$dev_meta" "$fat_meta" "$uat_meta" "$pro_meta"
build_sh "fat" "$fat_apollo_config_db_url" \
"$fat_apollo_config_db_password" \
"$apollo_portal_db_url" \
"$apollo_portal_db_password" \
"$dev_meta" "$fat_meta" "$uat_meta" "$pro_meta" build_sh "uat" "$uat_apollo_config_db_url" \
"$uat_apollo_config_db_password" \
"$apollo_portal_db_url" \
"$apollo_portal_db_password" \
"$dev_meta" "$fat_meta" "$uat_meta" "$pro_meta" build_sh "pro" "$pro_apollo_config_db_url" \
"$pro_apollo_config_db_password" \
"$apollo_portal_db_url" \
"$apollo_portal_db_password" \
"$dev_meta" "$fat_meta" "$uat_meta" "$pro_meta" ######################### 添加本地jar包到本地mvn
dev_home="$base_home/apollo/apollo_dev"
apollo_version=`ls $dev_home/apollo-client/target/apollo-client-*.jar |grep -v sources |sed 's/.jar//g' |sed "s#.*apollo-client-##g"`
mvn install:install-file -DgroupId=com.ctrip.framework.apollo -DartifactId=apollo-client -Dversion=$apollo_version -Dpackaging=jar -Dfile=$dev_home/apollo-client/target/apollo-client-$apollo_version.jar
mvn install:install-file -DgroupId=com.ctrip.framework.apollo -DartifactId=apollo-core -Dversion=$apollo_version -Dpackaging=jar -Dfile=$dev_home/apollo-core/target/apollo-core-$apollo_version.jar
mvn install:install-file -DgroupId=com.ctrip.framework.apollo -DartifactId=apollo-buildtools -Dversion=$apollo_version -Dpackaging=jar -Dfile=$dev_home/apollo-buildtools/target/apollo-buildtools-$apollo_version.jar
mvn install:install-file -DgroupId=com.ctrip.framework.apollo -DartifactId=apollo-common -Dversion=$apollo_version -Dpackaging=jar -Dfile=$dev_home/apollo-common/target/apollo-common-$apollo_version.jar
#mkdir -p /opt/setting
#echo 'env=DEV' > /opt/setting/server.properties

安装Portal

Portal是共用的,代码都一样,所以这里从dev环境拿个编译包就可以

  1. portal服务器的mysql上面执行该SQL : apollo/apollo_dev/scripts/sql/apolloportaldb.sql
    1. 修改数据表ApolloPortalDB.ServerConfig配置如下,修改 apollo.portal.envs : dev,fat,uat,pro
  2. 上传 apollo/apollo_dev/apollo-portal/target/apollo-portal-0.11.0-SNAPSHOT-github.zip 到 portal服务器(192.168.1.1)/data/apollo_portal
  3. unzip apollo-portal-0.11.0-SNAPSHOT-github.zip
  4. 启动portal ./scripts/startup.sh
  5. 访问portal管理后台 http://192.168.1.1:8080/ . 默认管理员 : apollo / admin

安装config服务

···这里以DEV环境设置为例···

  1. dev环境的两个mysql做好主从,执行 apollo/apollo_dev/scripts/sql/apolloconfigdb.sql 的sql文件创建库表
  2. 修改apolloconfigdb库中的ServerConfig
  3. 上传apollo/apollo_dev/apollo-configservice/target/apollo-configservice-0.11.0-SNAPSHOT-github.zip 到 dev两个机器的/data/apollo_config 目录里面
  4. unzip apollo-configservice-0.11.0-SNAPSHOT-github.zip
  5. 启动: ./scripts/startup.sh

安装admin服务

  1. 上传apollo/apollo_dev/apollo-adminservice/target/apollo-adminservice-0.11.0-SNAPSHOT-github.zip 到dev两个服务器的/data/apollo_admin 目录里面
  2. unzip apollo-adminservice-0.11.0-SNAPSHOT-github.zip
  3. 启动 scripts/startup.sh

  • 如果能看懂这个图,Apollo的基本架构也就理解了。下一篇就开始来讲讲Apollo的一些组件,或是服务

携程Apollo一键编译脚本+部署实现的更多相关文章

  1. 携程apollo系列-个人开发环境搭建

    本博客讲详细讲解如何在 Windows 搭建携程 Apollo 服务器 (用户个人开发). 开发服务器有多种搭建方式:(1) docker, 搭建过程非常简单, 推荐有 docker 环境(2) 部署 ...

  2. 携程apollo系列-客户端集成

    本文讲解如何在 Java 程序中集成 Apollo 配置, 主要涉及到一些基础用法. 对于一些高级用法, 比如如何加密/解密配置项 (可用于数据库密码配置), 如何动态切换数据源地址,如何动态切换日志 ...

  3. 分布式配置中心 携程(apollo)

    1.传统配置文件与分布式配置文件区别 传统配置文件:如果修改了配置文件,需要重新打包发布,重新发布服务,而且每个环境的变更配置文件,比较繁琐. 分布式配置文件:将配置文件注册到配置中心上去,可以使用分 ...

  4. Spring Boot 2.0 整合携程Apollo配置中心

    原文:https://www.jianshu.com/p/23d695af7e80 Apollo(阿波罗)是携程框架部门研发的分布式配置中心,能够集中化管理应用不同环境.不同集群的配置,配置修改后能够 ...

  5. 携程Apollo统一配置中心的搭建和使用

    原文链接:https://blog.csdn.net/luhong327/article/details/81453001 一.Apollo配置中心介绍 1.What is Apollo 1.1 Ap ...

  6. CentOS 7 搭建基于携程Apollo(阿波罗)配置中心单机模式

    Apollo(阿波罗)是携程框架部门研发的配置管理平台,能够集中化管理应用不同环境.不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限.流程治理等特性.服务端基于Spring Boot ...

  7. 携程Apollo配置中心架构深度剖析

    转自:http://www.uml.org.cn/wfw/201808153.asp 一.介绍 Apollo(阿波罗)[参考附录]是携程框架部研发并开源的一款生产级的配置中心产品,它能够集中管理应用在 ...

  8. SpringBoot 整合携程Apollo配置管理中心

    携程官网对apollo的使用讲解了很多种方式的使用,但是感觉一些细节还是没讲全,特别是eureka配置中心地址的配置 这里对springboot整合apollo说一下 >SpringBoot启动 ...

  9. .Net Core 商城微服务项目系列(十四):分布式部署携程Apollo构建配置中心

    一.开场白 在系统设计里我们有很多配置希望独立于系统之外,而又能够被系统实时读取.但是在传统的系统设计里,配置信息通常是耦合在系统内的,比如.net里通常会放在App.config或者web.conf ...

随机推荐

  1. python --- 快速排序算法

    在快速排序中引入递归和分治的概念(关于递归和分治的概念会单独写一篇来进行介绍) 问的解决思路: 快速排序的基本思想本身就是分治法,通过分割,将无序序列分成两部分,其中前一部分的元素值都要小于后一部分的 ...

  2. ssm客户管理系统的设计与实现

    ssm客户管理系统 注意:系统是在实现我的上一篇文章 https://www.cnblogs.com/peter-hao/p/ssm.html的基础上开发 1     需求 1.1   添加客户 客户 ...

  3. 安全性测试:OWASP ZAP使用入门指南

    免责声明: 本文意在讨论使用工具来应对软件研发领域中,日益增长的安全性质量测试需求.本文涉及到的工具不可被用于攻击目的. 1. 安全性测试 前些天,一则12306用户账号泄露的新闻迅速发酵,引起了购票 ...

  4. android事件分发源码分析—笔记

    昨天晚上从源码角度复习了一下android的事件分发机制,今天将笔记整理下放在网上.其实说复习,也是按着<android开发艺术探索>这本书作者的思路做的笔记. 目录 事件是如何从Acti ...

  5. Spring IOC源码实现流程

    最近一段时间学习了IOC的源码实现,分享一下大概流程 创建一个测试类 代码如下: package com.zcg.learn.Test; import org.junit.Test;import or ...

  6. NLP第八条

    今日!我虽啥也没干,但我还是有着学习的心的~          也许是“遵义会议”呢   那也说不定 留下这句话再说 哈哈哈哈哈哈 只能抄抄NLP第八条了  谁叫我选了个灰常有意义的通识课咧 八,每一 ...

  7. rabbitmq消费者“无故消失”

    hi,all   导读:9月1号17:12左右,发现影子队列存在大量“unacked”(收到了消息,但是还没有手动确认消息)的消息,一段时间后“unacked”的数量没有减少,但是观察消费者端的日志, ...

  8. 【BZOJ5505】[GXOI/GZOI2019]逼死强迫症(矩阵快速幂)

    [BZOJ5505][GXOI/GZOI2019]逼死强迫症(矩阵快速幂) 题面 BZOJ 洛谷 题解 如果没有那两个\(1*1\)的东西,答案就是斐波那契数,可以简单的用\(dp\)得到. 大概是设 ...

  9. 微信小程序客服消息开发实战:实时在手机上接收小程序客服消息通知,以及在手机上回复

    在微信小程序开发中,可以非常方便的集成客服功能,只需要一行代码便可以将用户引导至客服会话界面.这行代码就是: <button open-type="contact" bind ...

  10. Postman:传递的参数是List类型时 传参格式的写法

    Postman传递的参数是List类型 实体类中引用了一个List,泛型为其他实体类 参数是List集合时,Postman中参数格式如下图所示: 有不明白的地方,欢迎留言