linux centos7搭建apollo


登錄linux服務器

JDK:1.8.0_161(提前准備好,不介紹安裝了哦)

Maven:3.5.2(提前准備好,不介紹安裝了哦)

MySQL:5.7.18(5.7以上,不介紹安裝了哦)

apollo:v1.4.0

 創建目錄

mkdir -p /data/apollo
cd /data/apollo

下載apollo

wget https://codeload.github.com/ctripcorp/apollo/zip/v1.4.0
unzip v1.4.0

修改數據庫配置

# 導入數據庫 https://gitee.com/lepdou/apollo/tree/master/scripts/sql
vi
/data/apollo/apollo-1.4.0/scripts/build.sh
# apollo config db info
apollo_config_db_url=jdbc:mysql://120.78.127.53:3306/ApolloConfigDB?characterEncoding=utf8
apollo_config_db_username=*******
apollo_config_db_password=*******
 # apollo portal db info 
apollo_portal_db_url
=jdbc:mysql://120.78.127.53:3306/ApolloPortalDB?characterEncoding=utf8
apollo_portal_db_username=********
apollo_portal_db_password
=********
# meta server url, different environments should have different meta server addresses
dev_meta
=http://localhost:8080
fat_meta=http://localhost:8080
uat_meta=http://localhost:8080
pro_meta=http://localhost:8080

增加start腳本 

vi start.sh (復制下面的腳本保存)

 最后sh start.sh

#!/bin/sh

sh /data/apollo/apollo-1.4.0/apollo-configservice/target/scripts/shutdown.sh
sh /data/apollo/apollo-1.4.0/apollo-adminservice/target/scripts/shutdown.sh
sh /data/apollo/apollo-1.4.0/apollo-portal/target/scripts/shutdown.sh

# 打包

sh /data/apollo/apollo-1.4.0/scripts/build.sh

# 啟動apollo-configservice 端口8080
cd /data/apollo/apollo-1.4.0/apollo-configservice/target
unzip -o apollo-configservice-1.4.0-github.zip
sh /data/apollo/apollo-1.4.0/apollo-configservice/target/scripts/startup.sh

# 啟動apollo-adminservice 端口8090
cd /data/apollo/apollo-1.4.0/apollo-adminservice/target
unzip -o apollo-adminservice-1.4.0-github.zip
sh /data/apollo/apollo-1.4.0/apollo-adminservice/target/scripts/startup.sh

# 啟動apollo-adminservice 端口8070
cd /data/apollo/apollo-1.4.0/apollo-portal/target
unzip -o apollo-portal-1.4.0-github.zip
sh /data/apollo/apollo-1.4.0/apollo-portal/target/scripts/startup.sh

 

 

正確啟動完成后 ip:8070 訪問OK

已測試3次OK的了

 

遇到的問題:

1. 阿里雲 linux部署apollo時候,用springboot連apollo的時候總連不上。 注意下報錯,發現連接的IP不是自己服務器的IP. eureka 注冊時使用的不是你的外網IP 。

解決方式:

在build之前,修改文件(/data/apollo/apollo-1.4.0/apollo-configservice/src/main/resources/bootstrap.yml),

eureka:
  instance:
    ip-address: 127.0.0.1
    prefer-ip-address: true

2. apollo配置多環境時,數據庫中需要配置多環境。需要修改數據庫

ApolloConfigDB.ServerConfig.【eureka.service.url】 : Eureka服務Url,多個service以英文逗號分隔

ApolloPortalDB.ServerConfig.【apollo.portal.envs】:可支持的環境列表

 

轉載:https://www.cnblogs.com/moonandstar08/p/7571610.html

apollo:https://gitee.com/lepdou/apollo

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM