A set of portal can manage multiple environments, but each environment needs to be deployed independently of a set of config service, Admin service, and Apolloconfigdb,apollo version 0.10.2 Default supported environments: Local, DEV, FWS , FAT, UAT, LPT, PRO, TOOLS
(PS: Environment Enumeration class, COM.CTRIP.FRAMEWORK.APOLLO.CORE.ENUMS.ENV, adding custom Environment reference: https://github.com/ctripcorp/apollo/wiki/%E9%83% A8%e7%bd%b2&%e5%bc%80%e5%8f%91%e9%81%87%e5%88%b0%e7%9a%84%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98#42-%e6%b7%bb %E5%8A%A0%E8%87%AA%E5%AE%9A%E4%B9%89%E7%9A%84%E7%8E%AF%E5%A2%83)
Below we deploy a set of portal management Dev, FAT, uat three environments as an example to specify Apollo deployment due to limited server, I am in a server three directories to store three sets of Apollo, each using a different port to simulate three servers, and use a database of three different names on a dbserver,
Portal is deployed only in Uat,The Service storage directory and the database corresponds to the following table:
Environment |
Directory |
Configservice |
Adminservice |
Portal |
Database name |
DEV |
~/apollo/dev |
Y |
Y |
N |
Apolloconfigdb |
FAT |
~/apollo/fat |
Y |
Y |
N |
ApolloConfigDB2 |
UAT |
~/apollo/uat |
Y |
Y |
Y |
ApolloConfigDB3 Apolloportaldb |
Apollo the environmental meta addresses mentioned in the official documentation are defined in build.sh (or BUILD.bat), we do not, we use the runtime by setting the corresponding parameters to implement
Pre-deployment: 1. Download Apollo source Https://github.com/ctripcorp/apollo 2. Compile package Apollo (required maven3.5.2+) into the apollo\scripts directory, execute BUILD.bat (Linux environment uses build.sh) compiles the adminservice, Configserivce and portal packages we want to use are located at: Apollo\apollo-adminservice\target \apollo-adminservice-0.10.2-github.zip apollo\apollo-configservice\target\ Apollo-configservice-0.10.2-github.zip Apollo\apollo-portal\target\apollo-portal-0.10.2-github.zip 3. Deploy server-side servers 3.1 install mysql5.7, choose New Installation or upgrade mysql5.1 to 5.7 reference according to the actual situation: https://blog.csdn.net/buyaore_wo/article/details/ 79549648 CentOS6 Decompression Installation mysql-5.7.20 https://blog.csdn.net/buyaore_wo/article/details/79549605 3.2 installation jdk1.8 If there are other Java applications running on the server that cannot directly upgrade the Java version, you can install jdk1.8 on the server, Apollo the application by setting the environment variable to specify the use of 1.8 1) a single Linux user running Apollo, BASHRC setting Java_ Home and Path 2) modify the Apollo startup script to specify Java_home (this is the way to use this article)
One, Apollo service end
1.1 Dev Environment1.1.1 Create DATABASE Dev Environment There is no portal, so just use Apollo\scripts\sql\apolloconfigdb.sql to create a database in MySQL (if you want to modify the database name, note the changes in the SQL file)
1.1.2 Configservice Deployment will apollo-configservice-0.10.2-github.zip uncompressed to ~/apollo/dev/configservice modify ~/apollo/dev/ configservice/script/startup.sh, configuration database, several meta addresses java_home=/usr/local/java/jdk1.8.0_161
Apollo_config_db_url=jdbc:mysql://localhost:1504/apolloconfigdb?characterencoding=utf8 apollo_config_db_ Username=root APOLLO_CONFIG_DB_PASSWORD=16VHKLYTV7WG # meta server URL config_server_url=http://127.0.0.1:8280 admin_ server_url=http://127.0.0.1:8290 eureka_service_url= $config _server_url/eureka/
# # Adjust Server port if necessary server_port=8280 # Adjust log dir If necessary log_dir= $APOLLO _home/logs service_name= Apollo-configservice path_to_jar= $SERVICE _name ". JAR" Server_url= "http://localhost: $SERVER _port"
# JAVA OPTS base_java_opts= "-denv=dev-ddev_meta= $config _server_url" config_java_opts= "$BASE _java_opts- Dspring.profiles.active=github-deureka.service.url= $eureka _service_url-deureka.instance.homepageurl= $config _ Server_url "java_opts=" $CONFIG _java_opts-dspring.datasource.url= $apollo _config_db_url- Dspring.datasource.username= $apollo _config_db_username-dspring.datasource.password= $apollo _config_db_password " Export java_opts= "$JAVA _opts-dserver.port= $SERVER _port-dlogging.file= $LOG _dir/$SERVICE _NAME.LOG-XLOGGC: $LOG _dir /heap_trace.txt-xx:heapdumppath= $LOG _dir/heapdumponoutofmemoryerror/"
1.1.3 Adminservice Deployment will apollo-adminservice-0.10.2-github.zip uncompressed to ~/apollo/dev/adminservice modify ~/apollo/dev/ adminservice/script/startup.sh, configuration database, several meta addresses java_home=/usr/local/java/jdk1.8.0_161
Apollo_config_db_url=jdbc:mysql://localhost:1504/apolloconfigdb?characterencoding=utf8 apollo_config_db_ Username=root APOLLO_CONFIG_DB_PASSWORD=16VHKLYTV7WG
# Meta Server URL config_server_url=http://127.0.0.1:8280 admin_server_url=http://127.0.0.1:8290 eureka_service_url= $config _server_url/eureka/# # Adjust Server port if necessary server_port=8290
# # Adjust Log dir If necessary log_dir= $APOLLO _home/logs service_name=apollo-adminservice path_to_jar= $SERVICE _name ". Jar "Server_url=" http://localhost: $SERVER _port "
#JAVA OPTS base_java_opts= "-denv=dev-ddev_meta= $config _server_url" admin_java_opts= "$BASE _java_opts- Dspring.profiles.active=github-deureka.service.url= $eureka _service_url-deureka.instance.homepageurl= $admin _ Server_url "java_opts=" $ADMIN _java_opts-dspring.datasource.url= $apollo _config_db_url- Dspring.datasource.username= $apollo _config_db_username-dspring.datasource.password= $apollo _config_db_password " Export java_opts= "$JAVA _opts-dserver.port= $SERVER _port-dlogging.file= $LOG _dir/$SERVICE _NAME.LOG-XLOGGC: $LOG _dir /heap_trace.txt-xx:heapdumppath= $LOG _dir/heapdumponoutofmemoryerror/"
1.2 Fat Environment1.2.1 Create DATABASE Fat environment also no portal, just use Apollo\scripts\sql\apolloconfigdb.sql, create a database in MySQL (if you want to modify the database name, note the changes in the SQL file)
1.2.2 Configservice Deployment will apollo-configservice-0.10.2-github.zip uncompressed to ~/apollo/dev/configservice modify ~/apollo/dev/ configservice/script/startup.sh, configuration database, several meta addresses java_home=/usr/local/java/jdk1.8.0_161
Apollo_config_db_url=jdbc:mysql://localhost:1504/apolloconfigdb2?characterencoding=utf8 apollo_config_db_ Username=root APOLLO_CONFIG_DB_PASSWORD=16VHKLYTV7WG
# Meta Server URL config_server_url=http://127.0.0.1:8180 admin_server_url=http://127.0.0.1:8190 eureka_service_url= $config _server_url/eureka/
# # Adjust Server port if necessary server_port=8180 # Adjust log dir If necessary log_dir= $APOLLO _home/logs service_name= Apollo-configservice path_to_jar= $SERVICE _name ". JAR" Server_url= "http://localhost: $SERVER _port"
# JAVA OPTS base_java_opts= "-denv=dev-ddev_meta= $config _server_url" config_java_opts= "$BASE _java_opts- Dspring.profiles.active=github-deureka.service.url= $eureka _service_url-deureka.instance.homepageurl= $config _ Server_url "java_opts=" $CONFIG _java_opts-dspring.datasource.url= $apollo _config_db_url- Dspring.datasource.username= $apollo _config_db_username-dspring.datasource.password= $apollo _config_db_password " Export java_opts= "$JAVA _opts-dserver.port= $SERVER _port-dlogging.file= $LOG _dir/$SERVICE _NAME.LOG-XLOGGC: $LOG _dir /heap_trace.txt-xx:heapdumppath= $LOG _dir/heapdumponoutofmemoryerror/"
1.2.3 Adminservice Deployment will apollo-adminservice-0.10.2-github.zip uncompressed to ~/apollo/dev/adminservice modify ~/apollo/dev/ adminservice/script/startup.sh, configuration database, several meta addresses java_home=/usr/local/java/jdk1.8.0_161
Apollo_config_db_url=jdbc:mysql://localhost:1504/apolloconfigdb2?characterencoding=utf8 apollo_config_db_ Username=root APOLLO_CONFIG_DB_PASSWORD=16VHKLYTV7WG
# Meta Server URL config_server_url=http://127.0.0.1:8180 admin_server_url=http://127.0.0.1:8190 eureka_service_url= $config _server_url/eureka/# Adjust Server port if necessary