SOFAArk configuration description
This topic describes how to configure SOFAArk.
SOFAArk configuration directory
The configuration directory of SOFAArk does not have to exist. If necessary, put it under the project root directory ${baseDir}/conf/ark. When sofa-ark-maven-plugin packaging is executed, the configurations in the directory are automatically packaged into an Ark package. The following example shows how to install an Ark package in a directory:
├── META-INF
│ └── MANIFEST.MF
├── SOFA-ARK
│ ├── biz
│ │ └── demo-0.0.1-SNAPSHOT-ark-biz.jar
│ └── container
│ └── sofa-ark-all-0.6.0-SNAPSHOT.jar
├── com
│ └── alipay
│ └── sofa
│ └── ark
│ ├──...
│
└── conf
└── ark
├── bootstrap-dev.properties
├── bootstrap.properties
└── log
└ ── logback-conf.xml If the SOFAArk configuration is included in the application, you must pay attention to the baseDir configuration during packaging. This parameter is used to specify the project root directory. For more information, see Ark packages.
The preceding conf/ark directory allows you to configure the startup configuration and log configuration of SOFAArk containers. conf/ark/bootstrap.properties is the default startup configuration file for a SOFAArk container. The configuration content includes the log configuration, plug-in activation and passivation configuration, and Biz activation and passivation configuration.
Log configuration
SOFAArk container logs use logback. The log configuration parameters include:
logging.path: The root path of the container log directory. By default, the path is printed in the${user.admin}/logsdirectory.This parameter only affects the log path of the SOFAArk container, but not the application log. The application log is determined by its own configuration.
logging.level.com.alipay.sofa.ark: Sets the log level of the SOFAArk container. The default value is INFO.logging.config.com.alipay.sofa.ark: The name of the custom log configuration file is used to overwrite the built-in log configuration file of the SOFAArk container. It is recommended that the custom configuration files be placed in theconf/ark/logdirectory.sofa.middleware.log.com.alipay.sofa.ark.console: Specifies whether to print container logs on the console. The default value isfalse.sofa.middleware.log.com.alipay.sofa.ark.console.level: Use withsofa.middleware.log.com.alipay.sofa.ark.consoleconfiguration items. If the log is printed on the console, this item is used to configure the log level of the SOFAArk container to be printed on the console.
Plug-in configuration
ark.plugin.active.include: specifies which plug-ins to activate. Separate multiple plug-ins with commas (,). By default, all plug-ins in the Ark package are activated.ark.plugin.active.exclude: specifies which plug-ins are excluded. Separate multiple plug-ins with commas (,). This parameter is empty by default.ImportantIf both properties are configured, the
ark.plugin.active.includetakes precedence.
Biz configuration
ark.biz.active.include: specifies which Biz instances are activated. Separate multiple Biz instances with commas (,). By default, all Biz in the Ark package is activated.ark.biz.active.exclude: specifies which Biz entries are excluded. Separate multiple Biz entries with commas (,). This parameter is empty by default.com.alipay.sofa.ark.master.biz: the name of the host Biz. The default value is Host Biz. If the Ark package contains only one Biz, you do not need to set this option. Otherwise, you need to set this option based on your business requirements.ImportantIf the first two properties are configured at the same time, the
ark.biz.active.includetakes precedence.
Dynamic configuration
SOFAArk provides a plug-in for connecting to ZooKeeper to dynamically receive Biz commands. The configuration format is as follows:
com.alipay.sofa.ark.config.address=zookeeper://ip:port?key1=value1&key2=value2If dynamic configuration is configured, SOFAArk preferentially controls the deployment of Biz based on the dynamic configuration. Therefore, if you have configured com.alipay.sofa.ark.config.address and multiple Biz packages are typed into the Ark package, only the host application (Master Biz) will be started.
Profile mechanism
By default, SOFAArk containers use bootstrap.properties configurations. In actual development, different configurations may be loaded based on the running environment. SOFAArk provides a profile mechanism. When you specify a profile value, the SOFAArk container loads the bootstrap-${profile}.properties profile.
You can use one of the following methods to configure a profile:
Pass in by
-D VMparametersFor example, you can specify
-Dark.profile=dev,dev2. Separate multiple values with commas (,).Pass in by application startup parameters
For example, you can
java -jar demo-executable-ark.jar -Aprofile=dev,dev2multiple values and separate them with commas (,).