服务配置
优质
小牛编辑
150浏览
2023-12-01
介绍常用的服务配置。
云联壹云 平台支持基于climc命令修改常用服务配置。
说明
请确保First Node节点已正确初始化climc工具,配置步骤请参考CLIMC工具
通用配置命令如下
目前支持配置的服务有keystone、glance、region2、yunionapi、common等。
命令模式
在命令行下输入climc并带额定的参数获取相应的结果。
# 查看服务的配置信息
$ climc service-config-show <service_id>
# 修改服务的配置信息
$ climc service-config-edit <service_id>
# 修改或增加配置项
$ climc service-config <service_id> --config <key=value>
# 删除配置项
$ climc service-config <service_id> --config <key=value> --remove
# 以yaml文件配置服务
$ climc service-config-yaml <service_id> <yaml_file>
交互模式
在命令行模式下直接输入climc,不带任何参数回车,即可进入climc的交互模式。
# 进入交互模式
$ climc
climc>
# 查看服务的配置信息
climc> service-config-show <service_id>
# 修改服务的配置信息
climc> service-config-edit <service_id>
# 修改或增加配置项
climc> service-config <service_id> --config <key=value>
# 删除配置项
climc> service-config <service_id> --config <key=value> --remove
# 以yaml文件配置服务
climc> service-config-yaml <service_id> <yaml_file>
常见服务配置
服务参数配置完成后,需要等待5分钟左右才会生效。
MFA认证:即Multi-Factor Authentication,多因子认证,用户需要通过两种以上的认证方式才能登录 云联壹云 平台,即用户输入用户名和密码后,还需要输入安全码才可以登录 云联壹云 平台。多重认证保证了 云联壹云 平台的安全性。
# 关闭MFA验证 $ climc service-config --config enable_totp=false yunionapi # 启用MFA验证 $ climc service-config --config enable_totp=true yunionapi
验证码:登录 云联壹云 平台时默认需要验证码,可通过下面命令关闭验证码或启用验证码。
# 关闭验证码 $ climc service-config --config show_captcha=false yunionapi # 启用验证码 $ climc service-config --config show_captcha=true yunionapi
修改已删除主机和硬盘在回收站保留时间:默认情况下,在回收站中已删除的主机和硬盘保留时间是3天,管理员可以根据需求修改主机和硬盘的保留时间。
# 修改主机和硬盘的保留时间一周,参数值单位为s,604800 = 7*24*60。 $ climc service-config --config pending_delete_expire_seconds=604800 region2
修改已删除镜像在回收站保留时间:默认情况下,在回收站的已删除的镜像不会自动删除,需要管理员手动清除,管理员可设置镜像保留时间,自动清除已删除镜像。
# 修改镜像的保留时间一周,参数值单位为s,604800 = 7*24*60。 $ climc service-config --config pending_delete_expire_seconds=604800 glance
三级权限设置:系统安装完成后默认关闭三级权限,即平台中只包含default域,用户仅可以在default域中创建项目。当开启三级权限后,系统将支持多域,并支持在任意域内创建项目。三级权限开启后建议不要关闭。
# 开启三级权限 $ climc service-config --config non_default_domain_projects=true common # 关闭三级权限,请谨慎操作 $ climc service-config --config non_default_domain_projects=false common
设置物理机转换宿主机的默认镜像:如需使用物理机转换宿主机功能,需要事先配置物理机转换宿主机的默认镜像。
# 设置默认镜像的镜像id $ climc service-config --config convert_hypervisor_default_template=a9b67435-8c08-4063-8ea6-d885ea26aa79 region2
服务配置参数简单介绍
common
{
"config":
{
"default":{ "default_quota_value": "default", "enable_rbac": true, "non_default_domain_projects": "true", # 三级权限 "time_zone": "Asia/Shanghai"}
}
}
region2
{
"config":
{
"default":{ "admin_domain": "Default", "auth_token_cache_size": 2048, "auto_snapshot_day": 1, "auto_snapshot_hour": 2, "baremetal_server_reuse_host_ip": true, # 裸金属是否复用物理机IP "calculate_quota_usage_interval_seconds": 900, "cloud_auto_sync_interval_seconds": 30, "cloud_sync_worker_count": 5, "cloudaccount_health_status_check": "true", "convert_kubelet_docker_volume_size": "256g", "cron_job_worker_count": 4, "debug_client": false, "default_bandwidth": 1000, # 默认带宽 "default_bucket_quota": 100, # 默认存储桶配额 "default_bw_quota": 2000000, # 默认 "default_cache_quota": 10, # 默认缓存配额 "default_cpu_overcommit_bound": 8.000000, # CPU超售比 "default_cpu_quota": 200, # CPU配额 "default_disk_size": 10240, # 默认磁盘大小 "default_ebw_quota": 4000, # 默认 "default_eip_quota": 10, # 默认弹性公网IP配额 "default_eport_quota": 200, "default_group_quota": 50, # 默认组配额 "default_image_cache_dir": "image_cache", # 默认镜像缓存目录 "default_isolated_device_quota": 200, "default_keypair_quota": 50, # 默认密钥配额 "default_loadbalancer_quota": 10, # 默认负载均衡配额 "default_max_manual_snapshot_count": 2, # 手工快照数量 "default_max_snapshot_count": 9, # 默认快照数量 "default_memory_overcommit_bound": 1.000000, # 内存超售比 "default_memory_quota": 204800, # 内存配额 "default_mtu": 1500, # mtu值 "default_object_cnt_quota": 5000, # 对象数量配额 "default_object_gb_quota": 500, # 对象存储容量配额 "default_port_quota": 200, "default_quota_value": "default", "default_rds_quota": 10, # 默认rds配额 "default_secgroup_quota": 50, # 默认安全组配额 "default_security_rules": "allow any", # 默认安全组规则 "default_server_quota": 50, # 默认宿主机和物理机的配额 "default_snapshot_quota": 10, # 默认快照配额 "default_storage_overcommit_bound": 1.000000, # 存储超售比 "default_storage_quota": 12288000, # 存储配额 "default_sync_interval_seconds": 900, "disconnected_cloud_account_retry_probe_interval_hours": 24, # 与云账号失联后在多久内尝试重连 "enable_pending_delete": true, "enable_rbac": true, "expired_prepaid_max_clean_batch_size": 50, "host_offline_detection_interval": 30, "host_offline_max_seconds": 180, "ignore_nonrunning_guests": true, "image_cache_storage_policy": "least_used", "loadbalancer_pending_delete_check_interval": 3600, "max_cloud_account_error_count": 5, "max_data_disk_count": 12, "max_managed_nic_count": 1, "max_normal_nic_count": 8, "metrics_retention_days": 30, "min_data_disk_count": 0, "min_nic_count": 1, "minimal_ip_addr_reused_interval_seconds": 30, "minimal_sync_interval_seconds": 300, "non_default_domain_projects": "true", # 三级权限是否开启 "pending_delete_check_seconds": 3600, "pending_delete_expire_seconds": "604800", # 主机和硬盘在回收站的保留时间 "pending_delete_max_clean_batch_size": 50, "prepaid_expire_check": false, "prepaid_expire_check_seconds": 600, "query_offset_optimization": false, "rbac_debug": false, "rbac_policy_sync_failed_retry_seconds": 30, "rbac_policy_sync_period_seconds": 300, "repeat_weekdays_limit": 7, "request_worker_count": 4, "retention_days_limit": 49, "snapshot_create_disk_protocol": "fuse", "sync_skus_day": 1, "sync_skus_hour": 3, "system_admin_quota_check": false, "tenant_cache_expire_seconds": 900, "time_points_limit": 1, "time_zone": "Asia/Shanghai" # 时区}
}
}
keystone
{
"config":
{
"default":{ "auto_sync_interval_seconds": 30, "bootstrap_admin_user_password": "gZ4WjcqqUMWXgxM2", "calculate_quota_usage_interval_seconds": 900, "cron_job_worker_count": 4, "debug_client": false, "default_quota_value": "default", "default_sync_interval_seconds": 900, "enable_rbac": true, "fernet_key_repository": "/etc/yunion/keystone/fernet-keys", "fetch_project_resource_count_interval_seconds": 900, "non_default_domain_projects": "true", # 三级权限 "password_error_lock_count": 0, # 密码错误几次被锁定 "password_expiration_seconds": 0, # 密码有效期 "password_minimal_length": 6, # 密码最小长度 "password_unique_history_check": 0, # 密码不重复次数 "query_offset_optimization": false, "rbac_debug": false, "rbac_policy_sync_failed_retry_seconds": 30, "rbac_policy_sync_period_seconds": 300, "request_worker_count": 4, "reset_admin_user_password": false, # 是否重置管理员用户密码 "setup_credential_keys": false, "time_zone": "Asia/Shanghai", "token_expiration_seconds": 86400}
}
}
glance
{
"config":
{
"default":{ "admin_domain": "Default", "auth_token_cache_size": 2048, "calculate_quota_usage_interval_seconds": 900, "cron_job_worker_count": 4, "debug_client": false, "default_image_quota": 10, "default_quota_value": "default", "deploy_server_socket_path": "/var/run/deploy.sock", "enable_pending_delete": true, "enable_rbac": true, "enable_torrent_service": false, "filesystem_store_datadir": "/opt/cloud/workspace/data/glance/images", "non_default_domain_projects": "true", # 三级权限 "pending_delete_check_seconds": 3600, "pending_delete_expire_seconds": "604800", # 镜像在回收站的保留时长 "pending_delete_max_clean_batch_size": 50, "query_offset_optimization": false, "rbac_debug": false, "rbac_policy_sync_failed_retry_seconds": 30, "rbac_policy_sync_period_seconds": 300, "request_worker_count": 4, "target_image_formats": # 镜像格式[ "qcow2", "vmdk", "vhd"], "tenant_cache_expire_seconds": 900, "time_zone": "Asia/Shanghai", "torrent_client_path": "/opt/yunion/bin/torrent", "torrent_store_dir": "/opt/cloud/workspace/data/glance/torrents"}
}
}
yunionapi
{
"config":
{
"default":{ "admin_domain": "Default", "auth_token_cache_size": 2048, "calculate_quota_usage_interval_seconds": 900, "cron_job_worker_count": 4, "debug_client": false, "default_quota_value": "default", "disable_module_api_version": false, "enable_rbac": true, "enable_totp": false, # MFA验证 "non_default_domain_projects": "true", # 三级权限 "rbac_debug": false, "rbac_policy_sync_failed_retry_seconds": 30, "rbac_policy_sync_period_seconds": 300, "request_worker_count": 4, "show_captcha": false, # 验证码 "sqlite_path": "/etc/yunion/data/yunionapi.db", "tenant_cache_expire_seconds": 900, "time_zone": "Asia/Shanghai", "timeout": 300, "ws_port": 30443}
}
}