Skip to main content

Service Configuration Management

This article introduces the management principles of platform service configuration.

Most service configurations have three sources:

  • Command line parameters
  • Configuration files, configuration file paths are generally in /etc/yunion/<service_name>.conf
  • Service configuration stored in Keystone

If a parameter is set in all three sources, the configuration source ranked later has the highest priority.

Command Line Parameters​

Service configuration is first set through command line parameters. If there is a --config configuration, the content of the configuration file specified by --config will be loaded, and parameters will be set according to the content of the configuration file.

The following configuration items are parameters that can only be specified through the command line:

Configuration ItemTypeDescription
configstringSpecify configuration file path
helpboolDisplay help information and exit
versionboolDisplay version information and exit
pid_filestringPID file path

Configuration Files​

Configuration files can be in Key=Value format or YAML format. Configuration items in configuration files are read once by the service program from the configuration file when the server starts. Modifications to the configuration file after the program starts will not be dynamically loaded.

Some services will further load configuration information from Keystone's service configuration and monitor changes in Keystone's service configuration to dynamically update service configuration.

Not all configuration items can be dynamically loaded from Keystone's service configuration. The following configuration items are parameters that can only be specified through command line parameters or file configuration. These configuration items mainly include service authentication information, database configuration information, etc.

Configuration ItemTypeDescription
regionstringName of the region to which the service instance belongs, generally region0
application_idstringApplication name of the service
log_levelstringLog level for output, default is info, i.e., only output info|warning|error logs, can be set to debug
log_verbose_levelintLog redundancy (deprecated)
temp_pathstringDirectory for storing local temporary files
addressstringService API listening address
portstringService API listening port
port_v2stringv2 port (deprecated)
admin_portstringManagement port (deprecated)
session_endpoint_typestringEndpoint type for accessing other services, default is internal
admin_passwordstringKeystone service account password
admin_projectstringProject to which the Keystone service account belongs
admin_project_domainstringDomain name of the project to which the Keystone service account belongs, default is Default
admin_userstringKeystone service account username
admin_domainstringDomain name to which the Keystone service account user belongs, default is Default
auth_urlstringKeystone authentication URL, generally https://<keystone>:30500/v3
enable_sslstringWhether to enable TLS (https)
ssl_certfilestringCertificate file path for TLS certificate
ssl_keyfilestringPrivate key path for TLS certificate
ssl_ca_certsstringCA certificate path for TLS certificate, optional. If certfile is a certificate containing a full chain, this option can be empty
is_slave_nodeboolWhether this running instance is in SLAVE state. Scheduled tasks for each service only run on MASTER instances
config_sync_period_secondsintTime interval for passively syncing configuration from keystone, default is 1800 seconds
sql_connectionstringDefine common database SQL connection string, default is empty
clickhousestringDefine ClickHouse SQL connection string, default is empty
ops_log_with_clickhouseboolWhether to use ClickHouse to record operation logs (opslog), default is false. When clickhouse is set and ops_log_with_clickhouse is true, opslog records are saved in ClickHouse
db_checksum_skip_initboolAfter enabling database integrity check, whether to skip database initialization. If not skipped, need to wait for a long time for database checksum recalculation
db_checksum_tablesboolWhether to enable database integrity check. If enabled, integrity check is performed on tables in enable_db_checksum_tables
enable_db_checksum_tables[]stringSpecify database table names for database integrity check
auto_sync_tableboolAutomatically sync database schema, default is false
exit_after_db_initboolService automatically exits after initializing the database. If auto_sync_table=true and exit_after_db_init=true, the service automatically exits after database schema synchronization
global_virtual_resource_namespaceboolWhether resources use global namespace, default is true, meaning resource names in different projects cannot be duplicated
debug_sqlchemyboolWhether to enable sqlchemy debug mode, default is false, i.e., do not output sqlchemy logs
lockman_methodstringResource lock implementation mechanism, optional values are inmemory and etcd, default is inmemory. If the service enables multiple instances, it should be set to etcd to implement distributed locks
etcd_lock_prefixstringPrefix of etcd distributed lock key
etcd_lock_ttlstringetcd lock expiration time, default is 5 seconds
etcd_endpointsstringList of etcd service addresses
etcd_usernamestringetcd authentication username
etcd_passwordstringetcd authentication user password
etcd_use_tlsstringWhether etcd uses TLS
etcd_skip_tls_verifystringIf etcd enables TLS, whether to verify certificate validity
etcd_cacertstringIf etcd enables TLS, path to CA certificate file
etcd_certstringIf etcd enables TLS, path to certificate file
etcd_keystringIf etcd enables TLS, path to private key file
splitable_max_duration_hoursstringIf log enables automatic table splitting, time interval for each table to save, default is one month 30*24=720 hours
ops_log_max_keep_monthsstringIf log enables automatic table splitting, default retention time interval, default is 6 months

If the service runs in Kubernetes, configuration information is saved in YAML format in the configmap under the onecloud namespace. For example, the configuration of the region service is saved in the default-region configmap. When the service starts, the content of this configmap is mounted to the container's /etc/yunion/<service>.conf file path and loaded by the service as a file configuration. Therefore, to modify the configuration file content, you need to modify the corresponding configmap content.

Modify configmap configuration through the following command:

kubectl -n onecloud edit configmap default-region

After modifying the configmap, you need to restart the service for the configuration to take effect.

