OpenStack-Y版安装部署

OpenStack-Y版安装部署

目录
  • OpenStack-Y版安装部署
    • 1、环境准备
      • 1.1 环境简介
      • 1.2 配置hosts解析(所有节点)
      • 1.3 配置时间同步
      • 1.4 安装openstack客户端(控制节点执行)
      • 1.5 安装部署MariaDB(控制节点执行)
      • 1.6 安装部署RabbitMQ(控制节点执行)
      • 1.7 安装部署Memcache(控制节点执行)
    • 2、部署配置keystone(控制节点执行)
      • 2.1 创建数据库与用户
      • 2.2 安装配置keystone
      • 2.3 修改数据库配置
      • 2.4 修改apache配置
      • 2.5 配置OpenStack认证环境变量
    • 3、部署配置glance镜像(控制节点执行)
      • 3.1 创建数据库与用户
      • 3.2 创建服务项目及glance浏览用户
      • 3.3 创建镜像服务API端点
      • 3.4 安装glance镜像服务
      • 3.5 填充数据库
      • 3.6上传镜像
    • 4、部署配置placement元数据(控制节点执行)
      • 4.1 创建数据库与用户
      • 4.2 创建服务用户
      • 4.3 创建Placement API服务端点
      • 4.4 安装placement服务
      • 4.5 填充数据库
    • 5、部署配置nova计算服务
      • 5.1 创建数据库与用户给予nova使用(控制节点执行)
      • 5.2 创建nova用户(控制节点执行)
      • 5.3 创建计算API服务端点(控制节点执行)
      • 5.4 配置nova(控制节点执行)
      • 5.5 填充数据库 (控制节点执行)
      • 5.6 重启相关nova服务加载配置文件 (控制节点执行)
      • 5.7 安装nova-compute服务(计算节点执行)
      • 5.8 配置主机发现(控制节点执行)
    • 6、配置基于OVS的Neutron网络服务
      • 6.1 创建数据库与用给予neutron使用(控制节点执行)
      • 6.2 创建neutron用户(控制节点执行)
      • 6.3 创建neutron的api端点(控制节点执行)
      • 6.4 配置内核转发(全部节点执行)
      • 6.5 安装ovs服务
      • 6.6 配置neutron.conf文件,用于提供neutron主体服务
      • 6.7 配置ml2_conf.ini文件,用户提供二层网络插件服务(控制节点执行)
      • 6.8 配置openvswitch_agent.ini文件,提供ovs代理服务
      • 6.9 配置l3_agent.ini文件,提供三层网络服务(控制节点执行)
      • 6.10 配置dhcp_agent文件,提供dhcp动态网络服务(控制节点执行)
      • 6.11 配置metadata_agent.ini文件(控制节点执行)
      • 6.12 配置nova文件,主要识别neutron配置,从而能调用网络
      • 6.13 填充数据库(控制节点执行)
      • 6.14 配置外部网络桥接(全部节点执行)
      • 6.15 重启neutron相关服务生效配置
      • 6.16 校验neutron
    • 7、配置dashboard仪表盘服务
      • 7.1 安装服务
      • 7.2 配置local_settings.py文件
      • 7.3 重新加载web服务器配置
      • 7.4 浏览器访问
    • 8、部署配置cinder卷存储
      • 8.1 创建数据库与用户给予cinder组件使用(控制节点配置执行)
      • 8.2 创建cinder用户(控制节点配置执行)
      • 8.3 创建cinder服务API端点(控制节点配置执行)
      • 8.4 安装cinder相关服务(控制节点配置执行)
      • 8.5 填充数据库(控制节点配置执行)
      • 8.6 配置nova服务可调用cinder服务(控制节点配置执行)
      • 8.7 重启相关服务生效配置(控制节点配置执行)
      • 8.8 安装支持的实用程序包(计算节点执行)
      • 8.9 创建LVM物理卷(计算节点执行)
      • 8.10 修改lvm.conf文件(计算节点执行)
      • 8.11 安装cinder软件包(计算节点执行)
      • 8.12 指定卷路径(计算节点执行)
      • 8.13 重新启动块存储卷服务,包括其依赖项(计算节点执行)
      • 8.14 校验cinder(控制节点执行)
    • 9、运维实战一(命令行)(控制节点执行)
      • 9.1 创建路由器
      • 9.2 创建Vxlan网络
      • 9.3 创建Flat网络
      • 9.4 开放安全组
      • 9.5 查看镜像
      • 9.6 创建云主机
      • 9.7 创建卷类型
      • 9.8 创建卷
    • 10、运维实战二(web界面)
      • 10.1 登录dashbroad
      • 10.2 查看之前我们启动的虚拟机实例
      • 10.3 管理实例
      • 10.4 创建虚拟机实例
      • 10.5 目前集群已上传的镜像
      • 10.6 密匙对
      • 10.7 创建主机组,可关联实例
      • 10.8 卷
      • 10.9 网络

1、环境准备

1.1 环境简介

主机名网卡一网卡二磁盘一磁盘二CPU内存操作系统虚拟化工具说明
controller192.168.200.30/100G/2C6GUbuntu 22.04VMware15控制节点
compute-01192.168.200.31/100G20G2C4GUbuntu 22.04VMware15计算节点
compute-02192.168.200.32/100G20G2C4GUbuntu 22.04VMware15计算节点

1.2 配置hosts解析(所有节点)

root@controller:~# cat >> /etc/hosts << EOF
192.168.200.30 controller
192.168.200.31 compute-01
192.168.200.32 compute-02
EOF

1.3 配置时间同步

所有节点执行

# 开启可配置服务
root@controller:~# timedatectl set-ntp true

# 调整时区为上海
root@controller:~# timedatectl set-timezone Asia/Shanghai

# 将系统时间同步到硬件时间
root@controller:~# hwclock --systohc

控制节点执行

# 安装服务
root@controller:~# apt install -y chrony

# 配置文件
root@controller:~# cat >> /etc/chrony/chrony.conf << EOF
server controller iburst maxsources 2
allow all
local stratum 10
EOF

# 重启服务
root@controller:~# systemctl restart chronyd

计算节点执行

# 安装服务
root@compute-01:~# apt install -y chrony

# 配置文件
root@compute-01:~# vim /etc/chrony/chrony.conf 
root@compute-01:~# sed -n "21p" /etc/chrony/chrony.conf 
pool controller            iburst maxsources 4

# 重启服务
root@compute-01:~# systemctl restart chronyd

1.4 安装openstack客户端(控制节点执行)

root@controller:~# apt install -y python3-openstackclient

1.5 安装部署MariaDB(控制节点执行)

# 安装 MariaDB
root@controller:~# apt install -y mariadb-server python3-pymysql

# 配置mariadb配置文件
root@controller:~# cat > /etc/mysql/mariadb.conf.d/99-openstack.cnf << EOF
[mysqld]
bind-address = 0.0.0.0

default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
EOF
# 重启根据配置文件启动
root@controller:~# systemctl restart mysql
# 设置开机自启动
root@controller:~# systemctl enable mysql

# 初始化配置数据库
root@controller:~# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):    # 输入数据库密码:回车 ;可以在没有适当授权的情况下登录到MariaDB
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n    # root用户,当前已收到保护:n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] n    # 设置root用户密码:n
 ... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y     # 删除匿名用户:y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n    # 不允许远程root登录:n
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y    # 删除测试数据库:y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y    # 重新加载数据库:y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

1.6 安装部署RabbitMQ(控制节点执行)

# 安装RabbitMQ
root@controller:~# apt install -y rabbitmq-server

# 创建openstack用户,账号/密码:openstack/000000
root@controller:~# rabbitmqctl add_user openstack 000000

# 允许openstack用户进行配置、写入和读取访问
root@controller:~# rabbitmqctl set_permissions openstack ".*" ".*" ".*"

1.7 安装部署Memcache(控制节点执行)

# 安装Memcache
root@controller:~# apt install -y memcached python3-memcache

# 配置监听地址
root@controller:~# vim /etc/memcached.conf 
root@controller:~# sed -n "35p" /etc/memcached.conf 
-l 0.0.0.0

# 重启服务
root@controller:~# systemctl restart memcached 
# 设置开机自启动
root@controller:~# systemctl enable memcached

2、部署配置keystone(控制节点执行)

2.1 创建数据库与用户

# 创建数据库与用户给予keystone使用
MariaDB [(none)]> CREATE DATABASE keystone;

# 创建用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystoneang';

# 配置立即生效
MariaDB [(none)]> flush privileges;

2.2 安装配置keystone

# 安装 keystone
root@controller:~# apt install -y keystone

# 配置keystone文件
# 备份配置文件
root@controller:~# cp /etc/keystone/keystone.conf{,.bak}

# 修改配置
root@controller:~# nano /etc/keystone/keystone.conf
root@controller:~# cat /etc/keystone/keystone.conf
[DEFAULT]
log_dir = /var/log/keystone
[application_credential]
[assignment]
[auth]
[cache]
[catalog]
[cors]
[credential]
[database]
connection = mysql+pymysql://keystone:keystoneang@controller/keystone
[domain_config]
[endpoint_filter]
[endpoint_policy]
[eventlet_server]
[extra_headers]
Distribution = Ubuntu
[federation]
[fernet_receipts]
[fernet_tokens]
[healthcheck]
[identity]
[identity_mapping]
[jwt_tokens]
[ldap]
[memcache]
[oauth1]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[policy]
[profiler]
[receipt]
[resource]
[revoke]
[role]
[saml]
[security_compliance]
[shadow_users]
[token]
provider = fernet
[tokenless_auth]
[totp]
[trust]
[unified_limit]
[wsgi]

2.3 修改数据库配置

# 填充数据库
root@controller:~# su -s /bin/sh -c "keystone-manage db_sync" keystone
# 调用用户和组的密钥库,这些选项是为了允许在另一个操作系统用户/组下运行密钥库

# 用户
root@controller:~# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone

# 组
root@controller:~# keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
# 在Queens发布之前,keystone需要在两个单独的端口上运行,以容纳Identity v2 API,后者通常在端口35357上运行单独的仅限管理员的服务。随着v2 API的删除,keystones可以在所有接口的同一端口上运行5000

root@controller:~# keystone-manage bootstrap --bootstrap-password 000000 --bootstrap-admin-url http://controller:5000/v3/ --bootstrap-internal-url http://controller:5000/v3/ --bootstrap-public-url http://controller:5000/v3/ --bootstrap-region-id RegionOne

2.4 修改apache配置

# 编辑apache2文件并配置ServerName选项以引用控制器节点
root@controller:~# echo "ServerName controller" >> /etc/apache2/apache2.conf 

# 重新启动Apache服务生效配置
root@controller:~# systemctl restart apache2 
# 设置k

2.5 配置OpenStack认证环境变量

# 配置OpenStack认证环境变量
root@controller:~# cat > /etc/keystone/admin-openrc.sh << EOF
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=000000
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
EOF

# 加载环境变量
root@controller:~# source /etc/keystone/admin-openrc.sh

# 配置在个人目录下
root@controller:~# echo "source /etc/keystone/admin-openrc.sh" >> .bashrc

3、部署配置glance镜像(控制节点执行)

3.1 创建数据库与用户

# 创建数据库与用户给予glance使用
MariaDB [(none)]> CREATE DATABASE glance;

# 创建用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glanceang';

# 配置立即生效
MariaDB [(none)]> flush privileges;

3.2 创建服务项目及glance浏览用户

# 创建服务项目
root@controller:~# openstack project create --domain default --description "Service Project" service

# 查看项目列表
root@controller:~# openstack project list
+----------------------------------+---------+
| ID                               | Name    |
+----------------------------------+---------+
| 12d5de899b1f4cecb879a23d94e84af5 | service |
| d511671fdcbc408fbe1978da791caa46 | admin   |
+----------------------------------+---------+

# 验证
root@controller:~# openstack token issue
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field      | Value                                                                                                                                                                                   |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires    | 2023-08-05T12:19:27+0000                                                                                                                                                                |
| id         | gAAAAABkzjA_Y7GHumqarUwhR-cxtIISwuxAgBhE3dfXzhuCStR-bhq8va5pvJE3-XoXox5WmpQlU0V0f9Ym9WXOtrUpV_Cnku_J9uI9bm4lwKY8yDk1Kp2-67edd9AvETyHYhb0DfXu_jRyRhsTlNSaGMZ_wKZXkd_ZV3YxKPtdQOMvlV8dAxo |
| project_id | d511671fdcbc408fbe1978da791caa46                                                                                                                                                        |
| user_id    | 3a66f914c2804018a416255998dda997                                                                                                                                                        |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
# 创建glance浏览用户
root@controller:~# openstack user create --domain default --password glance glance

# 将管理员角色添加到浏览用户和服务项目
root@controller:~# openstack role add --project service --user glance admin

# 创建浏览服务实体
root@controller:~# openstack service create --name glance --description "OpenStack Image" image

3.3 创建镜像服务API端点

# 公共端点
root@controller:~# openstack endpoint create --region RegionOne image public http://controller:9292

# 私有端点
root@controller:~# openstack endpoint create --region RegionOne image internal http://controller:9292

# 管理端点
root@controller:~# openstack endpoint create --region RegionOne image admin http://controller:9292

3.4 安装glance镜像服务

# 安装glance镜像服务
root@controller:~# apt install -y glance

# 配置glance配置文件
# 备份配置文件
root@controller:~# cp /etc/glance/glance-api.conf{,.bak}

# 配置项信息
root@controller:~# nano /etc/glance/glance-api.conf
root@controller:~# cat /etc/glance/glance-api.conf
[DEFAULT]
[barbican]
[barbican_service_user]
[cinder]
[cors]
[database]
connection = mysql+pymysql://glance:glanceang@controller/glance
[file]
[glance.store.http.store]
[glance.store.rbd.store]
[glance.store.s3.store]
[glance.store.swift.store]
[glance.store.vmware_datastore.store]
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[healthcheck]
[image_format]
disk_formats = ami,ari,aki,vhd,vhdx,vmdk,raw,qcow2,vdi,iso,ploop.root-tar
[key_manager]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[paste_deploy]
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]
[vault]
[wsgi]

3.5 填充数据库

# 填充数据库
root@controller:~# su -s /bin/sh -c "glance-manage db_sync" glance

