There are two environments here. The operation ideas of Dev and fat are clear. Then the implementation ideas of apollo's native dev, fat, UAT, LPT and pro are completely free. The setting of custom environment needs to be further studied
Get the installation package git clone
https://github.com/ctripcorp/apollo.git
Preparation part
1. Install mysql5 7. Just install it using yum
wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm rpm -Uvh mysql57-community-release-el7-10.noarch.rpm yum install -y mysql-community-server systemctl restart mysqld.service grep 'temporary password' /var/log/mysqld.log First, modify validate_password_policy Value of parameter mysql> set global validate_password_policy=0; mysql> set global validate_password_length=1; mysql> alter user 'root'@'localhost' identified by '123456'; mysql> grant all privileges on *.* to 'root'@'%'identified by '123456';
Then import the sql data of apollo
mysql -hlocalhost -uroot -p123456 < /soft/apollo/scripts/sql/apolloconfigdb.sql
apolloportaldb. Edit the SQL file and change the supported environment into dev, fat, UAT, LPT and pro
mysql -hlocalhost -uroot -p123456 < /soft/apollo/scripts/sql/apolloportaldb.sql
2. Environment for installing maven
Package used
apache-maven-3.6.3-bin.tar.gz
Part of environment variable
/etc/profile MAVEN_HOME=/soft/maven/ export MAVEN_HOME export PATH=${PATH}:${MAVEN_HOME}/bin
3. java environment
Java 1.0 is used here 8 environment
Part of environment variable
export JAVA_HOME=/soft/jdk1.8.0_191 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
4. Configuration of Apollo configservice
route:
/soft/apollo/apollo-configservice/src/main/config
File:
application-github.properties
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloConfigDBuseSSL=false&characterEncoding=utf8 spring.datasource.username = root spring.datasource.password = 123456
5. Configuration of Apollo adminservice
route:
/soft/apollo/apollo-adminservice/src/main/config
File:
application-github.properties
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloConfigDB?useSSL=false&characterEncoding=utf8 spring.datasource.username = root spring.datasource.password = 123456
6. Part of Apollo portal configuration
route:
/soft/apollo/apollo-portal/src/main/config
File:
application-github.properties
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloPortalDB?useSSL=false&characterEncoding=utf8 spring.datasource.username = root spring.datasource.password = 123456
route:
/soft/apollo/apollo-portal/src/main/resources
File: apollo-env.properties local.meta=http://localhost:8080 dev.meta=http://localhost:8080 fat.meta=http://localhost:8180 uat.meta=${uat_meta} lpt.meta=${lpt_meta} pro.meta=${pro_meta}
7. Just compile
Compiled file path: / soft/apollo/scripts
build.sh can be executed
8. Start service
Create working directory
mkdir -p /soft/apollo-service/{apollo-configservice_dev,apollo-adminservice_dev,apollo-portal}
Copy the compiled file
cp /soft/apollo/apollo-configservice/target/apollo-configservice-1.7.0-SNAPSHOT-github.zip /soft/apollo-service/apollo-configservice_dev/ cp /soft/apollo/apollo-adminservice/target/apollo-adminservice-1.7.0-SNAPSHOT-github.zip /soft/apollo-service/apollo-adminservice_dev/ cp /soft/apollo/apollo-portal/target/apollo-portal-1.7.0-SNAPSHOT-github.zip /soft/apollo-service/apollo-portal/
Enter the unzip file in their respective directory, enter the scipts directory and start the service
The second part adds the fat environment. Other environments can draw gourds and ladles according to the gourd. In addition, this operation is based on the same source package (by modifying the configuration)
The configuration port of the new environment is set to 8180 and the management port is set to 8190
Adding a new environment to apollo requires copying the apollo configservice and apollo adminservice (each environment requires independent configuration). The apollo portal is public
1. Create a new apolloconfig DB library. The operation is very simple. Edit the native apolloconfig DB directly The SQL file can be modified into the following three parts
(1),Change the database name to ApolloConfigDB_fat (2),Port changed to 8180(New services) 'default', 'http://localhost:8180/eureka/' (3),Import again mysql database
2. Configuration of Apollo configservice
route:
/soft/apollo/apollo-portal/src/main/config
File:
application-github.properties
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloPortalDB_fat?useSSL=false&characterEncoding=utf8 spring.datasource.username = root spring.datasource.password = 123456
Path: / soft/apollo
The ports of the following files should be changed from 8080 to 8180
# grep -r 8180|grep -v target apollo-adminservice/src/main/resources/bootstrap.yml: defaultZone: http://${eureka.instance.hostname}:8180/eureka /apollo-configservice/src/main/resources/bootstrap.yml: defaultZone: http://${eureka.instance.hostname}:8180/eureka/ apollo-configservice/src/main/resources/configservice.properties:server.port= 8180 apollo-configservice/src/main/resources/application.yml: port: 8180 apollo-configservice/src/main/scripts/startup.sh:SERVER_PORT=${SERVER_PORT:=8180} apollo-portal/src/main/resources/apollo-env.properties:fat.meta=http://localhost:8180scripts/sql/ apolloconfigdb.sql: ('eureka.service.url', 'default', 'http://Localhost: 8180 / Eureka / ',' Eureka service Url, multiple services separated by English commas'), scripts / build sh:fat_ meta= http://fill-in-fat-meta-server:8180
3. Configuration of Apollo adminservice
route:
/soft/apollo/apollo-adminservice/src/main/config
File:
application-github.properties
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloConfigDB_fat?useSSL=false&characterEncoding=utf8 spring.datasource.username = root spring.datasource.password = 123456
Path: / soft/apollo
The ports of the following files should be changed from 8090 to 8190
# grep -r 8190|grep -v targetapollo-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}
4. Just compile
Compiled file path: / soft/apollo/scripts
build.sh can be executed
5. Start service
Create working directory
mkdir -p /soft/apollo-service/{apollo-configservice_fat,apollo-adminservice_fat,apollo-portal}
Copy the compiled file
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/
Enter the unzip file in their respective directory, enter the scipts directory and start the service