詳細安裝地址: 攜程Apollo GitHub
1.創建安裝目錄
mkdir -p service/{application,tools}
2. 安裝java環境
yum -y list java*
yum install -y java-1.8.0-openjdk-src.x86_64
3. 安裝maven環境
#安裝目錄:
/service/tools
#下載鏈接:
wget https://mirrors.cnnic.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz --no-check-certificate
#解壓:
tar -avxf apache-maven-3.5.4-bin.tar.gz
#配置文件:
echo " ">>/etc/profile
echo "# Made for mvn env by seaDragon on $(date +%F)">>/etc/profile
echo 'export MAVEN_HOME=/usr/local/maven'>>/etc/profile
echo 'export PATH=$MAVEN_HOME/bin:$PATH'>>/etc/profile
tail -4 /etc/profile
source /etc/profile
echo $PATH
4.下載源碼
#下載目錄
/service/tools
#下載
git clone https://github.com/ctripcorp/apollo
5.安裝數據庫
安裝數據庫之後需要導入兩個庫
1> ApolloConfigDB
2> ApolloPortalDB
6.進行數據庫導入 默認導入兩個數據庫
{your_path}/apollo/scripts/sql/apolloportaldb.sql
{your_path}/apollo/scripts/sql/apolloconfigdb.sql
6.1 apollo config db info
apollo_config_db_url=jdbc:mysql://fill-in-the-correct-server:3306/ApolloConfigDB?characterEncoding=utf8
apollo_config_db_username=FillInCorrectUser #用戶
apollo_config_db_password=FillInCorrectPassword #密碼
6.2 apollo portal db info
apollo_portal_db_url=jdbc:mysql://fill-in-the-correct-server:3306/ApolloPortalDB?characterEncoding=utf8
apollo_portal_db_username=FillInCorrectUser #用戶
apollo_portal_db_password=FillInCorrectPassword #密碼
替換 //fill-in-the-correct-server: 爲 安裝的數據庫地址例如 10.211.22.10:3306
6.3 修改服務地址
dev_meta=http://10.211.22.10:8080
fat_meta=http://apollo.fat.xxx.com
uat_meta=http://apollo.uat.xxx.com
pro_meta=http://apollo.xxx.com
7. 編譯打包
#進入到 apollo/script目錄下執行打包腳本
cd apollo/script && sh build.sh
8. 編譯從成功之後將包上傳到服務器
# 獲取apollo-configservice安裝包
apollo-configservice/target/apollo-configservice-x.x.x-github.zip
> 注意: 需要注意的是由於ApolloConfigDB在每個環境都有部署,所以對不同環境的config-service需要使用不同的數據庫參數打不同的包後分別部署
# 獲取apollo-adminservice安裝包
apollo-adminservice/target/apollo-adminservice-x.x.x-github.zip
> 注意: 由於ApolloConfigDB在每個環境都有部署,所以對不同環境的admin-service需要使用不同的數據庫參數打不同的包後分別部署
# 獲取apollo-portal安裝包
apollo-portal/target/apollo-portal-x.x.x-github.zip
9.開啓服務
#1.首先對壓縮包都進行解壓
cd /service/application/apollo
unzip apollo-configservice-x.x.x-github.zip
unzip apollo-portal-x.x.x-github.zip
unzip apollo-adminservice-x.x.x-github.zip
#2.進入到目錄進行腳本啓動
cd apollo-configservice/scripts && sh startup.sh #啓動
cd apollo-adminservice/scripts && sh startup.sh #啓動
cd apollo-portal/scripts && sh startup.sh #啓動
#再啓動之前可進行JVM參數配置 例如
export JAVA_OPTS="-server -Xms4096m -Xmx4096m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1536m -XX:MaxNewSize=1536m -XX:SurvivorRatio=22"
#3. 關閉
cd apollo-configservice/scripts && sh shutdown.sh #啓動
cd apollo-adminservice/scripts && sh shutdown.sh #啓動
cd apollo-portal/scripts && sh shutdown.sh #啓動
10.啓動服務進行登錄
默認用戶 Apollo 密碼 admin