# 重启glance服务生效配置
root@controller:~# systemctl restart glance-api
# 设置开机自启动
root@controller:~# systemctl enable glance-api

3.6上传镜像

# 上传镜像验证
# 下载镜像
root@controller:~# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img

# 上传镜像命令
root@controller:~# glance image-create --name "cirros" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility=public

# 查看镜像运行状态
root@controller:~# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| ca7a8fff-7296-4907-894d-a84825955ad2 | cirros | active |
+--------------------------------------+--------+--------+

4、部署配置placement元数据(控制节点执行)

作用:placement服务跟踪每个供应商的库存和使用情况。例如,在一个计算节点创建一个实例的可消费资源如计算节点的资源提供者的CPU和内存,磁盘从外部共享存储池资源提供商和IP地址从外部IP资源提供者。

4.1 创建数据库与用户

# 创建数据库与用户给予placement使用
MariaDB [(none)]> CREATE DATABASE placement;

# 创建用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'placementang';

# 配置立即生效
MariaDB [(none)]> flush privileges;

4.2 创建服务用户

# 创建服务用户
root@controller:~# openstack user create --domain default --password placement placement

# 将Placement用户添加到具有管理员角色的服务项目中
root@controller:~# openstack role add --project service --user placement admin

# 在服务目录中创建Placement API条目
root@controller:~# openstack service create --name placement --description "Placement API" placement

4.3 创建Placement API服务端点

# 公共端点
root@controller:~# openstack endpoint create --region RegionOne placement public http://controller:8778

# 私有端点
root@controller:~# openstack endpoint create --region RegionOne placement internal http://controller:8778

# 管理端点
root@controller:~# openstack endpoint create --region RegionOne placement admin http://controller:8778

4.4 安装placement服务

#  安装placement服务
root@controller:~# apt install -y placement-api

# 配置placement文件
# 备份配置文件
root@controller:~# cp /etc/placement/placement.conf{,.bak}

# 配置文件
root@controller:~# nano /etc/placement/placement.conf
root@controller:~# cat > /etc/placement/placement.conf
[DEFAULT]
[api]
auth_strategy = keystone
[cors]
[keystone_authtoken]
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = placement
[oslo_middleware]
[oslo_policy]
[placement]
[placement_database]
connection = mysql+pymysql://placement:placementang@controller/placement
[profiler]

4.5 填充数据库

# 填充数据库
root@controller:~# su -s /bin/sh -c "placement-manage db sync" placement

# 重启apache加载placement配置
root@controller:~# systemctl restart apache2

# 验证
root@controller:~# placement-status upgrade check
+-------------------------------------------+
| Upgrade Check Results                     |
+-------------------------------------------+
| Check: Missing Root Provider IDs          |
| Result: Success                           |
| Details: None                             |
+-------------------------------------------+
| Check: Incomplete Consumers               |
| Result: Success                           |
| Details: None                             |
+-------------------------------------------+
| Check: Policy File JSON to YAML Migration |
| Result: Success                           |
| Details: None                             |
+-------------------------------------------+

5、部署配置nova计算服务

5.1 创建数据库与用户给予nova使用(控制节点执行)

# 存放nova交互等数据
MariaDB [(none)]> CREATE DATABASE nova_api;

# 存放nova资源等数据
MariaDB [(none)]> CREATE DATABASE nova;

# 存放nova等元数据
MariaDB [(none)]> CREATE DATABASE nova_cell0;

# 创建管理nova_api库的用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'novaang';

# 创建管理nova库的用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'novaang';

# 创建管理nova_cell0库的用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'novaang';

# 配置立即生效
MariaDB [(none)]> flush privileges;

5.2 创建nova用户(控制节点执行)

# 创建nova用户
root@controller:~# openstack user create --domain default --password nova nova

# 将管理员角色添加到nova用户
root@controller:~# openstack role add --project service --user nova admin

# 创建nova服务实体
root@controller:~# openstack service create --name nova --description "OpenStack Compute" compute

5.3 创建计算API服务端点(控制节点执行)

# 创建公共端点
root@controller:~# openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1

# 创建私有端点
root@controller:~# openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
  
# 创建管理端点
root@controller:~# openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1

5.4 配置nova(控制节点执行)

# 安装服务
root@controller:~# apt install -y nova-api nova-conductor nova-novncproxy nova-scheduler

# 配置nova文件
# 备份配置文件
root@controller:~# cp /etc/nova/nova.conf{,.bak}

