[Apollo] Use Docker to quickly experience and understand the Apollo configuration center

1. Preparation

1) Install Docker
installation guide

2) Download Apollo source code

git clone https://github.com/ctripcorp/apollo.git

Then enter the docker-quick-start directory

cd apollo/scripts/docker-quick-start

Second, start the Apollo configuration center

Execute the command to start the service

docker-compose up

Seeing the following log indicates successful startup:

apollo-quick-start    | ==== starting service ====
apollo-quick-start    | Service logging file is ./service/apollo-service.log
apollo-quick-start    | Started [51]
...
apollo-quick-start    | Waiting for config service startup......
apollo-quick-start    | Config service started. You may visit http://localhost:8080 for service status now!
apollo-quick-start    | Waiting for admin service startup..
apollo-quick-start    | Admin service started
apollo-quick-start    | ==== starting portal ====
apollo-quick-start    | Portal logging file is ./portal/apollo-portal.log
apollo-quick-start    | Started [259]
apollo-quick-start    | Waiting for portal startup......
apollo-quick-start    | Portal started. You can visit http://localhost:8070 now!

There are three parts involved:

1.config service

Visit address: http: // localhost: 8080

2.Admin service

Visit address: http: // localhost: 8070

Username and password: apollo / admin

3.mysql server

localhost: 13306, the user name is root, and the password is blank

* If you want to view more service logs, you can docker exec -it apollo-quick-start bashlog in, then go to /apollo-quick-start/serviceand /apollo-quick-start/portalto view the log information

Three, start the Demo client program

docker exec -i apollo-quick-start /apollo-quick-start/demo.sh client

Get the configuration value by entering the configuration key; just start the apollo configuration center, there will be a default timeout we can access, you can log in to the background to perform various operations

➜  ~ docker exec -i apollo-quick-start /apollo-quick-start/demo.sh client
[apollo-demo][main]2020-04-18 09:25:20,866 INFO  [com.ctrip.framework.foundation.internals.provider.DefaultApplicationProvider] App ID is set to SampleApp by app.id property from /META-INF/app.properties
[apollo-demo][main]2020-04-18 09:25:20,871 INFO  [com.ctrip.framework.foundation.internals.provider.DefaultServerProvider] Environment is set to [dev] by JVM system property 'env'.
[apollo-demo][main]2020-04-18 09:25:20,977 INFO  [com.ctrip.framework.apollo.internals.DefaultMetaServerProvider] Located meta services from apollo.meta configuration: http://localhost:8080!
[apollo-demo][main]2020-04-18 09:25:20,978 INFO  [com.ctrip.framework.apollo.core.MetaDomainConsts] Located meta server address http://localhost:8080 for env DEV from com.ctrip.framework.apollo.internals.DefaultMetaServerProvider
Apollo Config Demo. Please input key to get the value. Input quit to exit.
> timeout
Loading key : timeout with value: 300

 

Guess you like

Origin www.cnblogs.com/756623607-zhang/p/12726276.html