This is the 18th day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021

According to the arrangement of the company’s leadership, Apollo needs to be set up in the system, which has the following two requirements

  1. Sign up for your eureka
  2. Because the company uses Oracle, it is best to use Oracle for the database.

So you need to slightly modify the following source code, first download the source code.

1. A problem

Through the Apollo documentation, a solution was found. (Versions prior to 1.5.0)

1. Modify the source code annotations

Modify the com. Ctrip. Framework. Apollo. Configservice. ConfigServiceApplication, put the @ EnableEurekaServer @ EnableEurekaClient insteadCopy the code

Pay attention to

  1. The path is E:\ Apollo-oracle-eureka \ Apollo-configService \ SRC \main\ Java \com\ctrip\framework\ Apollo \ ConfigService \ConfigServic EApplication for your reference.
  2. And then modify the annotations, but there is a hole, when change the annotation, bag also need to take notes need to join, here for import org.springframework.cloud.net flix. Eureka. EnableEurekaClient;

2. Change the database

Modify ApolloConfigDB. ServerConfig table of eureka. Service. Url, pointing to his eureka address.

3. Modify the configuration file

2. Question 3

Here we baidu, there are branches for oracle version, here we can refer to it. Address; www.cnblogs.com/skabyy/p/10…

The above article is somewhat vague in some places, here is a supplement.

  1. After testing, ojdbC8 also works. Here, Nexus is used to process this JAR package
  2. After downloading the source code, we only need to change E: Apollo, scripts, build.sh. We only need to set up pro environment here, so we only need to change the connection mode and pro address.
#! /bin/sh # Apollo config db info apollo_config_DB_URL = JDBC :oracle:thin:@192.168.2.12:1521/orcl apollo_config_db_username=APOLLOCONFIG apollo_config_db_password=123 # apollo portal db info Apollo_portal_db_url = JDBC: oracle: thin: @ 192.168.2.12:1521 / former apollo_portal_db_username = APOLLOPORTAL apollo_portal_db_password=123 # meta server url, different environments should have different meta server addresses # dev_meta=http://fill-in-dev-meta-server:8080 # fat_meta=http://fill-in-fat-meta-server:8080 # uat_meta=http://fill-in-uat-meta-server:8080 Pro_meta = http://127.0.0.1:8080Copy the code

Pack 1.

  1. In Linux, copy the file to the Linux server, run the scripts/bulid.sh file, and run the./bulid.sh command.
  2. For Windows, double-click E: Apollo/scripts/build.bat

The generated ZIP package is obtained.Apollo/apollo-adminService /scripts/ Apollo/apollo-configService /scripts/ / Apollo/Apollo -portal/scripts/

./startup.sh
Copy the code

Note: If you do not modify build.sh/build.bat at package time, you can also modify the config\application-github For example, modify apollo-configService \config\application-github.

spring.datasource.username={ApolloConfig|ApolloPortal}
spring.datasource.password={password}
Copy the code