apollo開啟多環境配置

新環境的配置端口設置為8180 管理端口設置為8190

apollo添加新環境需要復刻apollo-configservice和apollo-adminservice(每個環境要求有獨立的這些配置),apollo-portal是公用的

1、創建新的apolloconfigdb庫,操作很簡單直接編輯原生的 apolloconfigdb.sql文件 修改如下三個部分就可以

<code>(1)、數據庫名字換成ApolloConfigDB_fat
(2)、端口換成8180(新服務) 'default', 'http://localhost:8180/eureka/'
  (3)、再次導入mysql數據庫/<code>

2、apollo-configservice的配置

<code>路徑:/soft/apollo/apollo-portal/src/main/config
文件:application-github.properties
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloPortalDB_fat?useSSL=false&characterEncoding=utf8
spring.datasource.username = root
spring.datasource.password = 123456/<code>
<code>路徑:/soft/apollo/apollo-configservice
如下文件的端口都要從8080換成8180
src/main/resources/application.yml
src/main/resources/bootstrap.yml
src/main/resources/configservice.properties
src/main/scripts/startup.sh/<code>

3、apollo-adminservice的配置

<code>路徑:/soft/apollo/apollo-adminservice/src/main/config
文件:application-github.properties
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloConfigDB_fat?useSSL=false&characterEncoding=utf8
spring.datasource.username = root
spring.datasource.password = 123456/<code>
<code>路徑:/soft/apollo
如下文件的端口都要從8090換成8190
# grep -r 8190|grep -v target
apollo-adminservice/src/main/resources/adminservice.properties:server.port= 8190
apollo-adminservice/src/main/resources/application.yml: port: 8190
apollo-adminservice/src/main/scripts/startup.sh:SERVER_PORT=${SERVER_PORT:=8190}/<code>

4、編譯即可

<code>編譯文件路徑:/soft/apollo/scripts
#build.sh 執行完畢即可/<code>

5、啟動服務

創建工作目錄

<code>#mkdir -p  /soft/apollo-service/{apollo-configservice_fat,apollo-adminservice_fat,apollo-portal}/<code>

拷貝編譯生成後的文件

<code>#cp /soft/apollo/apollo-configservice/target/apollo-configservice-1.7.0-SNAPSHOT-github.zip /soft/apollo-service/apollo-configservice_fat/
#cp /soft/apollo/apollo-adminservice/target/apollo-adminservice-1.7.0-SNAPSHOT-github.zip /soft/apollo-service/apollo-adminservice_fat/
#cp /soft/apollo/apollo-portal/target/apollo-portal-1.7.0-SNAPSHOT-github.zip /soft/apollo-service/apollo-portal//<code>

進入各自的目錄unzip文件 進scipts目錄啟動服務即可

<code>#uat,lpt,pro都可以按照這個步驟操作,只需要換configservice和adminservice的端口即可/<code>


apollo開啟多環境配置


分享到:


相關文章: