1. How does windows execute build.sh?

Install Git Bash, then run ./build.sh Note the first ./

2. When running locally Portal keeps reporting Env is down.

By default config service starts on port 8080 and admin service starts on port 8090. Please check if these two ports are occupied by other applications.

If there is also an exception message: org.springframework.web.client.HttpClientErrorException: 405 Method Not Allowed, it is usually due to the local startup of ShadowSocks, because ShadowSocks will occupy port 8090 by default. port 8090 by default.

Version 1.1.0 added System Information page, you can view the current Meta Server and admin service information of each environment through Administrator Tools -> System Information to help troubleshoot the problem.

3. Admin server or config server is registered with intranet IP, resulting in portal or client cannot access admin server or config server

Please refer to network policy.

4. How to add environment by Portal Console

4.1 1.6.0 and above

Version 1.6.0 adds the ability to customize the environment, which allows you to add an environment without modifying the code

  1. add environment for protaldb, refer to 3.1 Adjusting ApolloPortalDB configuration
  2. add the meta server address corresponding to the new environment for apollo-portal, refer to: 2.2.1.1.2.4 Configuring meta service information for apollo-portal. apollo-client also needs to be configured properly when used in a new environment, refer to: 1.2.2 Apollo Meta Server.

Note 1: A set of Portal can manage multiple environments, but each environment needs to deploy a set of Config Service, Admin Service and ApolloConfigDB independently, please refer to: 2.1.2 Creating ApolloConfigDB, 3.2 Adjusting ApolloConfigDB configuration, 2.2.1.1.2 Configuring database connection information

Note 2: If you are adding an environment to Apollo Configuration Center that has been running for a while, don’t forget to refer to 2.1.2.4 Importing ApolloConfigDB project data from another environment to initialize the new environment

4.2 1.5.1 and earlier

4.2.1 Adding an Apollo pre-defined environment

If the environment to be added is an Apollo pre-defined environment (DEV, FAT, UAT, PRO), two steps are required.

  1. protaldb add environment, refer to 3.1 Adjusting ApolloPortalDB configuration
  2. add the meta server address corresponding to the new environment for apollo-portal, refer to: 2.2.1.1.2.4 Configuring meta service information for apollo-portal. apollo-client also needs to be configured properly when used in a new environment, refer to: 1.2.2 Apollo Meta Server.

Note 1: A set of Portal can manage multiple environments, but each environment needs to deploy a set of Config Service, Admin Service and ApolloConfigDB independently, please refer to: 2.1.2 Creating ApolloConfigDB, 3.2 Adjusting ApolloConfigDB configuration, 2.2.1.1.2 Configuring database connection information

Note 2: If you are adding an environment to Apollo Configuration Center that has been running for a while, don’t forget to refer to 2.1.2.4 Importing ApolloConfigDB project data from another environment to initialize the new environment

4.2.2 Adding a custom environment

If the environment to be added is not one of Apollo’s pre-defined environments, please refer to the following steps.

  1. Assume the name of the environment to be added is beta
  2. Modify com.ctrip.framework.apollo.core.enums.Env class by adding the BETA enumeration to it.
    1. public enum Env{
    2. LOCAL, DEV, BETA, FWS, FAT, UAT, LPT, PRO, TOOLS, UNKNOWN;
    3. ...
    4. }
  3. Modify the com.ctrip.framework.apollo.core.enums.EnvUtils class to include conversion logic for the BETA enumeration.

    1. public final class EnvUtils {
    2. public static Env transformEnv(String envName) {
    3. if (StringUtils.isBlank(envName)) {
    4. return Env.UNKNOWN;
    5. }
    6. switch (envName.trim().toUpperCase()) {
    7. ...
    8. case "BETA":
    9. return Env.BETA;
    10. ...
    11. default:
    12. return Env.UNKNOWN;
    13. }
    14. }
    15. }
  4. Modify apollo-env.properties to add the beta.meta placeholder.
    1. local.meta=http://localhost:8080
    2. dev.meta=${dev_meta}
    3. fat.meta=${fat_meta}
    4. beta.meta=${beta_meta}
    5. uat.meta=${uat_meta}
    6. lpt.meta=${lpt_meta}
    7. pro.meta=${pro_meta}
  5. Modify the com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider class to add logic to read the meta server address of the BETA environment.

    1. public class LegacyMetaServerProvider {
    2. ...
    3. domains.put(Env.BETA, getMetaServerAddress(prop, "beta_meta", "beta.meta"));
    4. ...
    5. }
  6. Add BETA environment for protaldb, refer to 3.1 Adjusting ApolloPortalDB configuration

  7. Add the meta server address corresponding to the new environment for apollo-portal, refer to: 2.2.1.1.2.4 Configuring meta service information for apollo-portal. apollo-client also needs to be configured properly when used in a new environment, refer to: 1.2.2 Apollo Meta Server.

Note 1: A set of Portal can manage multiple environments, but each environment needs to deploy a set of Config Service, Admin Service and ApolloConfigDB independently, please refer to: 2.1.2 Creating ApolloConfigDB, 3.2 Adjusting ApolloConfigDB configuration, 2.2.1.1.2 Configuring database connection information

Note 2: If you are adding an environment to Apollo Configuration Center that has been running for a while, don’t forget to refer to 2.1.2.4 Importing ApolloConfigDB project data from another environment to initialize the new environment

5. How do I delete applications, clusters, Namespace?

From version 0.11.0 Apollo Administrator has added a page to delete applications, clusters and AppNamespace, we recommend to use this page to delete them.

Page entry :

delete-app-cluster-namespace-entry

Page details :

delete-app-cluster-namespace-detail

6. How to solve the problem of getting inaccurate IP due to multiple NICs on the client side?

The logic of getting client NIC has been adjusted in version 1.4.0, so you need to differentiate according to client version

6.1 apollo-client for 1.3.0 and earlier versions

If there are multiple NICs and they are all normal NICs, you need to add a mapping relationship in /etc/hosts to raise the weight.

Format: ip ${hostname}

Here ${hostname} is the result of your execution of hostname on the machine.

For example, if the correct IP is: 192.168.1.50, the result of the hostname execution is: jim-ubuntu-pc Then the final record mapped in the hosts file is

  1. 192.168.1.50 jim-ubuntu-pc

6.2 apollo-client for version 1.4.0 and later

If you have multiple NICs and they are all normal NICs, you can change the priority by adjusting their order in the system, with the first in the order having higher priority.

7. Dynamically adjusting the Logging level of Spring Boot via Apollo

You can refer to spring-cloud-logger in the apollo-use-cases project and spring-boot-logger code examples.

8. Register Config Service and Admin Service to a separate Eureka Server

Apollo comes with Eureka as an internal registry implementation by default, and there is generally no need to consider deploying a separate registry for Apollo.

However, some companies already have a set of Eureka, if you want to register Apollo’s Config Service and Admin Service to achieve unified management, you can follow the steps below.

1. Configure Config Service to not start the built-in Eureka Server

1.1 1.5.0 and above

Configure apollo-configService with apollo.eureka.server.enabled=false, either through bootstrap.yml or the -D parameter.

1.2 versions before 1.5.0

Modify com.ctrip.framework.apollo.configservice.ConfigServiceApplication , change @EnableEurekaServer to @ EnableEurekaClient

  1. @EnableEurekaClient
  2. @EnableAspectJAutoProxy
  3. @EnableAutoConfiguration // (exclude = EurekaClientConfigBean.class)
  4. @Configuration
  5. @EnableTransactionManagement
  6. @PropertySource(value = {"classpath:configservice.properties"})
  7. @ComponentScan(basePackageClasses = {ApolloCommonConfig.class,
  8. ApolloBizConfig.class,
  9. ConfigServiceApplication.class,
  10. ApolloMetaServiceConfig.class})
  11. public class ConfigServiceApplication {
  12. ...
  13. }

2. Modify eureka.service.url in ApolloConfigDB.ServerConfig table to point to your own Eureka address

For example, if your own Eureka service address is 1.1.1.1:8761 and 2.2.2.2:8761, then set eureka.service.url in ApolloConfigDB.ServerConfig table with:

  1. http://1.1.1.1:8761/eureka/,http://2.2.2.2:8761/eureka/