# 配置文件
root@controller:~# nano /etc/nova/nova.conf
root@controller:~# cat /etc/nova/nova.conf
[DEFAULT]
log_dir = /var/log/nova
lock_path = /var/lock/nova
state_path = /var/lib/nova
compute_driver=libvirt.LibvirtDriver
transport_url = rabbit://openstack:000000@controller:5672/
my_ip = 192.168.200.30
[api]
auth_strategy = keystone
[api_database]
connection = mysql+pymysql://nova:novaang@controller/nova_api
[barbican]
[barbican_service_user]
[cache]
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[cyborg]
[database]
connection = mysql+pymysql://nova:novaang@controller/nova
[devices]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_servers = http://controller:9292
[guestfs]
[healthcheck]
[hyperv]
[image_cache]
[ironic]
[key_manager]
[keystone]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000/
auth_url = http://controller:5000/
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = nova
[libvirt]
[metrics]
[mks]
[neutron]
[notifications]
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[pci]
[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = placement
[powervm]
[privsep]
[profiler]
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[upgrade_levels]
[vault]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip
[workarounds]
[wsgi]
[zvm]
[cells]
enable = False
[os_region_name]
openstack =

5.5 填充数据库 (控制节点执行)

# 填充nova_api数据库
root@controller:~# su -s /bin/sh -c "nova-manage api_db sync" nova

# 注册cell0数据库
root@controller:~# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova

# 创建cell1单元格
root@controller:~# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova

# 填充nova数据库
root@controller:~# su -s /bin/sh -c "nova-manage db sync" nova
# 验证nova、cell0和cell1是否正确注册
root@controller:~# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
+-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+
|  Name |                 UUID                 |              Transport URL               |               Database Connection               | Disabled |
+-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 |                  none:/                  | mysql+pymysql://nova:****@controller/nova_cell0 |  False   |
| cell1 | 2df08f99-731c-4b26-89c0-5510637dfb35 | rabbit://openstack:****@controller:5672/ |    mysql+pymysql://nova:****@controller/nova    |  False   |
+-------+--------------------------------------+------------------------------------------+-------------------------------------------------+----------+

5.6 重启相关nova服务加载配置文件 (控制节点执行)

# 处理api服务
root@controller:~# systemctl restart nova-api

# 处理资源调度服务
root@controller:~# systemctl restart nova-scheduler

# 处理数据库服务
root@controller:~# systemctl restart nova-conductor

# 处理vnc远程窗口服务
root@controller:~# systemctl restart nova-novncproxy

5.7 安装nova-compute服务(计算节点执行)

# 安装nova-compute服务
root@compute-01:~# apt install -y nova-compute

# 配置nova文件
# 备份配置文件
root@compute-01:~# cp /etc/nova/nova.conf{,.bak}

# 完整配置
root@compute-01:~# nano /etc/nova/nova.conf
root@compute-01:~# cat /etc/nova/nova.conf
[DEFAULT]
log_dir = /var/log/nova
lock_path = /var/lock/nova
state_path = /var/lib/nova
transport_url = rabbit://openstack:000000@controller
my_ip = 192.168.200.31     # 注意各计算节点IP不同
[api]
auth_strategy = keystone
[api_database]
[barbican]
[barbican_service_user]
[cache]
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[cyborg]
[database]
[devices]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_servers = http://controller:9292
[guestfs]
[healthcheck]
[hyperv]
[image_cache]
[ironic]
[key_manager]
[keystone]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000/
auth_url = http://controller:5000/
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = nova
[libvirt]
[metrics]
[mks]
[neutron]
[notifications]
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[pci]
[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = placement
[powervm]
[privsep]
[profiler]
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[upgrade_levels]
[vault]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled = true
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://192.168.200.30:6080/vnc_auto.html
[workarounds]
[wsgi]
[zvm]
[cells]
enable = False
[os_region_name]
openstack =
# 检测计算节点是否支持虚拟机的硬件加速
root@compute-01:~# egrep -c '(vmx|svm)' /proc/cpuinfo

# 如果结果返回 “0” ,那么需要配置如下
root@compute-01:~# cat > /etc/nova/nova-compute.conf << EOF
[DEFAULT]
compute_driver=libvirt.LibvirtDriver
[libvirt]
virt_type = qemu
EOF

# 重启服务生效nova配置
root@compute-01:~# systemctl restart nova-compute
# 设置开机自启动
root@compute-01:~# systemctl enable nova-compute

5.8 配置主机发现(控制节点执行)

# 查看有那些可用的计算节点
root@controller:~# openstack compute service list --service nova-compute
+--------------------------------------+--------------+------------+------+---------+-------+----------------------------+
| ID                                   | Binary       | Host       | Zone | Status  | State | Updated At                 |
+--------------------------------------+--------------+------------+------+---------+-------+----------------------------+
| 522981d5-961a-4d94-9405-735abdffa5bc | nova-compute | compute-01 | nova | enabled | up    | 2023-08-05T12:25:42.000000 |
| aae9f5bb-4f82-435d-bf2e-0fdf302760c6 | nova-compute | compute-02 | nova | enabled | up    | 2023-08-05T12:25:43.000000 |
+--------------------------------------+--------------+------------+------+---------+-------+----------------------------+

# 发现计算主机
root@controller:~# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

# 配置每5分钟主机发现一次
root@controller:~# vim /etc/nova/nova.conf
root@controller:~# sed -n "76,77p" /etc/nova/nova.conf
[scheduler]
discover_hosts_in_cells_interval = 300

# 重启生效配置
root@controller:~# systemctl restart nova-api

# 校验nova服务
root@controller:~# openstack compute service list
+--------------------------------------+----------------+------------+----------+---------+-------+----------------------------+
| ID                                   | Binary         | Host       | Zone     | Status  | State | Updated At                 |
+--------------------------------------+----------------+------------+----------+---------+-------+----------------------------+
| c2208b45-6118-4b40-a556-e83c64be489f | nova-conductor | controller | internal | enabled | up    | 2023-08-05T12:27:38.000000 |
| 34d37e63-f4b3-4439-b7b9-6c908788e4a0 | nova-scheduler | controller | internal | enabled | up    | 2023-08-05T12:27:34.000000 |
| 522981d5-961a-4d94-9405-735abdffa5bc | nova-compute   | compute-01 | nova     | enabled | up    | 2023-08-05T12:27:42.000000 |
| aae9f5bb-4f82-435d-bf2e-0fdf302760c6 | nova-compute   | compute-02 | nova     | enabled | up    | 2023-08-05T12:27:34.000000 |
+--------------------------------------+----------------+------------+----------+---------+-------+----------------------------+

6、配置基于OVS的Neutron网络服务

6.1 创建数据库与用给予neutron使用(控制节点执行)

# 创建数据库与用给予neutron使用
MariaDB [(none)]> CREATE DATABASE neutron;

# 创建用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutronang';

# 配置立即生效
MariaDB [(none)]> flush privileges;

6.2 创建neutron用户(控制节点执行)

# 创建neutron用户
root@controller:~# openstack user create --domain default --password neutron neutron

# 向neutron用户添加管理员角色
root@controller:~# openstack role add --project service --user neutron admin

# 创建neutron实体
root@controller:~# openstack service create --name neutron --description "OpenStack Networking" network

6.3 创建neutron的api端点(控制节点执行)

# 创建公共端点
root@controller:~# openstack endpoint create --region RegionOne network public http://controller:9696

# 创建私有端点
root@controller:~# openstack endpoint create --region RegionOne network internal http://controller:9696

# 创建管理端点
root@controller:~# openstack endpoint create --region RegionOne network admin http://controller:9696

6.4 配置内核转发(全部节点执行)

root@controller:~# cat >> /etc/sysctl.conf << EOF
# 用于控制系统是否开启对数据包源地址的校验,关闭
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
# 开启二层转发设备
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
EOF

# 加载模块,作用:桥接流量转发到iptables链
root@controller:~# modprobe br_netfilter

# 生效内核配置
root@controller:~# sysctl -p

6.5 安装ovs服务

# 控制节点执行
root@controller:~# apt install -y neutron-server neutron-plugin-ml2  neutron-l3-agent neutron-dhcp-agent  neutron-metadata-agent neutron-openvswitch-agent
# 计算节点执行
root@compute-01:~# apt install -y neutron-openvswitch-agent

6.6 配置neutron.conf文件,用于提供neutron主体服务

# 控制节点执行
# 备份配置文件
root@controller:~# cp /etc/neutron/neutron.conf{,.bak}

# 配置文件
root@controller:~# nano /etc/neutron/neutron.conf
root@controller:~# cat /etc/neutron/neutron.conf
[DEFAULT]
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = true
auth_strategy = keystone
state_path = /var/lib/neutron
dhcp_agent_notification = true
allow_overlapping_ips = true
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
transport_url = rabbit://openstack:000000@controller
[agent]
root_helper = "sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf"
[cache]
[cors]
[database]
connection = mysql+pymysql://neutron:neutronang@controller/neutron
[healthcheck]
[ironic]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron
[nova]
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = nova
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[placement]
[privsep]
[quotas]
[ssl]
# 计算节点执行
# 备份配置文件
root@compute-01:~# cp /etc/neutron/neutron.conf{,.bak}

# 配置文件
root@compute-01:~# nano /etc/neutron/neutron.conf
root@compute-01:~# cat /etc/neutron/neutron.conf
[DEFAULT]
core_plugin = ml2
service_plugins = router
auth_strategy = keystone
state_path = /var/lib/neutron
allow_overlapping_ips = true
transport_url = rabbit://openstack:000000@controller
[agent]
root_helper = "sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf"
[cache]
[cors]
[database]
[healthcheck]
[ironic]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron
[nova]
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[placement]
[privsep]
[quotas]
[ssl]

6.7 配置ml2_conf.ini文件,用户提供二层网络插件服务(控制节点执行)

# 备份配置文件
root@controller:~# cp /etc/neutron/plugins/ml2/ml2_conf.ini{,.bak}

# 配置文件
root@controller:~# nano /etc/neutron/plugins/ml2/ml2_conf.ini
root@controller:~# cat /etc/neutron/plugins/ml2/ml2_conf.ini
[DEFAULT]
[ml2]
type_drivers = flat,vlan,vxlan,gre
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = physnet1
[ml2_type_geneve]
[ml2_type_gre]
[ml2_type_vlan]
[ml2_type_vxlan]
vni_ranges = 1:1000
[ovs_driver]
[securitygroup]
enable_ipset = true
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
[sriov_driver]

6.8 配置openvswitch_agent.ini文件,提供ovs代理服务

# 控制节点执行
# 备份文件
root@controller:~# cp /etc/neutron/plugins/ml2/openvswitch_agent.ini{,.bak}

# 配置文件
root@controller:~# nano /etc/neutron/plugins/ml2/openvswitch_agent.ini
root@controller:~# cat /etc/neutron/plugins/ml2/openvswitch_agent.ini
[DEFAULT]
[agent]
l2_population = True
tunnel_types = vxlan
prevent_arp_spoofing = True
[dhcp]
[network_log]
[ovs]
local_ip = 192.168.200.30
bridge_mappings = physnet1:br-ens33
[securitygroup]
# 计算节点执行
# 备份文件
root@compute-01:~# cp /etc/neutron/plugins/ml2/openvswitch_agent.ini{,.bak}

# 配置文件
root@compute-01:~# nano /etc/neutron/plugins/ml2/openvswitch_agent.ini
root@compute-01:~# cat /etc/neutron/plugins/ml2/openvswitch_agent.ini
[DEFAULT]
[agent]
l2_population = True
tunnel_types = vxlan
prevent_arp_spoofing = True
[dhcp]
[network_log]
[ovs]
local_ip = 192.168.200.31     # 注意各计算节点IP不同
bridge_mappings = physnet1:br-ens33
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver

6.9 配置l3_agent.ini文件,提供三层网络服务(控制节点执行)

# 备份文件
root@controller:~# cp /etc/neutron/l3_agent.ini{,.bak}

# 完整配置文件
root@controller:~# nano /etc/neutron/l3_agent.ini
root@controller:~# cat /etc/neutron/l3_agent.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
external_network_bridge =
[agent]
[network_log]
[ovs]

6.10 配置dhcp_agent文件,提供dhcp动态网络服务(控制节点执行)

# 备份文件
root@controller:~# cp /etc/neutron/dhcp_agent.ini{,.bak}

# 配置文件
root@controller:~# nano /etc/neutron/dhcp_agent.ini
root@controller:~# cat /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
[agent]
[ovs]

6.11 配置metadata_agent.ini文件(控制节点执行)

提供元数据服务;元数据是用来支持如指示存储位置、历史数据、资源查找、文件记录等功能。元数据算是一种电子式目录,为了达到编制目录的目的,必须在描述并收藏数据的内容或特色,进而达成协助数据检索的目的

# 备份文件
root@controller:~# cp /etc/neutron/metadata_agent.ini{,.bak}

# 配置文件
root@controller:~# nano /etc/neutron/metadata_agent.ini
root@controller:~# cat /etc/neutron/metadata_agent.ini
[DEFAULT]
nova_metadata_host = controller
metadata_proxy_shared_secret = ws
[agent]
[cache]

6.12 配置nova文件,主要识别neutron配置,从而能调用网络

# 控制节点执行
root@controller:~# nano /etc/nova/nova.conf
root@controller:~# cat /etc/nova/nova.conf
......

[default]
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSlnterfaceDriver
[neutron]
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron
service_metadata_proxy = true
metadata_proxy_shared_secret = ws

......
# 计算节点执行
root@controller:~# nano /etc/nova/nova.conf
root@controller:~# cat /etc/nova/nova.conf
[DEFAULT]
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSlnterfaceDriver
vif_plugging_is_fatal = true
vif_pligging_timeout = 300

......

[neutron]
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron

......

# 重启nova服务识别网络配置
root@compute-01:~# systemctl restart nova-compute
# 设置开机自启动
root@compute-01:~# systemctl enable nova-compute

6.13 填充数据库(控制节点执行)

# 填充数据库
root@controller:~# su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron

# 重启nova-api服务生效neutron配置
root@controller:~# systemctl restart nova-api

6.14 配置外部网络桥接(全部节点执行)

# 新建一个外部网络桥接
root@controller:~# ovs-vsctl add-br br-ens33

# 将外部网络桥接映射到网卡,这里绑定第二张网卡,属于业务网卡
root@controller:~# ovs-vsctl add-port br-ens33 ens33

6.15 重启neutron相关服务生效配置

# 全部节点执行
# 提供ovs服务
root@controller:~# systemctl restart neutron-openvswitch-agent
# 控制节点执行
# 提供neutron服务
root@controller:~# systemctl restart neutron-server

# 提供地址动态服务
root@controller:~# systemctl restart neutron-dhcp-agent

# 提供元数据服务
root@controller:~# systemctl restart neutron-metadata-agent

# 提供三层网络服务
root@controller:~# systemctl restart neutron-l3-agent

6.16 校验neutron

# 校验命令
root@controller:~# openstack network agent list
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| ID                                   | Agent Type         | Host       | Availability Zone | Alive | State | Binary                    |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| 76dc6322-2673-450a-a8e7-28a3edbabf3c | DHCP agent         | controller | nova              | :-)   | UP    | neutron-dhcp-agent        |
| 88e7e617-137b-417d-94a2-b831fb063839 | Open vSwitch agent | controller | None              | :-)   | UP    | neutron-openvswitch-agent |
| b43cd575-2b08-4113-858d-a307ace57217 | Open vSwitch agent | compute-01 | None              | :-)   | UP    | neutron-openvswitch-agent |
| da28b732-d59e-4a10-848a-e6d1b1dcedbe | Metadata agent     | controller | None              | :-)   | UP    | neutron-metadata-agent    |
| dea1439f-4b0d-4519-9ea4-c5f4220588b2 | L3 agent           | controller | nova              | :-)   | UP    | neutron-l3-agent          |
| fb0ed798-0729-41ed-8b49-e8a88f68bb27 | Open vSwitch agent | compute-02 | None              | :-)   | UP    | neutron-openvswitch-agent |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+

