配置中心Apollo搭建全过程 (2)

ApolloPortalDB:

101.png

ApolloConfigDB:

102.png

Apollo安装

官方地址:https://github.com/ctripcorp/apollo
本次测试版本为:0.10.2
下载地址:https://github.com/ctripcorp/apollo/releases/tag/v0.10.2
apollo-adminservice-0.10.2-github.zip
apollo-configservice-0.10.2-github.zip
apollo-portal-0.10.2-github.zip

apollo-config

主机:10.2.42.27
创建apollo用户:

groupadd apollo && useradd -g apollo apollo

配置configserver:

cd /home/apollo/ mkdir apollo-config unzip apollo-configservice-0.10.2-github.zip -d apollo-config

ApolloconfigDB配置:

vim apollo-config/config/application-github.properties # DataSource spring.datasource.url = jdbc:mysql://10.2.42.28:3306/ApolloConfigDB?characterEncoding=utf8 spring.datasource.username = Apollo spring.datasource.password = Apollo

日志路径及JVM参数修改:部分配置,后面的配置不需要修改

vim apollo-config/scripts/startup.sh # 修改日志路径 LOG_DIR=http://www.likecs.com/home/apollo/logs/100003171 # 默认端口 SERVER_PORT=8080 # 默认注释看需求打开 ## Adjust memory settings if necessary export JAVA_OPTS="-Xms6144m -Xmx6144m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=4096m -XX:MaxNewSize=4096m -XX:SurvivorRatio=8"

启动Apollo-configservice:

cd /home/apollo/ chown -R apollo.apollo * su apollo ./apollo-config/scripts/startup.sh

启动成功:

Thu Jul 18 15:06:53 CST 2019 ==== Starting ==== Started [53700] Waiting for server startup...... Thu Jul 18 15:07:24 CST 2019 Server started in 30 seconds!

apollo-admin

主机:10.2.42.28

groupadd apollo && useradd -g apollo apollo cd /home/apollo/ mkdir {apollo-admin,apollo-portal} unzip apollo-adminservice-0.10.2-github.zip -d apollo-admin unzip apollo-portal-0.10.2-github.zip -d apollo-portal

ApolloconfigDB配置:

cd apollo-admin vim config/application-github.properties # DataSource spring.datasource.url = jdbc:mysql://10.2.42.28:3306/ApolloConfigDB?characterEncoding=utf8 spring.datasource.username = Apollo spring.datasource.password = Apollo

日志路径及JVM参数配置:部分配置,后面的配置不需要修改

vim scripts/startup.sh #!/bin/bash SERVICE_NAME=apollo-adminservice ## Adjust log dir if necessary LOG_DIR=http://www.likecs.com/home/apollo/logs/100003172 ## Adjust server port if necessary SERVER_PORT=8090 ## Adjust memory settings if necessary export JAVA_OPTS="-Xms2560m -Xmx2560m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1536m -XX:MaxNewSize=1536m -XX:SurvivorRatio=8"

启动apollo-admin:

cd /home/apollo/ chown -R apollo.apollo * su apollo ./scripts/startup.sh Thu Jul 18 16:17:32 CST 2019 ==== Starting ==== Started [56497] Waiting for server startup...... Thu Jul 18 16:18:02 CST 2019 Server started in 30 seconds!

apollo-portal

主机:10.2.42.28
apolloportlDB配置:

cd /home/apollo/apollo-portal vim config/application-github.properties # DataSource spring.datasource.url = jdbc:mysql://10.2.42.28:3306/ApolloPortalDB?characterEncoding=utf8 spring.datasource.username = Apollo spring.datasource.password = Apollo

configservice配置:一套portal可以管理多个configservice,也可以直接配置在startup.sh脚本里

vim config/apollo-env.properties local.meta=http://localhost:8080 dev.meta=http://10.2.42.27:8080 fat.meta=http://10.2.42.27:8080 uat.meta=${lpt_meta} lpt.meta=${lpt_meta} pro.meta=${lpt_meta}

日志路径及JVM参数修改:部分配置,后面的配置不需要修改

vim scripts/startup.sh #!/bin/bash SERVICE_NAME=apollo-portal ## Adjust log dir if necessary LOG_DIR=http://www.likecs.com/home/apollo/logs/100003173 ## Adjust server port if necessary SERVER_PORT=8070 ## Adjust memory settings if necessary export JAVA_OPTS="-Xms2560m -Xmx2560m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1536m -XX:MaxNewSize=1536m -XX:SurvivorRatio=8"

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zygdjd.html