Note that changing the Eureka address only requires changing the eureka.service.url in the ApolloConfigDB.ServerConfig table, not the meta server address.

By default, the meta service and config service are deployed in the same JVM process, so the address of the meta service is the address of the config service, so you don’t need to change the meta server address when you modify the Eureka address.

9. Using ConditionalOnProperty in Spring Boot does not read the configuration

The @ConditionalOnProperty feature is supported since version 0.10.0, see Spring Boot integration method

10. How to achieve the client in room A reads the config service of room A nearby and the client in room B reads the config service of room B nearby in multiple rooms?

Please refer to Issue 1294, in this case, because the Chinese and American server rooms are far away from each other, so the config db needs to be deployed in two places. If it is a multi-city machine room, the config service of both machine rooms can be connected to one config db.

11. Does apollo have support for HEAD request pages? AliCloud slb configuration health check only supports HEAD requests

Each service of apollo has /health page, which is used by apollo to do health check and supports various request methods such as GET, POST, HEAD, etc.

12. How can apollo be configured to view permissions?

Starting from version 1.1.0, apollo-portal adds support for view permissions, which allows you to configure an environment to allow only project members to view the private Namespace.

The project members here are

  1. The project’s administrator
  2. Have the permission to modify or publish the private Namespace in that environment

The configuration is very simple, after logging in with the super administrator account, go to Administrator Tools - System Parameters page to add or modify configView.memberOnly.envs configuration items.

configView.memberOnly.envs

13. How to put apollo in a separate tomcat to run?

Some companies’ O&M policies may require that they must use a standalone tomcat to run their applications and do not allow apollo to run in the default startup.sh way. The following is a brief example of how to make the apollo server run in a standalone tomcat.

  1. Get the apollo code (the release version is recommended for production deployments)
  2. Modify the apollo-configservice pom.xml and add <packaging>war</packaging>.
  3. Configure build.sh according to the distributed deployment documentation, and then package it
  4. Put the apollo-configservice war package under tomcat
    • cp apollo-configservice/target/apollo-configservice-xxx.war ${tomcat-dir}/webapps/ROOT.war Run tomcat’s startup.sh
  5. Run tomcat’s startup.sh

In addition, apollo has some tuning parameters that are recommended to be configured in tomcat’s server.xml, which can be found in application.properties

14. How to replace registry Eureka with zookeeper?

Many company microservice projects are already using zookeeper, if you want to replace Eureka with zookeeper for the purpose of easy service management, you can refer to the transformation steps contributed by @hanyidreamer: registry Eureka replacement for zookeeper

15. How to achieve different configurations and not affect each other when multiple people are developing locally at the same time?

Refer to #1560

16. How to set the relative path after Portal is mounted to nginx/slb?

In general it is recommended to use the root directory directly to mount the portal, however if there are cases where you want to share nginx/slb with other applications and need to add a relative path (e.g. /apollo), then you can configure it as follows.

16.1 Portal for version 1.7.0 and above

First add the -D parameter server.servlet.context-path=/apollo or the system environment variable SERVER_SERVLET_CONTEXT_PATH=/apollo for apollo-portal.

Then just configure forwarding on nginx/slb, using nginx as an example.

  1. location /apollo/ {
  2. proxy_set_header X-Forwarded-Host $host;
  3. proxy_set_header X-Forwarded-Server $host;
  4. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  5. proxy_pass http://127.0.0.1:8070/apollo/;
  6. }

16.2 Portal for version 1.6.0 and above

First add the prefix.path=/apollo configuration parameter to the portal, the configuration is very simple, after logging in with the super administrator account, go to the Administrator Tools - System Parameters page and add or modify the prefix.path configuration item.

Then you can configure forwarding on nginx/slb, using nginx as an example.

  1. location /apollo/ {
  2. proxy_set_header X-Forwarded-Host $host;
  3. proxy_set_header X-Forwarded-Server $host;
  4. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  5. proxy_pass http://127.0.0.1:8070/;
  6. }