7、配置dashboard仪表盘服务

7.1 安装服务

root@controller:~# apt install -y openstack-dashboard

7.2 配置local_settings.py文件

# 备份脚本文件
root@controller:~# cp /etc/openstack-dashboard/local_settings.py{,.bak}

# 配置文件
root@controller:~# nano /etc/openstack-dashboard/local_settings.py
sed -n "96,101p;112p;126,127p;131,142p;411p" /etc/openstack-dashboard/local_settings.py
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': 'controller:11211',
    },
}

# 配置memcached会话存储服务
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'

# 配置仪表板以在控制器节点上使用OpenStack服务
OPENSTACK_HOST = "controller"

# 启用Identity API版本3
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST

# 启用对域的支持
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True

# 配置API版本
OPENSTACK_API_VERSIONS = {
    "identity": 3,
    "image": 2,
    "volume": 3,
}

# 将Default配置为通过仪表板创建的用户的默认域
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default"

# 将用户配置为通过仪表板创建的用户的默认角色
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"

# 启用卷备份
OPENSTACK_CINDER_FEATURES = {
    'enable_backup': True,
}

# 配置时区
TIME_ZONE = "Asia/Shanghai"

# 在Dashboard configuration部分中,允许主机访问Dashboard
ALLOWED_HOSTS = ["*"]