Keystone Service Configuration​

Some services implement the ability to dynamically load configuration parameters from Keystone's service configuration. These services include: notify, log, baremetal-agent, scheduler, keystone, glance, cloudid, region, webconsole, apigateway, meter, report.

After these services start, they first load configuration parameters from command line parameters and configuration files, then load service configuration stored in Keystone and maintain near real-time synchronization. After external service configuration updates, Keystone pushes configuration updates to each service through etcd.

The configuration stored in Keystone for each service is divided into two parts: public configuration and personalized configuration. If a configuration item is valid in both public configuration and personalized configuration, the configuration item in public configuration has higher priority.

Public Configuration​

Public configuration is shared by all services and stored in a service configuration called "common". You can access common service configuration through the following climc commands.

# View public configuration in JSON format
climc service-config-show common
# Edit public service configuration in YAML format
climc service-config-edit common

Supported public configuration parameters are as follows:

Configuration ItemTypeDescription
enable_quota_checkboolWhether to enable quota, default is false. After enabling, creating new resources requires checking the quota of the corresponding project or domain
default_quota_valuestringAfter enabling quota, default initial quota for new domains or projects. There are three values: unlimit (default unlimited), zero (default 0 quota), default (default initial value, customized by each service for default quota of each resource), default is default
non_default_domain_projectsboolWhether to allow non-Default domains to have projects, i.e., whether to allow three-level permissions. If true, resources are organized at three levels: global, domain, project
time_zonestringTime zone of platform deployment, default is China time zone, i.e., "Asia/Shanghai"
domainized_namespaceboolWhether each tenant is an independent namespace, default is false
api_serverstringPlatform's external service address, URL address for browsers to open the platform web console
customized_private_prefixes[]stringCustom private IP address segments. If not set, defaults to RFC1918 (https://datatracker.ietf.org/doc/html/rfc1918) defined private cloud IP address space
global_http_proxystringGlobal http proxy address
global_https_proxystringGlobal https proxy address
ignore_nonrunning_guestsboolWhether to ignore memory allocation of non-running VMs, default is true, i.e., after a VM shuts down, its memory is not reserved and can be occupied by other VMs. When resources are tight, after a VM shuts down, there is no guarantee that there is enough memory to allow it to start again
platform_namestringPlatform's default name
platform_namesmap[string]stringPlatform name in each language, e.g., map[string]string{"zh_CN": "äē‘", "en_US": "Cloud"}

Service Personalized Configuration​

In addition to public configuration, each service has its own personalized configuration. You can use the following climc commands to access configuration information stored in Keystone for the specified service:

# View configuration in JSON format
climc service-config-show <service_name>
# Edit configuration information in YAML format
climc service-config-edit <service_name>

Host Agent Service Configuration​

Compared with other services' service configuration, Host Agent's service configuration has some special features. First, Host Agent's service configuration does not implement the function of obtaining service configuration from Keystone, only supports loading configuration items from command line parameters and configuration files. Second, Host Agent's file configuration is divided into three parts:

  • Default host configuration file, specified through --config parameter, default location is /etc/yunion/host.conf. This configuration is loaded by default by the host service, located at /etc/yunion/host.conf on each compute node. Configuration items in this file are loaded first.
  • Public host configuration file, specified through --common-config-file parameter, default location is /etc/yunion/common/common.conf. When deployed in Kubernetes, common.conf content is implemented by mounting configmap default-host. Therefore, by modifying the content of configmaps default-host, you can uniformly modify the host service configuration of all compute nodes. Configuration in this file will override host.conf configuration.
  • Personalized configuration file for public host configuration, specified through --local-config-file parameter, default location is /etc/yunion/host_local.conf. This configuration is used to personalize configuration items defined in common.conf. Configuration in this file will override common.conf configuration.

For HostAgent services deployed in Kubernetes, public configuration is stored in the configmap named default-host under the onecloud namespace. Personalized configuration is stored in the configuration file /etc/yunion/host.conf on each host machine. Localized public configuration is stored in the configuration file /etc/yunion/host_local.conf on each host machine.

Common HostAgent public configuration items are as follows:

Configuration ItemTypeDescription
ExecutorSocketPathstringListening socket address of this host's yunion-executor service, default is /var/run/onecloud/exec.sock
DeployServerSocketPathstringListening socket address of this host's host-deployer service, default is /var/run/onecloud/deploy.sock
EnableRemoteExecutorboolWhether to use yunion-executor to execute commands, default is false. If host runs in a container, must be true
ManageNtpConfigurationboolWhether HostAgent manages the host machine's ntp configuration, default is true
DisableSecurityGroupboolWhether to disable security group function on this host machine, default is false
HostCpuPassthroughboolWhether to passthrough host machine's CPU model to VMs. If not passthrough, VM's CPU model is qemu64. Default is true, i.e., passthrough host CPU to VM
DefaultQemuVersionstringDefault qemu version. After 3.9, default version is 4.2.0. Before 3.9, default version is 2.12.1

View Service's Current Configuration Parameters​

Starting from 3.9, some services have added an app-options API that can obtain the service's currently effective configuration parameters.

You can read the configuration parameters of the specified service through the following climc command. Supported services include: identity, compute, image, baremetal, meter

climc app-options-show <service-type>

You can obtain the configuration parameters of the host service for the specified host machine through the following climc command:

climc host-app-options <host-id>