diff --git a/docs/en/deployment/quick-start.md b/docs/en/deployment/quick-start.md index b4fe384aa8e..35d88e91883 100644 --- a/docs/en/deployment/quick-start.md +++ b/docs/en/deployment/quick-start.md @@ -1,4 +1,4 @@ -In order to let you get started with Apollo Configuration Center faster, we have prepared a Quick Start here, which can deploy and start Apollo Configuration Center in your local environment in a few minutes. +To help you quickly get started with the Apollo Configuration Center, we have prepared a Quick Start here, which can deploy and start Apollo Configuration Center in your local environment in a few minutes. If you are familiar with Docker, you can refer to [Apollo Quick Start Docker Deployment](en/deployment/quick-start-docker) to deploy Apollo via Docker. Apollo Quick Start Docker. @@ -49,7 +49,7 @@ We have prepared a Quick Start installation package, you just need to download i The installation package is 50M, if you can't access github, you can download it from Baidu.com. 1. Download from GitHub - * Checkout or download the [apollo-build-scripts project](https://github.com/apolloconfig/apollo-quick-start) + * Checkout or download the [apollo-quick-start project](https://github.com/apolloconfig/apollo-quick-start) * **Since the Quick Start project is relatively large, it is placed in a different repository, so please note the project address** * https://github.com/apolloconfig/apollo-quick-start 2. Download from Baidu.com @@ -69,12 +69,12 @@ Quick Start is only for local testing, so generally users do not need to downloa # II. Initialization and Startup #### Precautions 1. The Apollo server process needs to use ports 8070, 8080, 8090 respectively, please ensure these three ports are not currently in use. -2. The `github` in the SPRING_PROFILES_ACTIVE environment variable in the script is a required profile, `auth` is a profile that provides simple authentication for the portal, it can be removed if authentication is not required or other authentication methods are used. +2. The `github` in the SPRING_PROFILES_ACTIVE environment variable in the script is a required profile, `database-discovery` specifies the use of database service discovery, `auth` is a profile that provides simple authentication for the portal, it can be removed if authentication is not required or other authentication methods are used. ## 2.1 Use H2 in-memory database, automatic initialization No configuration is required, just use the following command to start > Note: When using the in-memory database, any operation will be lost after the Apollo process restarts ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" unset SPRING_SQL_CONFIG_INIT_MODE unset SPRING_SQL_PORTAL_INIT_MODE java -jar apollo-all-in-one.jar @@ -88,7 +88,7 @@ java -jar apollo-all-in-one.jar ### 2.2.1 First startup Use the SPRING_SQL_CONFIG_INIT_MODE="always" and SPRING_SQL_PORTAL_INIT_MODE="always" environment variable for initialization at the first startup ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db export SPRING_SQL_CONFIG_INIT_MODE="always" export SPRING_CONFIG_DATASOURCE_URL="jdbc:h2:file:~/apollo/apollo-config-db;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;BUILTIN_ALIAS_OVERRIDE=TRUE;DATABASE_TO_UPPER=FALSE" @@ -102,7 +102,7 @@ java -jar apollo-all-in-one.jar ### 2.2.2 Subsequent startup Remove the SPRING_SQL_CONFIG_INIT_MODE and SPRING_SQL_PORTAL_INIT_MODE environment variable to avoid repeated initialization at subsequent startup ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db unset SPRING_SQL_CONFIG_INIT_MODE export SPRING_CONFIG_DATASOURCE_URL="jdbc:h2:file:~/apollo/apollo-config-db;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;BUILTIN_ALIAS_OVERRIDE=TRUE;DATABASE_TO_UPPER=FALSE" @@ -121,7 +121,7 @@ java -jar apollo-all-in-one.jar ### 2.3.1 First startup Use the SPRING_SQL_INIT_MODE="always" environment variable for initialization at the first startup ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db export SPRING_SQL_CONFIG_INIT_MODE="always" export SPRING_CONFIG_DATASOURCE_URL="jdbc:mysql://your-mysql-server:3306/ApolloConfigDB?useUnicode=true&characterEncoding=UTF8" @@ -139,7 +139,7 @@ java -jar apollo-all-in-one.jar ### 2.3.2 Subsequent startup Remove the SPRING_SQL_CONFIG_INIT_MODE and SPRING_SQL_PORTAL_INIT_MODE environment variable to avoid repeated initialization at subsequent startup ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db unset SPRING_SQL_CONFIG_INIT_MODE export SPRING_CONFIG_DATASOURCE_URL="jdbc:mysql://your-mysql-server:3306/ApolloConfigDB?useUnicode=true&characterEncoding=UTF8" @@ -166,7 +166,7 @@ You can import [apolloportaldb.sql](https://github.com/apolloconfig/apollo/blob/ 2. The "apollo-username" and "apollo-password" in the environment variables in the script need to fill in the actual username and password ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db unset SPRING_SQL_CONFIG_INIT_MODE export SPRING_CONFIG_DATASOURCE_URL="jdbc:mysql://your-mysql-server:3306/ApolloConfigDB?useUnicode=true&characterEncoding=UTF8" @@ -181,13 +181,7 @@ java -jar apollo-all-in-one.jar ``` -# III. Additional Startup Instructions -## 3.1 Troubleshooting -If you encounter an exception in the startup, you can check the log files in the service and portal directories respectively to troubleshoot the problem. - -> Note: During start-up, eureka registration failure message will be output in the log, e.g. `com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused`. Note that this is expected because apollo-configservice needs to register the service with Meta Server (itself), but since it is not up yet during the startup process itself, this error is reported. A retry action will be performed later, so it will register properly when the service is up by itself. - -## 3.2 Note +# III. Note Quick Start is only used to help you quickly experience Apollo project, please refer to: [distributed-deployment-guide](en/deployment/distributed-deployment-guide) for details. @@ -196,21 +190,30 @@ It should be noted that Quick Start does not support adding environments, but on # IV. Using Apollo Configuration Center ## 4.1 Using the sample project -### 4.1.1 Viewing the sample configuration +### 4.1.1 Initialize the sample configuration 1. Open http://localhost:8070 > Quick Start integrates with [Spring Security simple authentication](en/extension/portal-how-to-implement-user-login-function?id=implementation-1-simple-authentication-using-spring-security-provided-by-apollo), for more information you can refer to [Portal implementing user login function](en/extension/portal-how-to-implement-user-login-function) -login +login 2. Enter username apollo and password admin and log in -![Home](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/apollo-sample-home.png) +![Home](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/apollo-sample-home-en.jpg) + +3. Click "Create project", enter the `SampleApp` information, and submit. + +![Create project](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/apollo-create-sample-app-en.jpg) + +4. Go to the SampleApp configuration interface, click on "Add Configuration", enter the `timeout` information, and submit. -3. Click on SampleApp to enter the configuration screen, you can see that there is currently a configuration timeout=100 -![Configuration Console](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-config.png) +![Add configuration](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/apollo-create-sample-config-en.jpg) -> If prompted `system error, please retry or contact system owner`, please retry a few seconds later, because there is a refresh delay for services registered through Eureka. +5. Click on the "Release" button, and fill in the release information. + +![Configuration page](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/sample-app-config-en.jpg) + +![Release page](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/sample-app-release-detail-en.jpg) ### 4.1.2 Running the client application We have prepared a simple [Demo client](https://github.com/apolloconfig/apollo-demo-java/blob/main/api-demo/src/main/java/com/apolloconfig/apollo/demo/api/SimpleApolloConfigDemo.java) to demonstrate getting configuration from Apollo Configuration Center. @@ -229,7 +232,7 @@ Apollo Config Demo. Please input key to get the value. Input quit to exit. Enter ``timeout`` and you will see the following message. ```sh > timeout -> [SimpleApolloConfigDemo] Loading key : timeout with value: 100 +Loading key : timeout with value: 1000 ``` > If you encounter problems running the client, you can view more detailed logging information by changing the level in ``client/log4j2.xml`` to DEBUG @@ -241,30 +244,21 @@ Enter ``timeout`` and you will see the following message. ### 4.1.3 Modify the configuration and publish -1. In the configuration screen, click the edit button for the timeout item - ![Edit Configuration](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-modify-config.png) - -2. In the popup box, change the value to 200 and submit - ![Update Configuration](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-submit-config.png) - - - -3. Click the Publish button and fill in the publish information - ![Publish Configuration](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-release-config.png) +Return to the configuration interface, change the value of `timeout` to 2000, and release the configuration. -![Release Info](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-release-detail.png) +![Modify configuration](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/sample-app-modify-config-en.jpg) ### 4.1.4 Client view the modified value If the client has been running, it will listen for configuration changes after the configuration is published and output the modified configuration information as follows. ```sh -[SimpleApolloConfigDemo] Changes for namespace application -[SimpleApolloConfigDemo] Change - key: timeout, oldValue: 100, newValue: 200, changeType: MODIFIED +Changes for namespace application +Change - key: timeout, oldValue: 1000, newValue: 2000, changeType: MODIFIED ``` Type ``timeout`` again to see the corresponding value and you will see the following message. ```sh > timeout -> [SimpleApolloConfigDemo] Loading key : timeout with value: 200 +Loading key : timeout with value: 2000 ``` ## 4.2 Using the new project diff --git a/docs/zh/deployment/quick-start.md b/docs/zh/deployment/quick-start.md index a87c15b4149..bb78ccfd177 100644 --- a/docs/zh/deployment/quick-start.md +++ b/docs/zh/deployment/quick-start.md @@ -1,4 +1,4 @@ -为了让大家更快的上手了解Apollo配置中心,我们这里准备了一个Quick Start,能够在几分钟内在本地环境部署、启动Apollo配置中心。 +为了让大家更快地上手了解Apollo配置中心,我们这里准备了一个Quick Start,能够在几分钟内在本地环境部署、启动Apollo配置中心。 考虑到Docker的便捷性,我们还提供了Quick Start的Docker版本,如果你对Docker比较熟悉的话,可以参考[Apollo Quick Start Docker部署](zh/deployment/quick-start-docker)通过Docker快速部署Apollo。 @@ -49,7 +49,7 @@ SHOW VARIABLES WHERE Variable_name = 'version'; 安装包共50M,如果访问github网速不给力的话,可以从百度网盘下载。 1. 从GitHub下载 - * checkout或下载[apollo-build-scripts项目](https://github.com/apolloconfig/apollo-quick-start) + * checkout或下载[apollo-quick-start项目](https://github.com/apolloconfig/apollo-quick-start) * **由于Quick Start项目比较大,所以放在了另外的repository,请注意项目地址** * https://github.com/apolloconfig/apollo-quick-start 2. 从百度网盘下载 @@ -69,13 +69,13 @@ Quick Start只针对本地测试使用,所以一般用户不需要自己下载 # 二、数据库初始化及启动 #### 注意事项 1. apollo 服务端进程需要分别使用8070, 8080, 8090端口,请确保这3个端口当前没有被使用。 -2. 脚本中的 SPRING_PROFILES_ACTIVE 环境变量中的 `github` 是必须的 profile,`auth` 是 portal 提供简单认证的 profile,不需要认证或者使用其它认证方式时可以去掉 +2. 脚本中的 SPRING_PROFILES_ACTIVE 环境变量中的 `github` 是必须的 profile,`database-discovery` 指定使用数据库服务发现, `auth` 是 portal 提供简单认证的 profile,不需要认证或者使用其它认证方式时可以去掉 ## 2.1 使用 H2 内存数据库,自动初始化 无需任何配置,直接使用如下命令启动即可 > 注:使用内存数据库时,任何操作都会在 apollo 进程重启后丢失 ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" unset SPRING_SQL_CONFIG_INIT_MODE unset SPRING_SQL_PORTAL_INIT_MODE java -jar apollo-all-in-one.jar @@ -89,7 +89,7 @@ java -jar apollo-all-in-one.jar ### 2.2.1 首次启动 首次启动使用 SPRING_SQL_CONFIG_INIT_MODE="always" 和 SPRING_SQL_PORTAL_INIT_MODE="always" 环境变量来进行初始化 ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db export SPRING_SQL_CONFIG_INIT_MODE="always" export SPRING_CONFIG_DATASOURCE_URL="jdbc:h2:file:~/apollo/apollo-config-db;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;BUILTIN_ALIAS_OVERRIDE=TRUE;DATABASE_TO_UPPER=FALSE" @@ -103,7 +103,7 @@ java -jar apollo-all-in-one.jar ### 2.2.2 后续启动 后续启动去掉 SPRING_SQL_CONFIG_INIT_MODE 和 SPRING_SQL_PORTAL_INIT_MODE 环境变量来避免重复初始化 ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db unset SPRING_SQL_CONFIG_INIT_MODE export SPRING_CONFIG_DATASOURCE_URL="jdbc:h2:file:~/apollo/apollo-config-db;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;BUILTIN_ALIAS_OVERRIDE=TRUE;DATABASE_TO_UPPER=FALSE" @@ -122,7 +122,7 @@ java -jar apollo-all-in-one.jar ### 2.3.1 首次启动 首次启动使用 SPRING_SQL_INIT_MODE="always" 环境变量来进行初始化 ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db export SPRING_SQL_CONFIG_INIT_MODE="always" export SPRING_CONFIG_DATASOURCE_URL="jdbc:mysql://your-mysql-server:3306/ApolloConfigDB?useUnicode=true&characterEncoding=UTF8" @@ -140,7 +140,7 @@ java -jar apollo-all-in-one.jar ### 2.3.2 后续启动 后续启动去掉 SPRING_SQL_CONFIG_INIT_MODE 和 SPRING_SQL_PORTAL_INIT_MODE 环境变量来避免重复初始化 ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db unset SPRING_SQL_CONFIG_INIT_MODE export SPRING_CONFIG_DATASOURCE_URL="jdbc:mysql://your-mysql-server:3306/ApolloConfigDB?useUnicode=true&characterEncoding=UTF8" @@ -167,7 +167,7 @@ ApolloPortalDB 通过各种MySQL客户端导入[apolloportaldb.sql](https://gith 2. 脚本环境变量中的 "apollo-username" 和 "apollo-password" 需要填写实际的用户名和密码 ```bash -export SPRING_PROFILES_ACTIVE="github,auth" +export SPRING_PROFILES_ACTIVE="github,database-discovery,auth" # config db unset SPRING_SQL_CONFIG_INIT_MODE export SPRING_CONFIG_DATASOURCE_URL="jdbc:mysql://your-mysql-server:3306/ApolloConfigDB?useUnicode=true&characterEncoding=UTF8" @@ -182,13 +182,8 @@ java -jar apollo-all-in-one.jar ``` -# 三、启动额外说明 -## 3.1 异常排查 -如果启动遇到了异常,可以分别查看service和portal目录下的log文件排查问题。 +# 三、注意 -> 注:在启动的过程中会在日志中输出eureka注册失败的信息,如`com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused`。需要注意的是,这个是预期的情况,因为apollo-configservice需要向Meta Server(它自己)注册服务,但是因为在启动过程中,自己还没起来,所以会报这个错。后面会进行重试的动作,所以等自己服务起来后就会注册正常了。 - -## 3.2 注意 Quick Start只是用来帮助大家快速体验Apollo项目,具体实际使用时请参考:[分布式部署指南](zh/deployment/distributed-deployment-guide)。 另外需要注意的是Quick Start不支持增加环境,只有通过分布式部署才可以新增环境,同样请参考:[分布式部署指南](zh/deployment/distributed-deployment-guide) @@ -196,21 +191,30 @@ Quick Start只是用来帮助大家快速体验Apollo项目,具体实际使用 # 四、使用Apollo配置中心 ## 4.1 使用样例项目 -### 4.1.1 查看样例配置 +### 4.1.1 初始化样例配置 1. 打开http://localhost:8070 > Quick Start集成了[Spring Security简单认证](zh/extension/portal-how-to-implement-user-login-function#实现方式一:使用apollo提供的spring-security简单认证),更多信息可以参考[Portal 实现用户登录功能](zh/extension/portal-how-to-implement-user-login-function) -登录 +登录 2. 输入用户名apollo,密码admin后登录 -![首页](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/apollo-sample-home.png) +![首页](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/apollo-sample-home.jpg) + +3. 点击创建应用,输入`SampleApp`信息并提交 + +![创建应用](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/apollo-create-sample-app.jpg) + +4. 进入SampleApp配置界面,点击新增配置,输入`timeout`信息并提交 -3. 点击SampleApp进入配置界面,可以看到当前有一个配置timeout=100 -![配置界面](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-config.png) +![创建配置](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/apollo-create-sample-config.jpg) -> 如果提示`系统出错,请重试或联系系统负责人`,请稍后几秒钟重试一下,因为通过Eureka注册的服务有一个刷新的延时。 +5. 点击发布按钮,并填写发布信息 + +![配置界面](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/sample-app-config.jpg) + +![发布界面](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/sample-app-release-detail.jpg) ### 4.1.2 运行客户端程序 我们准备了一个简单的[Demo客户端](https://github.com/apolloconfig/apollo-demo-java/blob/main/api-demo/src/main/java/com/apolloconfig/apollo/demo/api/SimpleApolloConfigDemo.java)来演示从Apollo配置中心获取配置。 @@ -229,7 +233,7 @@ Apollo Config Demo. Please input key to get the value. Input quit to exit. 输入`timeout`,会看到如下信息: ```sh > timeout -> [SimpleApolloConfigDemo] Loading key : timeout with value: 100 +Loading key : timeout with value: 1000 ``` > 如果运行客户端遇到问题,可以通过修改`client/log4j2.xml`中的level为DEBUG来查看更详细日志信息 @@ -241,28 +245,21 @@ Apollo Config Demo. Please input key to get the value. Input quit to exit. ### 4.1.3 修改配置并发布 -1. 在配置界面点击timeout这一项的编辑按钮 -![编辑配置](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-modify-config.png) - -2. 在弹出框中把值改成200并提交 -![配置修改](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-submit-config.png) - -3. 点击发布按钮,并填写发布信息 -![发布](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-release-config.png) +回到配置界面,修改`timeout`配置项的值为2000,并发布配置。 -![发布信息](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-build-scripts@master/images/sample-app-release-detail.png) +![修改配置](https://cdn.jsdelivr.net/gh/apolloconfig/apollo-quick-start@master/images/sample-app-modify-config.jpg) ### 4.1.4 客户端查看修改后的值 如果客户端一直在运行的话,在配置发布后就会监听到配置变化,并输出修改的配置信息: ```sh -[SimpleApolloConfigDemo] Changes for namespace application -[SimpleApolloConfigDemo] Change - key: timeout, oldValue: 100, newValue: 200, changeType: MODIFIED +Changes for namespace application +Change - key: timeout, oldValue: 1000, newValue: 2000, changeType: MODIFIED ``` 再次输入`timeout`查看对应的值,会看到如下信息: ```sh > timeout -> [SimpleApolloConfigDemo] Loading key : timeout with value: 200 +Loading key : timeout with value: 2000 ``` ## 4.2 使用新的项目