7.3 重新加载web服务器配置

root@controller:~# systemctl restart apache2

7.4 浏览器访问

(账号:admin;密码:000000;域:default)
浏览器访问:http://192.168.200.30/horizon

图片.png-56.2kB

8、部署配置cinder卷存储

8.1 创建数据库与用户给予cinder组件使用(控制节点配置执行)

# 创建cinder数据库
MariaDB [(none)]> CREATE DATABASE cinder;

# 创建cinder用户
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinderang';

# 配置立即生效
MariaDB [(none)]> flush privileges;

8.2 创建cinder用户(控制节点配置执行)

# 创建cinder用户
root@controller:~# openstack user create --domain default --password cinder cinder

# 添加cinder用户到admin角色
root@controller:~# openstack role add --project service --user cinder admin

# 创建cinder服务实体
root@controller:~# openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3

8.3 创建cinder服务API端点(控制节点配置执行)

# 创建公共端点
root@controller:~# openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s

# 创建私有端点
root@controller:~# openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s

# 创建管理端点
root@controller:~# openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s

8.4 安装cinder相关服务(控制节点配置执行)

root@controller:~# apt install -y cinder-api cinder-scheduler

# 配置cinder.conf文件
# 备份文件
root@controller:~# cp /etc/cinder/cinder.conf{,.bak}

# 完整配置
root@controller:~# nano /etc/cinder/cinder.conf
root@controller:~# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:000000@controller
auth_strategy = keystone
my_ip = 192.168.200.30
[database]
connection = mysql+pymysql://cinder:cinderang@controller/cinder
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp

8.5 填充数据库(控制节点配置执行)

root@controller:~# su -s /bin/sh -c "cinder-manage db sync" cinder

8.6 配置nova服务可调用cinder服务(控制节点配置执行)

root@controller:~# nano /etc/nova/nova.conf
root@controller:~# cat /etc/nova/nova.conf

......

[cinder]
os_region_name = RegionOne

......

8.7 重启相关服务生效配置(控制节点配置执行)

# 重启nova服务生效cinder服务
root@controller:~# systemctl restart nova-api

# 重新启动块存储服务
root@controller:~# systemctl restart cinder-scheduler

# 平滑重启apache服务识别cinder页面
root@controller:~# systemctl reload apache2

8.8 安装支持的实用程序包(计算节点执行)

root@compute-01:~# apt install -y lvm2 thin-provisioning-tools

8.9 创建LVM物理卷(计算节点执行)

# 组成逻辑卷
root@compute-01:~# pvcreate /dev/sdb

# 查看逻辑卷
root@compute-01:~# pvs
  PV         VG Fmt  Attr PSize  PFree 
  /dev/sdb      lvm2 ---  20.00g 20.00g
# 创建卷组 cinder-volumes
root@compute-01:~# vgcreate cinder-volumes /dev/sdb

# 查看卷组
root@compute-01:~# vgs
  VG             #PV #LV #SN Attr   VSize   VFree  
  cinder-volumes   1   0   0 wz--n- <20.00g <20.00g

8.10 修改lvm.conf文件(计算节点执行)

作用:添加接受/dev/sdb设备并拒绝所有其他设备的筛选器

