openstack(2)

目录

块存储服务

安装并配置控制节点

安装并配置一个存储节点

验证操作

封装镜像

上传镜像


块存储服务

安装并配置控制节点

创建数据库

[root@controller ~]# mysql -u root -pshg12345
MariaDB [(none)]> CREATE DATABASE cinder;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
    ->   IDENTIFIED BY 'cinder';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
    ->   IDENTIFIED BY 'cinder';

获取admin凭证

创建服务证书

创建一个 cinder 用户 添加 admin 角色到 cinder 用户上

[root@controller ~]# openstack user create --domain default --password cinder cinder
[root@controller ~]# openstack role add --project service --user cinder admin

创建 cinder 和 cinderv2 服务实体

[root@controller ~]# openstack service create --name cinder \
>   --description "OpenStack Block Storage" volume
[root@controller ~]# openstack service create --name cinderv2 \
>   --description "OpenStack Block Storage" volumev2

创建块设备存储服务的 API 入口点

[root@controller ~]# openstack endpoint create --region RegionOne \
>   volume public http://controller:8776/v1/%\(tenant_id\)s
[root@controller ~]# openstack endpoint create --region RegionOne \
>   volume internal http://controller:8776/v1/%\(tenant_id\)s
[root@controller ~]# openstack endpoint create --region RegionOne \
>   volume admin http://controller:8776/v1/%\(tenant_id\)s
[root@controller ~]# openstack endpoint create --region RegionOne \
>   volumev2 public http://controller:8776/v2/%\(tenant_id\)s
[root@controller ~]# openstack endpoint create --region RegionOne \
>   volumev2 internal http://controller:8776/v2/%\(tenant_id\)s
[root@controller ~]# openstack endpoint create --region RegionOne \
>   volumev2 admin http://controller:8776/v2/%\(tenant_id\)s

安全并配置组件

[root@controller ~]# yum install openstack-cinder
[root@controller ~]# vim /etc/cinder/cinder.conf

配置数据库访问

[database]
connection = mysql+pymysql://cinder:cinder@controller/cinder

配置 "RabbitMQ" 消息队列访问

[DEFAULT]
rpc_backend = rabbit
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = openstack

配置认证服务访问

[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder

配置``my_ip`` 来使用控制节点的管理接口的IP 地址

[DEFAULT]
my_ip = 192.168.81.11

配置锁路径

[oslo_concurrency]
lock_path = /var/lib/cinder/tmp

初始化块设备服务的数据库

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

配置计算节点以使用块设备存储

[root@controller ~]# vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
[root@controller ~]# systemctl restart openstack-nova-api.service
[root@controller ~]# systemctl enable --now openstack-cinder-api.service openstack-cinder-scheduler.service

安装并配置一个存储节点

新建虚机block1,拷贝仓库,无需更改网卡,软件包更新,新增硬盘sdb

创建LVM 物理卷 /dev/sdb 创建 LVM 卷组 cinder-volumes

[root@block1 ~]# yum install lvm2
[root@block1 ~]# systemctl enable --now lvm2-lvmetad.service
[root@block1 ~]# pvcreate /dev/sdb
[root@block1 ~]# vgcreate cinder-volumes /dev/sdb

安全并配置组件

[root@block1 ~]# yum install openstack-cinder targetcli python-keystone
[root@block1 ~]# vim /etc/cinder/cinder.conf

配置数据库访问

[root@block1 ~]# vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:cinder@controller/cinder

配置 "RabbitMQ" 消息队列访问

[DEFAULT]
rpc_backend = rabbit

[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = openstack

配置认证服务访问

[DEFAULT]
auth_strategy = keystone

[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder

配置 my_ip 选项

[DEFAULT]
my_ip = 192.168.81.13

配置LVM后端以LVM驱动结束,卷组``cinder-volumes`` ,iSCSI 协议和正确的 iSCSI服务

[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm

启用 LVM 后端 配置镜像服务 API 的位置

[DEFAULT]
enabled_backends = lvm
glance_api_servers = http://controller:9292

配置锁路径

[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[root@block1 ~]# systemctl enable --now openstack-cinder-volume.service target.service

验证操作

[root@controller ~]# cinder service-list

dashboard查看

创建云硬盘

管理连接,连接vm2

封装镜像

新建虚机server,下载图形化

安装镜像

[root@server ~]# virt-manager 

[root@server ~]# ssh 192.168.122.251

先配置仓库,server通过apache作为仓库源

安装ACPI服务

[root@localhost ~]# yum install acpid
[root@localhost ~]# systemctl enable acpid

使用 cloud-init 工具获取公钥

[root@localhost ~]# yum install cloud-init

安装 cloud-utils-growpart 工具以允许对分区进行调整大小的操作

[root@localhost ~]# yum install cloud-utils-growpart

禁用 Zeroconf 路由

[root@localhost ~]# echo "NOZEROCONF=yes" > /etc/sysconfig/network

配置控制台终端

[root@localhost ~]# vi /boot/grub2/grub.cfg
linux16 /boot/vmlinuz-3.10.0-1160.71.1.el7.x86_64 root=UUID=2fca25ac-4fce-41ba-b934-5267529266fb ro console=tty0 console=ttyS0,115200n8

关闭防火墙,selinux,修改网卡配置

[root@localhost ~]# vi /etc/selinux/config
[root@localhost ~]# systemctl disable --now firewalld
[root@localhost ~]# poweroff

安装管理虚拟化镜像的工具

[root@server ~]# yum install -y libguestfs-tools-c-1.38.2-12.el7.x86_64

清理(或删除)MAC地址相关的详细信息

[root@server images]# cd /var/lib/libvirt/images/
[root@server images]# virt-sysprep -d rhel7.6

缩为名为QCOW2镜像

[root@server images]# virt-sparsify --compress rhel7.6.qcow2 base.qcow2

上传镜像

通过apache上传镜像

admin用户

新建镜像

创建云主机类型

demo用户

创建云主机vm3

[rootacontroller -]# openstack console url show vm3

创建云硬盘

[root@vm3 ~]# su -
[root@vm3 ~]# fdisk -l

分区格式化挂载

扩展云硬盘,需先分离硬盘

相关推荐
mqiqe5 天前
云计算Openstack 虚拟机调度策略
云计算·openstack
小安运维日记10 天前
Linux云计算 |【第五阶段】CLOUD-DAY2
linux·运维·云计算·openstack
南宫乘风17 天前
OpenStack将运行的系统导出 QCOW2 镜像并导入阿里云
阿里云·云计算·openstack
学习向前冲19 天前
开源OpenStack
openstack
suum1 个月前
openstack-swift.18421165
openstack
极客先躯1 个月前
开源的云平台有哪些?
kubernetes·开源·openstack·cloudstack·云平台·docker swarm·opennebula
mqiqe1 个月前
云计算Openstack Horizon
云计算·openstack·perl
zkyqss1 个月前
OpenStack Yoga版安装笔记(十六)Openstack网络理解
笔记·openstack
mqiqe1 个月前
云计算Openstack Neutron
云计算·openstack·perl
mqiqe1 个月前
云计算Openstack Keystone
数据库·云计算·openstack