1.GitHub地址:携程分布式配置中心
2.配置修改
(1).克隆代码
git clone https://github.com/ctripcorp/apollo.git
(2).修改配置
①apollo-adminservice模块bootstrap.yml配置文件
eureka:
instance:
hostname: bdata1 #服务器地址
preferIpAddress: true
client:
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:8080/eureka/
healthcheck:
enabled: true
eurekaServiceUrlPollIntervalSeconds: 60
endpoints:
health:
sensitive: false
management:
security:
enabled: false
health:
status:
order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
②apollo-configservice模块bootstrap.yml配置文件
eureka:
instance:
hostname: bdata1 #服务器地址
preferIpAddress: true
server:
peerEurekaNodesUpdateIntervalMs: 60000
enableSelfPreservation: false
client:
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:8080/eureka/
healthcheck:
enabled: true
eurekaServiceUrlPollIntervalSeconds: 60
endpoints:
health:
sensitive: false
management:
security:
enabled: false
health:
status:
order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
③aollo-core模块apollo-env.properties配置文件
local.meta=http://bdata1:8080
dev.meta=${dev_meta}
fat.meta=${fat_meta}
uat.meta=${uat_meta}
lpt.meta=${lpt_meta}
pro.meta=${pro_meta}
④scripts脚本build.bat文件
@echo off
rem apollo config db info
set apollo_config_db_url="jdbc:mysql://bdata1:3306/ApolloConfigDB?characterEncoding=utf8"
set apollo_config_db_username="root"
set apollo_config_db_password="数据库密码"
rem apollo portal db info
set apollo_portal_db_url="jdbc:mysql://bdata1:3306/ApolloPortalDB?characterEncoding=utf8"
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://bdata1:8080"
set fat_meta="http://bdata1:8080"
set uat_meta="http://bdata1:8080"
set pro_meta="http://bdata1: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 ===="
echo "==== starting to build client ===="
call mvn clean install -DskipTests -pl apollo-client -am %META_SERVERS_OPTS%
echo "==== building client finished ===="
pause
3.服务部署
(1)运行build.bat脚本,打包服务
(2)部署apollo-configservice
①解压apollo-configservice-0.10.0-SNAPSHOT-github.zip,并拷贝解压后的文件夹至部署服务器
②赋予.sh文件运行权限
chmod u+x shutdown.sh
chmod u+x startup.sh
③启动apollo-configservice
./startup.sh
(3)部署apollo-adminservice
①解压apollo-adminservice-0.10.0-SNAPSHOT-github.zip,并拷贝解压后的文件夹至部署服务器
②赋予.sh文件运行权限
chmod u+x shutdown.sh
chmod u+x startup.sh
③启动apollo-adminservice
./startup.sh
(4)部署apollo-portal
①解压apollo-portal-0.10.0-SNAPSHOT-github.zip,并拷贝解压后的文件夹至部署服务器
②赋予.sh文件运行权限
chmod u+x shutdown.sh
chmod u+x startup.sh
③启动apollo-adminservice
./startup.sh
4.登录
管理界面地址:http://bdata2:8080/
用户名为apollo,默认密码admin