# docker_ctrip_apollo **Repository Path**: xiwanggit/docker_ctrip_apollo ## Basic Information - **Project Name**: docker_ctrip_apollo - **Description**: 携程分布式配置中心apollo的本地化docker部署 & docker分布式部署 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2020-12-22 - **Last Updated**: 2021-07-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 参考文档:[Github Quick-Start](https://github.com/ctripcorp/apollo/wiki/Quick-Start) ## 本地单机部署 ### install steps * [download code](https://github.com/nobodyiam/apollo-build-scripts) * 初始化数据库 * PortalDb ``` create database ApolloPortalDB; create user 'apollo_portal' identified by 'apollo_portal'; grant all privileges on ApolloPortalDB.* to apollo_portal@'%' identified by 'apollo_portal'; flush privileges; source code/sql/apolloportaldb.sql ``` * ConfigDB ``` create database ApolloConfigDB; create user 'apollo_config' identified by 'apollo_config'; grant all privileges on ApolloConfigDB.* to apollo_config@'%' identified by 'apollo_config'; flush privileges; source code/sql/apolloconfigdb.sql ``` * 修改 `code/demo.sh` 的数据库连接信息。修改内容如下 ``` #apollo config db info apollo_config_db_url=jdbc:mysql://ip:port/ApolloConfigDB?characterEncoding=utf8 apollo_config_db_username=用户名 apollo_config_db_password=密码(如果没有密码,留空即可) #apollo portal db info apollo_portal_db_url=jdbc:mysql://ip:port/ApolloPortalDB?characterEncoding=utf8 apollo_portal_db_username=用户名 apollo_portal_db_password=密码(如果没有密码,留空即可) ``` * 构建镜像 ``` cd code docker build -t apollo-quick-start . ``` * 启动: `Docker-compose up` * 访问:`http://ip:8070/` * 用户名:`apollo` * 密码:`admin` ## docker 分布式部署 ### install steps * `docker-compose.yml` 见 `apollo_multi_env` * 启动前需要修改各个环境中的`ApolloConfigDB.ServerConfig.eureka.service.url`为`http://{宿主机IP}:{暴露端口}/eureka/` ## API访问 * `get`的url:`{config_server_url}/configfiles/json/{appId}/{clusterName}/{namespaceName}` * `config_server_url`:对应环境的 `http://ip:8080`。如 * `http://ip:8081/configfiles/json/bigdata/default/application` * `http://ip:8081/configfiles/json/bigdata/default/manager`