Introduction to Apollo
Apollo is a distributed configuration center developed by Ctrip's framework department. It can centrally manage the configuration of applications in different environments and clusters. After the configuration is modified, it can be pushed to the application side in real time, and has standardized permissions, process governance and other features. It is suitable for microservice configuration management scenarios.
Install Apollo with docker
Because of the work needs, Apollo needs to be used as the configuration center of the system. There are many ways to install Apollo, which can be installed step by step according to the official documentation. But most programmers are not familiar with Apollo, so docker is a relatively simple installation method. If you don't know docker, you can familiarize yourself with docker first.
This article takes the Ubuntu system as an example to install an Apollo configuration system with two environments (DEV, PRO). I hope to be helpful.
Environmental preparation
Pre-installation
Since Apollo is installed with docker, you must first install the docker environment. Taking the Ubuntu system as an example, we can use the Apt command to install the docker environment.
sudo apt install docker
After the installation is successful, you can use the docker command to test whether the installation is successful.
Preliminary environment preparation
Mysql, Apollo data is stored in Mysql, so we need a MySql environment, which can be installed using docker or an existing MySql instance. I will not describe the process of MySql installation too much here.
create database
https://github.com/ctripcorp/apollo/blob/master/scripts/sql/apolloportaldb.sql
https://github.com/ctripcorp/apollo/blob/master/scripts/sql/apolloconfigdb.sql
Note: apolloportaldb.sql is the portal database script, and apolloconfigdb.sql is the environment configuration database script.
Only one portal database is required, but if you need to install Apollo in multiple environments, you need to prepare multiple config databases. Can be slightly modified in apolloconfigdb.sql.
DEV环境数据库名:ApolloConfigDBDev
PRO环境数据库名:ApolloConfigDBPro
Modify database tables
After creating three databases, we need to change two tables in the database.
- In the ServerConfig table in ApolloPortalDB, there is a row apollo.portal.envs. The default is dev, we need to change it to two environments and separate them with commas: dev, pro.
- In the ServerConfig table in ApolloPortalDB, there is a row apollo.portal.meta.servers. The default is empty, we need to change it to {http://{IP}:8080}. Note that the IP here can be an external network address.
- In the ServerConfig table in the ApolloConfigDBDev database, there is a row eureka.service.url, and its value field is changed to http://{IP}:8080/eureka/. Because the default port number of the DEV environment is 8080.
In the ServerConfig table in the ApolloConfigDBPro database, there is a row eureka.service.url, and its value field is changed to http://{IP}:8083/eureka/. Because the default port number of the DEV environment is 8083.
Let me mention here that the default port number of each environment opens the dev environment, the default port: config 8080, admin 8090
Open the fat environment, default ports: config 8081, admin 8091
Open the fat environment, default ports: config 8081, admin 8091
Open uat environment, default port: config 8082, admin 8092
Open pro environment, default port: config 8083, admin 8093
Since then, our preparations have been completed, and the formal entry into the installation steps will begin below.
docker install Apollo
docker pull idoop/docker-apollo
docker run --net="host" --name apollo -d \
-e PORTAL_DB='jdbc:mysql://{MySqlIP}:{MySqlPort}/ApolloPortalDB?characterEncoding=utf8' \
-e PORTAL_DB_USER='root' \
-e PORTAL_DB_PWD=‘pwd‘ \
-e DEV_DB='jdbc:mysql://{MySqlIP}:{MySqlPort}/ApolloConfigDBDev?characterEncoding=utf8' \
-e DEV_DB_USER='root' \
-e DEV_DB_PWD='pwd' \
-e PRO_DB='jdbc:mysql://{MySqlIP}:{MySqlPort}/ApolloConfigDBPro?characterEncoding=utf8' \
-e PRO_DB_USER='root' \
-e PRO_DB_PWD='pwd' \
idoop/docker-apollo:latest
The first step is to download the image of apollo, and the second step is to officially start our Apollo command.
It should be noted here that:
In the example, {MySqlIP} and {MySqlPort} need to be replaced with the address and port number of your own MySql. The username and password will not be discussed here. Another point to note is the name of the database, which is the same as the database created before. One-to-one correspondence.
verify
- If all goes well, you will see that your scene has been pulled up, and it is worth mentioning that it is not feasible to visit immediately when it is just started. You need to let the bullet fly for a while, don't think it's because you didn't install it correctly. If the installation is successful, you can use the command
- Open the browser and enter http://IP:8070 , the port number 8070 is the management port by default. Normally open
Enter the default username and password
apollo
admin
You can enter the entire management interface. As for how to use Apollo, I will not describe too much here. Since then the entire installation process is over.
Quoted article:
https://blog.csdn.net/wangshouhan/article/details/86528700
http://t.zoukankan.com/xinzhyu-p-11479094.html
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。