apollo linux安装部署
apollo工程地址
gitree地址:
https://gitee.com/apolloconfig/apollo
github地址:
https://github.com/apolloconfig/apollo
-
下载工程目录如下
-
创建数据库
数据库在scrpits>>sql 目录下
apolloconfigdb.sql
apolloportaldb.sql
源码编译部署
- 多环境部署,configservice、adminservice需要在每台服务器上分别部署一套; portal只需要部署一套即可
- 修改配置文件
当前电脑为windows电脑,目前只用到了开发环境dev和生成环境prod,打包会用到scprits/build.bat文件
修改一下build.bat文件内容,注意数据库连接串要根据不同的mysql版本做修改
meta server url 目前只用到了dev 和 prod
- portal
172.16.100.13
- 测试环境:
172.16.100.13
- 生产环境:
172.16.100.5
rem
rem Copyright 2021 Apollo Authors
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem
@echo off
rem apollo config db info
set apollo_config_db_url="jdbc:mysql://172.16.100.13:3306/ApolloConfigDB?serverTimezone=GMT%2b8&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8"
set apollo_config_db_username="root"
set apollo_config_db_password="密码"
rem apollo portal db info
set apollo_portal_db_url="jdbc:mysql://172.16.100.13:3306/ApolloPortalDB?serverTimezone=GMT%2b8&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8"
set apollo_portal_db_username="root"
set apollo_portal_db_password="密码"
rem meta server url, different environments should have different meta server addresses
set dev_meta="http://172.16.100.13:8080"
#set fat_meta="http://someIp:8080"
#set uat_meta="http://anotherIp:8080"
set pro_meta="http://172.16.100.5:8080"
set META_SERVERS_OPTS=-Ddev_meta=%dev_meta% -Dfat_meta=%fat_meta% -Duat_meta=%uat_meta% -Dpro_meta=%pro_meta%
rem =============== Please do not modify the following content ===============
rem go to script directory
cd "%~dp0"
cd ..
rem package config-service and admin-service
echo "==== starting to build config-service and admin-service ===="
call 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 ===="
call 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 ===="
pause
编译
- 打开工程所在目录
- 打开cmd,执行build.bat命令
- build完成后,分别拿zip包
apollo-configservice
下的apollo-configservice-2.0.0-SNAPSHOT-github.zip
apollo-adminservice
下的apollo-adminservice-2.0.0-SNAPSHOT-github.zip
apollo-portal
下的apollo-portal-2.0.0-SNAPSHOT-github.zip
- 放到服务器的相应目录下,如图
- 分别检查下配置文件是否正确,都在相关的目录项的scprits目录下
- 检查完配置文件后,启动服务
启动服务有顺序
先启动config service
在启动admin service
最后启动 portal
若为多台部署,也是分别在5上、13上启用config service;在启用admin service;最后启用portal
服务启动完成后,访问页面
portal所在服务器为
172.16.100.13
apollo服务提供默认用户名密码
apollo/admin