1. OpenStack 部署

系统要求

单机部署最低配置:

  • 2张网卡
  • 8G内存
  • 40G硬盘空间

主机系统:

  • CentOS Stream 9
  • Debian Bullseye (11)
  • openEuler 22.03 LTS
  • Rocky Linux 9- Ubuntu Jammy (22.04)

官方不再支持CentOS 7作为主机系统,我这里使用的是Rocky Linux 9.2(最小化安装)

推荐创建team或bond,避免网卡名称不一致的问题

关闭所有节点的防火墙和selinux,若为生产环境,则不推荐关闭防火墙

systemctl disable --now firewalld

禁用selinux

setenforce 0;sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config

1. deploy节点安装依赖

1.1 安装基础依赖

dnf install git python3-devel libffi-devel gcc openssl-devel python3-libselinux

1.2 安装Ansible额外需要的包

官方文档中没有说明,实际部署过程中,没有这两个包会无法使用pip安装的ansible

dnf install python3-resolvelib sshpass

1.3 设置Python-venv虚拟环境

为了防止与系统的python环境冲突,这里使用虚拟环境安装ansible与kolla-ansible, /path/to/venv是虚拟环境的目录,可以自己指定

创建虚拟环境

python3 -m venv /path/to/venv

进入虚拟环境

source /path/to/venv/bin/activate

在虚拟环境中输入deactivate命令,即可退出虚拟环境

更换pip国内源,更新pip

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip install -U pip

1.4 安装Ansible

Kolla-ansible需要ansible-core2.13~2.14的版本,这里需要指定版本安装

pip install ansible==7.7.0 ansible-core==2.14.11

1.5 所有节点安装docker

控制节点、网络节点、存储节点和计算节点

2. deploy节点安装Kolla-ansible

2.1 安装本体

pip install git+https://opendev.org/openstack/kolla-ansible@stable/2023.1  #虽然安装Zed版,但此处还是用stable/2023.1(原本应该使用unmaintained/zed)

2.2 获取Kolla配置文件

创建配置文件夹

mkdir /etc/kolla

复制global.ymlpassword.yml到配置文件夹

cp -r /path/to/venv/share/kolla-ansible/etc_examples/kolla/* /etc/kolla

2.3 获取Ansible清单文件

复制all-in-onemultinode两个清单文件,分别对应了单机部署与多节点部署

cp /path/to/venv/share/kolla-ansible/ansible/inventory/* /etc/kolla

3. 安装Ansible Galaxy依赖

kolla-ansible install-deps    #可能偶现ERROR,多尝试

4. 配置Ansible

单机部署时,可以跳过这一步

编辑/etc/ansible/ansible.cfg,如果没有则需要先创建,将下面的内容添加到配置文件中

[defaults]
host_key_checking=False
pipelining=True
forks=100

5. 准备初始化配置 deploy

5.1 修改hosts

单机部署时,可以跳过这一步

在部署机的hosts中添加需要部署的主机的主机名,后续会自动同步到所有节点 编辑/etc/hosts文件,我这里准备部署3台控制节点与3台计算节点 (共用)

还需要配置deploy节点到这几个节点的 SSH互信

10.0.0.10 control01.openstack.instack.cloud control01
10.0.0.20 control02.openstack.instack.cloud control02
10.0.0.21 control03.openstack.instack.cloud control03

5.2 准备清单文件

  • 单机部署时,使用all-in-one清单文件- 多节点部署时,使用multinode清单文件

单机部署时,可以不用修改all-in-one清单文件

下面是我的multinode清单文件的开头部分,供参考

[all]
control01
control02
control03
compute01
compute02

[control]
control01 # ansible_ssh_pass="root"  network_interface="ens192"  指定root密码、管理网卡
control02 # ansible_ssh_pass="root"  network_interface="ens192"
control03 # ansible_ssh_pass="root"  network_interface="ens192"

[network:children]
# 可在组名后添加:children来对组进行嵌套
control

[compute]
compute01
compute02

[monitoring:children]
control

[deployment]
localhost       ansible_connection=local

详细的配置规则见 Ansible文档(opens new window)

配置完成后,使用下面的命令测试Ansible的连通性

ansible -i multinode all -m ping

5.3 生成密码

kolla-genpwd

密码存储在/etc/kolla/passwords.yml

推荐自己修改一下某些密码,比如keystone_admin_password

5.4 配置 globals.yml

镜像选择

Kolla可以选择多种镜像版本:

  • CentOS Stream (centos)- Debian (debian)- Rocky (rocky)- Ubuntu (ubuntu) 官方推荐新安装的使用rocky或ubuntu,这里使用和主机相同的rocky发行版

默认不用修改

kolla_base_distro: "rocky"

镜像仓库

国内可能访问quay.io比较慢,可以指定国内的quay.io源

docker_registry: "quay.nju.edu.cn"

自建仓库(推荐自建仓库,并将镜像保存)

docker_registry: "hub.ankele.cloud"

登录

docker_registry_insecure: "yes"
docker_registry_username: "admin"
# docker_registry_password在password.yml中配置
#docker_registry: "quay.nju.edu.cn"
docker_registry: "hub.ankele.cloud"

防火墙

生产环境中,请开启firewalld.service,并且在globals.yml中配置

disable_firewall: "false"
enable_external_api_firewalld: "true"
external_api_firewalld_zone: "public" #指定你要使用的zone,之后还是需要自己给zone添加rule

配置了firewall后,若firewalld.service没开启,precheck会报错的,所以,还需要开启firewalld.service

网络

管理网络的网卡,也用于主机之间的通信,若非所有主机网卡名都是一致的,可以使用bond或team技术

network_interface: "bond0"

连接外部网络的网卡,需要一个开启的,没有配置IP的网卡

neutron_external_interface: "bond1"

用于管理的浮动IP,由keepalived提供高可用性,必须是管理网络中没有被使用的地址

kolla_internal_vip_address: "10.0.0.250"
kolla_external_vip_address: "192.168.110.110" # 若不需被外部访问,则不用配置此项
kolla_external_vip_interface: "bond2" # 若不需被外部访问,则不用配置此项

监控

enable_prometheus

虚拟机高可用

enable_hacluster
enable_masakari

中心日志

enable_central_logging: "yes"
#enable_venus: "yes"  # 我的还是enable_venus=no

global.yml中所有的选项,都可以在清单文件中为每个主机单独配置。上面的multinode文件中,指定了每台主机的管理网卡与外部网卡。

[root@huahuadeploy kolla]# cat globals.yml | grep -v '^#' | grep -v '^$'
---
workaround_ansible_issue_8743: yes
kolla_internal_vip_address: "10.20.10.110" # 内部管理网络VIP,internal endpoint使用
kolla_external_vip_address: "192.168.110.110" # (可选)外部管理网络VIP, public endpoint使用
docker_registry: "hub.ankele.cloud" # 本地Harbor仓库,或使用quay.io或使用quay.nju.edu.cn
docker_registry_insecure: "yes"
docker_registry_username: "admin"
network_interface: "bond0"  # 内部管理网络网卡名称,使用bond可以统一不同节点的网卡名称或者提供网络高可用
kolla_external_vip_interface: "bond2" # (可选)有外部管理网VIP时填写
neutron_external_interface: "bond1" # 提供者网络,一般用于公网IP和弹性IP
keepalived_virtual_router_id: "110" # 同一网络下有多个集群时需要不同的router_id,类型为uint8
disable_firewall: "false"
openstack_region_name: "ChengDuTest"
enable_hacluster: "yes" # 是否启用实例高可用,节点故障时迁移
enable_masakari: "yes" # 是否启用实例高可用,节点故障时迁移
enable_barbican: "yes"
enable_ceilometer: "yes"
enable_ceilometer_ipmi: "yes"
enable_central_logging: "yes"
enable_cinder: "yes"
enable_cinder_backup: "yes"
enable_fluentd: "yes"
enable_gnocchi: "yes"
enable_gnocchi_statsd: "yes"
enable_grafana: "yes"
enable_ironic: "yes" # 是否需要包括裸金属服务
enable_mariabackup: "yes"
enable_neutron_dvr: "yes"
enable_neutron_qos: "yes"
enable_prometheus: "yes"
enable_redis: "yes" # 是否使用redis提供缓存和gnocchi的incoming存储
enable_skyline: "yes"
enable_venus: "yes"
enable_ironic_ipxe: "no"
ironic_dnsmasq_serve_ipxe: false
ceph_glance_keyring: "ceph.client.glance1.keyring"  # ceph相关的默认就行,这里用户和池名称均添加了数字1
ceph_glance_user: "glance1"
ceph_glance_pool_name: "images1"
ceph_cinder_keyring: "ceph.client.cinder1.keyring"
ceph_cinder_user: "cinder1"
ceph_cinder_pool_name: "volumes1"
ceph_cinder_backup_keyring: "ceph.client.cinder-backup1.keyring"
ceph_cinder_backup_user: "cinder-backup1"
ceph_cinder_backup_pool_name: "backups1"
ceph_nova_keyring: "{{ ceph_cinder_keyring }}"
ceph_nova_user: "cinder1" # 重点
ceph_nova_pool_name: "vms1" # 重点
ceph_gnocchi_keyring: "ceph.client.gnocchi1.keyring"
ceph_gnocchi_user: "gnocchi1"
ceph_gnocchi_pool_name: "gnocchi1"
glance_backend_ceph: "yes"
gnocchi_backend_storage: "ceph"
cinder_backend_ceph: "yes"
nova_backend_ceph: "yes"
ironic_dnsmasq_interface: "bond0" # 裸金属dnsmasq默认使用内部管理网
ironic_dnsmasq_dhcp_ranges:
  - range: "10.20.10.241,10.20.10.250"
    routers: "10.20.10.254"
ironic_enable_rolling_upgrade: "no" # 更新的不用
ironic_inspector_kernel_cmdline_extras: ['ipa-lldp-timeout=90.0', 'ipa-collect-lldp=1']
prometheus_cmdline_extras: "--web.enable-lifecycle"

6. 配置ceph

我们需要提前部署一个ceph集群,要求ceph的public network和计算节点网络相通

存储池的名称和用户名可以在/etc/kolla/globals.yml中找到并修改

nova_backend_ceph, cinder_backend_ceph, glance_backend_ceph, ceph_cinder_backup_pool_name

ceph_nova_user, ceph_cinder_user, ceph_glance_user, cinder-backup

# Glance
ceph_glance_keyring: "ceph.client.glance1.keyring"
ceph_glance_user: "glance1"
ceph_glance_pool_name: "images1"
# Cinder
ceph_cinder_keyring: "ceph.client.cinder1.keyring"
ceph_cinder_user: "cinder1"
ceph_cinder_pool_name: "volumes1"
ceph_cinder_backup_keyring: "ceph.client.cinder-backup1.keyring"
ceph_cinder_backup_user: "cinder-backup1"
ceph_cinder_backup_pool_name: "backups1"
# Nova  # 重点是cinder1不是nova1
ceph_nova_keyring: "{{ ceph_cinder_keyring }}"
ceph_nova_user: "cinder1"
ceph_nova_pool_name: "vms1"
# Gnocchi
ceph_gnocchi_keyring: "ceph.client.gnocchi1.keyring"
ceph_gnocchi_user: "gnocchi1"
ceph_gnocchi_pool_name: "gnocchi1"

以下均在cephadm节点执行

6.1 创建存储池

先到https://docs.ceph.com/en/latest/rados/operations/pgcalc/ 计算一下pg数,或直接导出创建pool的脚本
ceph osd pool create volumes1 <pg_num> <pgp_num>
ceph osd pool create images1 <pg_num> <pgp_num>
ceph osd pool create backups1 <pg_num> <pgp_num>
ceph osd pool create vms1 <pg_num> <pgp_num>
ceph osd pool create gnocchi1 <pg_num> <pgp_num>

rbd pool init volumes1
rbd pool init images1
rbd pool init backups1
rbd pool init vms1
ceph osd pool application enable gnocchi1 rgw # 在页面上去设置也可,pools>gnocchi>edit>application>rgw

# optional
ceph osd pool create cephfs_data 64 64
ceph osd pool create cephfs_metadata 64 64
ceph osd pool application enable cephfs_data cephfs
ceph osd pool application enable cephfs_metadata cephfs
ceph fs new myfs cephfs_metadata cephfs_data

6.2 创建glance cinder cinder-backup账户

ceph auth get-or-create client.glance1 mon 'profile rbd' osd 'profile rbd pool=images1' mgr 'profile rbd pool=images1'

ceph auth get-or-create client.cinder1 mon 'profile rbd' osd 'profile rbd pool=volumes1, profile rbd pool=vms1, profile rbd-read-only pool=images1' mgr 'profile rbd pool=volumes1, profile rbd pool=vms1'

ceph auth get-or-create client.cinder-backup1 mon 'profile rbd' osd 'profile rbd pool=backups1' mgr 'profile rbd pool=backups1'

ceph auth get-or-create client.gnocchi1 mon "allow r" osd "allow rwx pool=gnocchi1"

6.3 复制keyring

ceph auth get-or-create client.glance1 > /etc/ceph/ceph.client.glance1.keyring
ceph auth get-or-create client.cinder1 > /etc/ceph/ceph.client.cinder1.keyring
ceph auth get-or-create client.cinder-backup1 > /etc/ceph/ceph.client.cinder-backup1.keyring
ceph auth get-or-create client.gnocchi1 > /etc/ceph/ceph.client.gnocchi1.keyring

将上述文件copy到deploy节点的/etc/kolla/config下

.
├── cinder
│   ├── cinder-backup
│   │   ├── ceph.client.cinder-backup.keyring
│   │   ├── ceph.client.cinder.keyring
│   │   └── ceph.conf -> /etc/kolla/config/custom/ceph.conf
│   └── cinder-volume
│       ├── ceph.client.cinder.keyring
│       └── ceph.conf -> /etc/kolla/config/custom/ceph.conf
├── custom
│   └── ceph.conf
├── glance
│   ├── ceph.client.glance.keyring
│   └── ceph.conf -> /etc/kolla/config/custom/ceph.conf
├── gnocchi
│   ├── ceph.client.gnocchi1.keyring
│   └── ceph.conf -> /etc/kolla/config/custom/ceph.conf
├── haproxy
├── ironic
│   ├── ironic-agent.initramfs
│   ├── ironic-agent.kernel
│   └── pxelinux.0
├── nova
│   ├── ceph.client.cinder.keyring
│   └── ceph.conf -> /etc/kolla/config/custom/ceph.conf
└── nova.conf

nova.conf

[DEFAULT]
block_device_allocate_retries = 6000
block_device_allocate_retries_interval = 30
# config drive 能够在 instance 启动时将网络配置信息动态注入到操作系统中
flat_injected = true
[libvirt]
inject_password = true
[filter_scheduler]
enabled_filters = SimpleCIDRAffinityFilter,DifferentHostFilter,JsonFilter,SameHostFilter

7. 配置Ironic(可选)

vim /etc/kolla/globals.yml

enable_ironic: "yes"
enable_ironic_neutron_agent: "{{ enable_neutron | bool and enable_ironic | bool }}"
ironic_dnsmasq_interface: "{{ network_interface }}"
ironic_cleaning_network: "ext_net_test"
ironic_dnsmasq_dhcp_ranges:
  - range: "192.168.131.10,192.168.131.50"
    routers: "192.168.2.1"
ironic_dnsmasq_boot_file: "pxelinux.0"
ironic_inspector_kernel_cmdline_extras: ['ipa-lldp-timeout=90.0', 'ipa-collect-lldp=1']

下载镜像 (我们自己有——virt-custom制作的initramfs,允许root登录)

$ curl https://tarballs.opendev.org/openstack/ironic-python-agent/dib/files/ipa-centos9-stable-2023.1.kernel \
  -o /etc/kolla/config/ironic/ironic-agent.kernel

$ curl https://tarballs.opendev.org/openstack/ironic-python-agent/dib/files/ipa-centos9-stable-2023.1.initramfs \
  -o /etc/kolla/config/ironic/ironic-agent.initramfs

8. 部署

我这里采用多节点部署,使用的是multinode清单文件,单机部署请使用all-in-one清单文件

引导服务器

kolla-ansible -i ./multinode bootstrap-servers  # 检查是否干净,关闭防火墙,安装一些包,这是需要联网的

部署前检查

kolla-ansible -i ./multinode prechecks

开始部署 莫慌,先去掉所有节点外网IP

kolla-ansible -i ./multinode deploy

9. 使用OpenStack

9.1 命令行(OpenStack CLI)

安装CLI客户端

pip install python-openstackclient -c https://releases.openstack.org/constraints/upper/zed
pip install python-ironicclient
pip install python-ironic-inspector-client
pip install python-masakariclient==8.0.0

生成openrc文件

kolla-ansible post-deploy

使用openrc文件

. /etc/kolla/admin-openrc.sh

接下来就可以使用OpenStack CLI了

9.2 网页(Horizon)

浏览器中访问kolla_internal_vip_address or kolla_external_vip_address

skyline默认端口 9999

horizon默认端口80

输入账号密码即可

账号密码可在password.yml中找到

10 网络拓扑

  1. 若需要多个flat网络,可以通过neutron_bridge_name这个配置选项来配置网卡名称,globals.yaml中不提供此配置,需要自己写,请先跟踪一下ansible脚本
  2. 推荐集群管理网络和ceph public network同vlan
  3. 使用qcow2镜像从卷创建虚拟机,批量创建虚拟机时,每个VM的创建过程都会将image拉取到控制节点进行格式转换,所以,会占用大量的控制节点管理网络带宽,会导致控制节点管理网络瘫痪。推荐使用raw格式镜像,并且在glance.conf中配置show_image_direct_url = true和show_multiple_locations = true

11 nova.conf 配置调优

[DEFAULT]
# 允许resize时调度到原节点
allow_resize_to_same_host = true
# 重启计算节点后恢复虚拟机到之前的状态
resume_guests_state_on_host_boot=true
# CPU预留,预留4个核心给主机使用,保证在运行虚拟机实例的同时,计算节点本身的管理任务不会因为资源竞争而受到影响
# 这个参数似乎仅影响placement,不指定具体哪些核心被保留,可能出现宿主机和虚拟机竞争的情况,使用cpu_shared_set(仅虚拟机间共享)
# 如果设置了[compute] cpu_shared_set或[compute] cpu_dedicated_set,那么此值不能设置,这两个值未指定的cpu视为预留
#reserved_host_cpus = 4 # 生产环境中使用cpu_sahred_set所以不再配置此
# 内存预留,预留足够的内存给主机使用
reserved_host_memory_mb = 20480
# 磁盘预留空间
reserved_host_disk_mb = 10240
# CPU超配
cpu_allocation_ratio = 4.0
# 默认16
initial_cpu_allocation_ratio = 4.0
#内存超配
ram_allocation_ratio = 1.0
# 默认1.5
initial_ram_allocation_ratio = 1.0
#磁盘超配,虽然我们不使用磁盘
disk_allocation_ratio = 1.0
# 默认1.0
initial_disk_allocation_ratio = 1.0
# 服务下线时间间隔阈值
service_down_time = 120

# 一个计算节点上最多同时构建多少个虚拟机,默认10
max_concurrent_builds = 50
# 每个实例最多多少个快照,我们没有实例快照功能
max_concurrent_snapshots = 5
# 允许同时在线迁移的数量,默认1,为确保安全,不建议修改
max_concurrent_live_migrations = 5
# 创建卷到卷可用期间的检查次数,默认60,跟镜像大小和存储性能有关
block_device_allocate_retries = 180
# 卷分配过程中,每次重试的时间间隔,默认3s
block_device_allocate_retries_interval = 6
# 此选项允许为可能需要很长时间的RPC调用设置备用超时值。如果设置了,其他服务的RPC调用将使用这个超时时间值(秒),而不是全局的rpc_response_timeout值
long_rpc_timeout=1800
# rpc池大小,默认30
rpc_conn_pool_size = 150
# 连接过期的池大小限制,默认2
conn_pool_min_size = 20
# 连接池中闲置连接的生存时间,默认1200
conn_pool_ttl = 1200
# 当执行器是threading/eventlet时,线程池大小,默认64
executor_thread_pool_size = 256
# RPC调用超时时间,默认60
rpc_response_timeout = 300
# 使用定时ping来确认nova服务是否健康,默认false
rpc_ping_enabled = true
# RPC服务端最多同时处理300个并发请求,默认100

# 是否注入网络配置信息,当使用config_drive开启
flat_injected = true

[compute]
# 代替vcpu_pin_set用于指定哪些核给虚拟机使用,并且可用于调度hw:emulator_threads_policy=share
cpu_shared_set = "4-95,100-191"
# 指定用于PCPU,也就是虚拟机独占的核,加上cpu_shared_set就是完整的vcpu_pin_set
#cpu_dedicated_set

[database]
# 数据库连接池大小,默认5
max_pool_size = 20
# 数据库连接池外的连接数,默认50
max_overflow = 50

[filter_scheduler]
enabled_filters = SimpleCIDRAffinityFilter,DifferentHostFilter,JsonFilter,SameHostFilter
#enabled_filters = RetryFilter,AvailabilityZoneFilter,RamFilter,DiskFilter,ComputeFilter,SameHostFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,PciPassthroughFilter,NUMATopologyFilter,AggregateInstanceExtraSpecsFilter

[libvirt]
inject_password = true

[oslo_messaging_amqp]
# 限制RPC服务端处理的并发数量,默认100
rpc_server_credit = 300

[oslo_messaging_rabbit]
# 一个失踪的客户端在放弃给它发送回复之前要等待多长时间,不能大于response_timeout
kombu_missing_consumer_retry_timeout = 180
# 认为down的间隔,默认60
heartbeat_timeout_threshold = 120
# 几次才认为down,默认2
heartbeat_rate = 2

12 cinder.conf 配置调优

[DEFAULT]
# 保存cinder状态的顶级目录
state_path = /var/lib/cinder
# 从glance下载镜像到卷最多尝试次数,默认3
glance_num_retries = 30
# 允许http访问glance,默认false
glance_api_insecure = false
# 检查服务时多少时间认为down,默认60
service_down_time = 180
# 镜像转换路径,默认$state_path/conversion
image_conversion_dir = $state_path/conversion
# 镜像格式转化,多少时间超时,默认60
image_conversion_cpu_limit = 60
# 禁止镜像转换,默认false
image_conversion_disable = false
# 默认卷配额10
quota_volumes = 1048576
# 默认快照配额10
quota_snapshots = 1048576
# 默认容量配额1000
quota_gigabytes = 104857600
# 每个卷最大容量,默认-1
per_volume_size_limit = 65536
# 节点向datastore报告状态的间隔,默认10
report_interval = 10
# 运行周期任务的间隔,默认60
periodic_interval = 60
# 预留后端容量百分比,默认0
reserved_percentage = 5

# 去掉CapacityFilter,
scheduler_default_filters = AvailabilityZoneFilter,CapabilitiesFilter

rbd_flatten_volume_from_snapshot = false


# RPC连接池,默认30
rpc_conn_pool_size = 150
# 连接过期的池大小限制,默认2
conn_pool_min_size = 20
# 当执行器是threading/eventlet时,线程池大小,默认64
executor_thread_pool_size = 256
# RPC调用超时时间,默认60
rpc_response_timeout = 300
# 使用定时ping来确认nova服务是否健康,默认false
rpc_ping_enabled = true

# 允许glance执行不安全SSL (https)请求(将使用https,但不会执行cert验证),默认false
glance_api_insecure = true
# http/https访问glance的超时,未设置则使用glanceclient的默认值,默认未设置
glance_request_timeout = 3600

# 如果为False,显式关闭客户端套接字连接,默认true
wsgi_keep_alive = true
# 客户端连接套接字操作的超时时间。如果传入的连接空闲了该秒,它将被关闭。值为0意味着永远等待。默认900
client_socket_timeout = 900

[backend_defaults]
reserved_percentage = 10

[database]
# 数据库连接池大小,默认5
max_pool_size = 20
# 数据库连接池外的连接,默认50
max_overflow = 50

13 glance.conf 配置调优

[DEFAULT]
#hashing_algorithm = sha512
# 镜像缓存的元数据放哪,可填sqlite和xattr,默认sqlite
##image_cache_driver = sqlite
# 镜像缓存路径,默认空
##image_cache_dir = /var/lib/glance
# RPC连接池,默认30
rpc_conn_pool_size = 150
# 连接过期的池大小限制,默认2
conn_pool_min_size = 20
# 当执行器是threading/eventlet时,线程池大小,默认64
executor_thread_pool_size = 256
# RPC调用超时时间,默认60
rpc_response_timeout = 300
# 使用定时ping来确认nova服务是否健康,默认false
rpc_ping_enabled = true

workers = 20
# 使用raw格式镜像的情况下,可以免除download and upload images,直接基于image的snap创建,即volume依赖image
show_image_direct_url = true
show_multiple_locations = true

[database]
# 数据库连接池大小,默认5
max_pool_size = 20
# 数据库连接池外的连接,默认50
max_overflow = 50

14 系统配置调优

# 是否允许IP在同系统的不同网卡之间转发,路由器、网关和需要NAT的系统需要开启
#echo 'net.ipv4.ip_forward=1' | sudo tee -a /etc/sysctl.conf
# 逆向路径过滤
#echo 'net.ipv4.conf.all.rp_filter=0' | sudo tee -a /etc/sysctl.conf
#echo 'net.ipv4.conf.default.rp_filter=0' | sudo tee -a /etc/sysctl.conf
# 定义系统Socket监听队列的长度,那些已握手还未被服务器接受的连接,默认4096
echo 'net.core.somaxconn=20480' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

# 默认9223372036854775807,不用修改
#echo 'fs.file-max = 9223372036854775807' | sudo tee -a /etc/sysctl.conf

echo '* soft nofile 102400' | sudo tee -a /etc/security/limits.conf
echo '* hard nofile 102400' | sudo tee -a /etc/security/limits.conf

# 最大限度不使用交换空间
echo 'vm.swappiness=0' | sudo tee -a /etc/sysctl.conf
vm.min_free_kbytes=4194304 内核保留内存
vm.max_map_count=262144 默认值65530,限制单个进程的虚拟内存区域数量VMA,控制节点(OpenSearch)推荐262144

内存配置优化
echo 0 > /sys/kernel/mm/ksm/pages_shared
echo 0 > /sys/kernel/mm/ksm/pages_sharing
echo always > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
内存大页应该设置比如default_hugepagesz=512M hugepagesz=512M hugepages=300

15 libvirtd配置调优

修改计算节点/path/to/venv/share/kolla-ansible/ansible/roles/nova-cell/templates/libvirtd.conf.j2,

添加max_client_requests=20 和 admin_max_client_requests=20

16 masakari.conf 配置

开启实例高可用,在globals.yaml中

enable_hacluster: "yes"
enable_masakari: "yes"

vim /etc/kolla/config/masakari.conf

[instance_failure]
process_all_instances = true

17 一些错误

nil

更多推荐