root@compute-01:~# nano /etc/lvm/lvm.conf
root@compute-01:~# sed -n "49,50p" /etc/lvm/lvm.conf
devices {
	filter = [ "a/sdb/", "r/.*/"]

8.11 安装cinder软件包(计算节点执行)

root@compute-01:~# apt install -y cinder-volume tgt

# 配置cinder.conf配置文件
# 备份配置文件
root@compute-01:~# cp /etc/cinder/cinder.conf{,.bak}

# 完整配置文件
root@compute-01:~# nano /etc/cinder/cinder.conf
root@compute-01:~# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:000000@controller
auth_strategy = keystone
my_ip = 192.168.200.31      # 注意各计算节点IP不同
enabled_backends = lvm
glance_api_servers = http://controller:9292
[database]
connection = mysql+pymysql://cinder:cinderang@controller/cinder
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
target_protocol = iscsi
target_helper = tgtadm
volume_backend_name = lvm
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp

8.12 指定卷路径(计算节点执行)

root@compute-01:~# cat > /etc/tgt/conf.d/tgt.conf << EOF
include /var/lib/cinder/volumes/*
EOF

8.13 重新启动块存储卷服务,包括其依赖项(计算节点执行)

# 重启tgt
root@compute-01:~# systemctl restart tgt

# 设置开机自启动
root@compute-01:~# systemctl enable tgt
# 重启cinder-volume
root@compute-01:~# systemctl restart cinder-volume

# 设置开机自启动
root@compute-01:~# systemctl enable cinder-volume

8.14 校验cinder(控制节点执行)

# 校验命令
root@controller:~# openstack volume service list
+------------------+----------------+------+---------+-------+----------------------------+
| Binary           | Host           | Zone | Status  | State | Updated At                 |
+------------------+----------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller     | nova | enabled | up    | 2023-08-07T13:13:48.000000 |
| cinder-volume    | compute-02@lvm | nova | enabled | up    | 2023-08-07T13:13:54.000000 |
| cinder-volume    | compute-01@lvm | nova | enabled | up    | 2023-08-07T13:13:46.000000 |
+------------------+----------------+------+---------+-------+----------------------------+

9、运维实战一(命令行)(控制节点执行)

9.1 创建路由器

# 创建路由器
root@controller:~# openstack router create Ext-Router

# 查看路由列表
root@controller:~# openstack router list

9.2 创建Vxlan网络

# 创建vxlan网络
root@controller:~# openstack network create --provider-network-type vxlan Intnal

# 查看网络列表
root@controller:~# openstack network list
# 创建vxlan子网
root@controller:~# openstack subnet create Intsubnal --network Intnal --subnet-range 192.168.100.0/24 --gateway 192.168.100.1 --dns-nameserver 114.114.114.114

# 查看子网列表
root@controller:~# openstack subnet list
# 将内部网络添加到路由器(路由:Ext-Router;网络:Intsubnal)
root@controller:~# openstack router add subnet Ext-Router Intsubnal

9.3 创建Flat网络

# 创建flat网络
root@controller:~# openstack network create --provider-physical-network physnet1 --provider-network-type flat  --external Extnal

# 创建flat子网
root@controller:~# openstack subnet create Extsubnal --network Extnal --subnet-range 10.0.0.0/24  --allocation-pool start=10.0.0.30,end=10.0.0.200 --gateway 10.0.0.254 --dns-nameserver 114.114.114.114 --no-dhcp

root@controller:~# openstack subnet create Extsubnal --network Extnal --subnet-range 192.168.200.0/24  --allocation-pool start=192.168.200.50,end=192.168.200.200 --gateway 192.168.200.254 --dns-nameserver 192.168.200.2 --no-dhcp
# 设置路由器网关接口(路由:Ext-Router;网络:Extnal)
root@controller:~# openstack router set Ext-Router --external-gateway Extnal

9.4 开放安全组

# 开放icmp协议
root@controller:~# openstack security group rule create --proto icmp default

# 开放22端口
root@controller:~# openstack security group rule create --proto tcp --dst-port 22:22 default

# 查看安全组规则
root@controller:~# openstack security group rule list

9.5 查看镜像

# 查看镜像运行状态
root@controller:~# openstack image list
+--------------------------------------+----------+--------+
| ID                                   | Name     | Status |
+--------------------------------------+----------+--------+
| ca7a8fff-7296-4907-894d-a84825955ad2 | cirros   | active |
+--------------------------------------+----------+--------+

9.6 创建云主机

# 创建ssh-key密钥
root@controller:~# ssh-keygen -N ""

# 创建密钥
root@controller:~# openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
# 创建云主机类型
root@controller:~# openstack flavor create --vcpus 1 --ram 512 --disk 1 C1-512MB-1G

# 创建云主机
openstack server create --flavor C1-512MB-1G --image cirros --security-group default --nic net-id=$(vxlan网络id) --key-name mykey vm01

root@controller:~# openstack server create --flavor C1-512MB-1G --image cirros --security-group default --nic net-id=a371c907-a326-4869-ab35-8ea53d838a98 --key-name mykey vm01

# 查看云主机列表
root@controller:~# openstack server list --all
+--------------------------------------+------+--------+-----------------------+--------+-------------+
| ID                                   | Name | Status | Networks              | Image  | Flavor      |
+--------------------------------------+------+--------+-----------------------+--------+-------------+
| 77705e1a-8dfb-4b07-886b-c773b4b9be4a | vm01 | ACTIVE | Intnal=192.168.100.81 | cirros | C1-512MB-1G |
+--------------------------------------+------+--------+-----------------------+--------+-------------+
# 分配浮动地址
root@controller:~# openstack floating ip create Extnal
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2023-08-07T14:30:48Z                 |
| description         |                                      |
| dns_domain          | None                                 |
| dns_name            | None                                 |
| fixed_ip_address    | None                                 |
| floating_ip_address | 192.168.200.59                       |
| floating_network_id | dc9becce-901a-49f2-936b-f5e80f7759e8 |
| id                  | c74c9289-c6b5-47c2-bce4-f5700533fb9f |
| name                | 192.168.200.59                       |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | d511671fdcbc408fbe1978da791caa46     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2023-08-07T14:30:48Z                 |
+---------------------+--------------------------------------+

# 将分配的浮动IP绑定云主机
openstack server add floating ip vm01 $(分配出的地址)
root@controller:~# openstack server add floating ip vm01 192.168.200.59

# VNC查看实例
root@controller:~# openstack console url show vm01
+----------+-----------------------------------------------------------------------------------------------+
| Field    | Value                                                                                         |
+----------+-----------------------------------------------------------------------------------------------+
| protocol | vnc                                                                                           |
| type     | novnc                                                                                         |
| url      | http://192.168.200.30:6080/vnc_auto.html?path=%3Ftoken%3D40bbebd5-7698-4b4b-a5a8-47026fa87acd |
+----------+-----------------------------------------------------------------------------------------------+

9.7 创建卷类型

# 创建卷类型
root@controller:~# openstack volume type create lvm

# 卷类型添加元数据
root@controller:~# cinder --os-username admin --os-tenant-name admin type-key lvm set volume_backend_name=lvm

# 查看卷类型
root@controller:~# openstack volume type list
+--------------------------------------+-------------+-----------+
| ID                                   | Name        | Is Public |
+--------------------------------------+-------------+-----------+
| 5ffdbebe-4f37-4690-8b40-36c6e6c63233 | lvm         | True      |
| c5b71526-643d-4e9c-b0b7-3cdf8d1e926b | __DEFAULT__ | True      |
+--------------------------------------+-------------+-----------+

9.8 创建卷

# 指定lvm卷类型创建卷
root@controller:~# openstack volume create lvm01 --type lvm --size 1
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2023-08-07T14:44:05.121851           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | 59278ea9-2fc0-4b5e-bdec-7a8663769d3b |
| migration_status    | None                                 |
| multiattach         | False                                |
| name                | lvm01                                |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 1                                    |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | lvm                                  |
| updated_at          | None                                 |
| user_id             | 3a66f914c2804018a416255998dda997     |
+---------------------+--------------------------------------+
# 将卷绑定云主机
nova volume-attach vm01 卷ID
root@controller:~# nova volume-attach vm01 59278ea9-2fc0-4b5e-bdec-7a8663769d3b
+-----------------------+--------------------------------------+
| Property              | Value                                |
+-----------------------+--------------------------------------+
| delete_on_termination | False                                |
| device                | /dev/vdb                             |
| id                    | 59278ea9-2fc0-4b5e-bdec-7a8663769d3b |
| serverId              | 77705e1a-8dfb-4b07-886b-c773b4b9be4a |
| tag                   | -                                    |
| volumeId              | 59278ea9-2fc0-4b5e-bdec-7a8663769d3b |
+-----------------------+--------------------------------------+

10、运维实战二(web界面)

10.1 登录dashbroad

图片.png-106.6kB

10.2 查看之前我们启动的虚拟机实例

图片.png-96.6kB

10.3 管理实例

图片.png-112.5kB

10.4 创建虚拟机实例

创建实例

图片.png-151.4kB

选择源

图片.png-92kB

图片.png-78.5kB

选择实例类型

图片.png-54.2kB

图片.png-50.8kB

选择网络

图片.png-55.5kB

图片.png-53.4kB

安全组

图片.png-54.4kB

密匙对

图片.png-69.4kB

配置(可自动或者手动配置脚本,磁盘)

图片.png-58.3kB

创建实例

图片.png-61.3kB

查看实例

图片.png-78.4kB

10.5 目前集群已上传的镜像

图片.png-70.7kB

10.6 密匙对

图片.png-81.6kB

10.7 创建主机组,可关联实例

图片.png-100.6kB

10.8 卷

图片.png-76.4kB

图片.png-82.3kB

10.9 网络

网络

图片.png-81kB

路由

图片.png-71.5kB

安全组

图片.png-70.4kB

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/70130.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

JS 解决鼠标悬浮显示弹窗 迅速离开时弹窗显示到其他位置的延迟问题

解决该问题的思路就是&#xff0c;判断当前鼠标的位置是否在某个div上&#xff0c;如果在这个div上则取消显示悬浮弹窗消息。 首先监听鼠标的移动事件 鼠标移动时判断是否在div里面进行移动了 clientX表示鼠标X的位置 client Y表示鼠标Y的位置 拿到要判断的div元素 获取off…

MySQL表的增删查改

目录 一&#xff0c;新增 二&#xff0c;查询 2.1 全列查询 2.2 指定列查询 2.3 查询字段为表达式 2.4 别名 - as 2.5 去重 - distinct 2.6 排序 - order by 2.7 条件查询 - where 2.8 分页查询 - limit 三&#xff0c;修改 - update 四&#xff0c;删除 - delete 一…

学习51单片机怎么开始?

学习的过程不总是先打好基础&#xff0c;然后再盖上层建筑&#xff0c;尤其是实践性的、工程性很强的东西。如果你一定要先全面打好基础&#xff0c;再学习单片机&#xff0c;我觉得你一定学不好&#xff0c;因为你的基础永远打不好&#xff0c;因为基础太庞大了&#xff0c;基…

TOMCAT的多实例部署和动静分离

tomcat的多实例 动静分离 排错小工具&#xff1a; telnet工具&#xff1a;yum -y install telnet telnet工具用于测试端口是否正常 telnet 20.0.0.101 80Tomcat多实例部署&#xff1a; 一台服务器上有多个tomcat的服务 1.安装好 jdk 2.安装 tomcat cd /opt tar zxvf apache-…

c语言——完数的计算

完数即所有因子之和等于其本身值 列入&#xff0c;28124714&#xff0c;28所有的因子为1&#xff0c;2&#xff0c;4&#xff0c;7&#xff0c;14 而这五个因子之和恰好也是28. //完数的计算 /*完数即所有因子之和等于其本身值 列入&#xff0c;28124714&#xff0c;28所有的…

【IMX6ULL驱动开发学习】02.hello驱动程序之cdev注册字符设备驱动程序和设置次设备号

目录 ​编辑 一、register_chrdev 二、解决方法 2.1 alloc_chrdev_region函数&#xff1a;注册一系列字符设备编号 2.2 cdev_init函数&#xff1a;初始化cdev结构体 2.3 cdev_add函数&#xff1a;将字符设备添加到系统中 三、驱动程序 一、register_chrdev major reg…

创建CREATE_STAT_TABLE 统计信息表在达梦和oracle中的使用

达梦 创建CREATE_STAT_TABLE 统计信息表 PROCEDURE CREATE_STAT_TABLE ( STATOWN VARCHAR(128), STATTAB VARCHAR(128), TABLESPACE VARCHAR(128) DEFAULT NULL, GLOBAL_TEMPORARY BOOLEAN DEFAULT FALSE ); 创建普通表的对应系统表的列名字段包括以下&#xff1a; OWNER TABL…

大数据Flink(六十一):Flink流处理程序流程和项目准备

文章目录 Flink流处理程序流程和项目准备 一、Flink流处理程序的一般流程

Fortinet数据中心防火墙及服务ROI超300%!Forrester TEI研究发布

近日&#xff0c;专注网络与安全融合的全球网络安全领导者 Fortinet&#xff08;NASDAQ&#xff1a;FTNT&#xff09;联合全球知名分析机构Forrester发布总体经济影响独立分析报告&#xff0c;详细阐述了在企业数据中心部署 FortiGate 下一代防火墙&#xff08;NGFW&#xff09…

C语言中几种常见数据类型所占字节数

**16位编译器&#xff1a; char/unsigned char &#xff1a;1字节 char &#xff1a;2字节 short int&#xff1a;2字节 int/unsigned int&#xff1a;2字节 long int&#xff1a;4字节 float&#xff1a;4字节 double&#xff1a;8字节* 32位编译器&#xff1a; *char/unsi…

C++ STL vector

目录 一.认识vector 二.vector的使用 1.vector的构造函数 2.vector的迭代器 2.1 begin&#xff08;&#xff09;&#xff0c;end&#xff08;&#xff09; 2.2 rbegin&#xff08;&#xff09;&#xff0c;rend&#xff08;&#xff09; 2.3 迭代器初始化对象 3. vector…

Fairy下载和使用

写在最前&#xff1a;本系列中将会涉及到 Unity&#xff0c;C#&#xff0c;Lua和FairyGUI&#xff08;FGUI&#xff09;。 FairyGUI介绍 官网&#xff1a; FairyGUI 编辑器下载&#xff1a; FairyGUI 截至文档记录最新版&#xff1a; https://res.fairygui.com/FairyGUI-Ed…

现代无人机技术

目录 1.发展 2.应用领域 3.对战争的影响 4.给人类带来的福利 5.给人类带来的坏处 1.发展 无人机的发展可以分为以下几个关键步骤&#xff1a; 1. 早期试验和研究&#xff1a;20世纪初&#xff0c;飞行器的概念开始出现&#xff0c;并进行了一些早期的试飞和实验。这些尝试包…

STM32CubeMX之freeRTOS中断系统

任何中断的优先级都大于任务 优先级是从5-15 而不是0-15 因为前几个已经被freertos所控制了&#xff0c;因为操作系统不是万能的&#xff0c;所以我们需要弄一些中断凌驾在我们操作系统之上&#xff0c;中断中必须使用中断相关的函数&#xff01; 中断不能使用阻塞函数&#…

FinClip 支持小程序维度域名配置;桌面端体验活动进行中

FinClip 的使命是使您&#xff08;业务专家和开发人员&#xff09;能够通过小程序解决关键业务流程挑战&#xff0c;并完成数字化转型的相关操作。不妨让我们看看在本月的产品与市场发布亮点&#xff0c;看看是否有助于您实现目标。 产品方面的相关动向&#x1f447;&#x1f…

初识mysql数据库之引入mysql客户端库

目录 一、下载第三方库 1. 准备工作 1. 使用mysql官网提供的库 2. yum源安装 二、测试第三方库是否可用 三、mysql常用接口介绍 1. 查看官方文档 2. 初始化 3. 关闭mysql 4. 连接mysql 5. 下达sql指令 四、一个简单的C客户端库连接mysql程序 1. 头文件 2. 初始化…

计算机组成原理-笔记-第七章

目录 七、第七章——输入输出系统 1、IO设备与IO控制方式 &#xff08;1&#xff09;控制方式&#xff08;查询&#xff0c;中断&#xff0c;DMA&#xff09; &#xff08;2&#xff09;通道控制 &#xff08;3&#xff09;IO系统 &#xff08;4&#xff09;总结 2、外设…

钕铁硼永磁材料基本概念

目录 一、何为磁性材料二、永磁材料的主要性能三、永磁材料的历史四、永磁材料的分类五、钕铁硼永磁材料5.1 产业链5.2 生产工艺 之前也写过其他行业的一些生产过程和工艺流程&#xff0c;大家有兴趣的可以翻翻以前的文章。 一、何为磁性材料 参加过九年义务教育的同学应该都知…

CSS3 中新增了哪些常见的特性?

聚沙成塔每天进步一点点 ⭐ 专栏简介⭐ 圆角&#xff08;Border Radius&#xff09;⭐ 渐变&#xff08;Gradients&#xff09;⭐ 阴影&#xff08;Box Shadow&#xff09;⭐ 文本阴影&#xff08;Text Shadow&#xff09;⭐ 透明度&#xff08;Opacity&#xff09;⭐ 过渡&…

我的Python教程:使用Pyecharts画柱状图

Pyecharts是一个用于生成 Echarts 图表的 Python 库。Echarts 是一个基于 JavaScript 的数据可视化库&#xff0c;提供了丰富的图表类型和交互功能。通过 Pyecharts&#xff0c;你可以使用 Python 代码生成各种类型的 Echarts 图表&#xff0c;例如折线图、柱状图、饼图、散点图…