↓↓↓↓↓↓↓↓视频已上线B站↓↓↓↓↓↓↓↓
》》》》》》传送门
1.创建数据库并授权
2.获得admin凭证执行管理员命令并创建服务证书
3.创建块存储设备API接口
4.Controller节点安装块存储组件并配置
5.初始化块设备服务的数据库
6.配置计算节点以使用块设备存储
7.重启服务并设置开机启动
8.Compute节点安装并配置一个存储节点,此处用Compute节点代替
9.验证操作
1.创建数据库并授权
# mysql -uroot -p000000
> create database cinder;
> grant all privileges on cinder.* to 'cinder'@'localhost' identified by '000000';
> grant all privileges on cinder.* to 'cinder'@'%' identified by '000000';
2.获得admin凭证执行管理员命令并创建服务证书
# . /root/admin-openrc
# openstack user create --domain default --password 000000 cinder
# openstack role add --project service --user cinder admin
创建服务实体
#openstack service create --name cinder --description "OpenStack Block Storage" volume
#openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
3.创建块存储设备API接口
#openstack endpoint create --region RegionOne volume public http://controller:8776/v1/%\(tenant_id\)s
#openstack endpoint create --region RegionOne volume internal http://controller:8776/v1/%\(tenant_id\)s
#openstack endpoint create --region RegionOne volume admin http://controller:8776/v1/%\(tenant_id\)s
#openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(tenant_id\)s
#openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(tenant_id\)s
#openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(tenant_id\)s
4.Controller节点安装块存储组件并配置
[[email protected] ~]# yum -y install openstack-cinder
编辑 /etc/cinder/cinder.conf
#vi /etc/cinder/cinder.conf
在 “[DEFAULT]” 下添加
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 192.168.100.10
在[database]下添加
connection = mysql+pymysql://cinder:[email protected]/cinder
在[oslo_messaging_rabbit]部分,配置 “RabbitMQ” 消息队列访问:
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 000000
在[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 = 000000
在 [oslo_concurrency] 部分,配置锁路径:
lock_path = /var/lib/cinder/tmp
5.初始化块设备服务的数据库
# su -s /bin/sh -c "cinder-manage db sync" cinder
6.配置计算节点以使用块设备存储
编辑文件 /etc/nova/nova.conf 并添加如下到其中:
# [[email protected] ~]# vi /etc/nova/nova.conf
在[cinder]下添加
os_region_name = RegionOne
7.重启服务并设置开机启动
重启计算API 服务:
# systemctl restart openstack-nova-api.service
启动块设备存储服务,并将其配置为开机自启:
#systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
#systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
8.Compute节点安装并配置一个存储节点,此处用Compute节点代替
1.安装并配置
1.安装支持的工具包LVM:
[[email protected] ~]# yum -y install lvm2
启动LVM的metadata服务并且设置该服务随系统启动:
# systemctl start lvm2-lvmetad.service
# systemctl enable lvm2-lvmetad.service
2.创建LVM 物理卷 /dev/sdb:
首先查看是否存在sdb
# lsblk
首先执行如下命令
创建分区:
[[email protected] ~]# fdisk /dev/sdb
# pvcreate /dev/sdb1
3.创建 LVM 卷组 cinder-volumes:
# vgcreate cinder-volumes /dev/sdb1
3.编辑/etc/lvm/lvm.conf
文件,并修改
首先查看哪些分区使用了 LVM格式
# lsblk
# vi /etc/lvm/lvm.conf
在``devices``部分,添加一个过滤器,接受使用lvm的设备:
filter = [ "a/sdb/", "r/.*/"]
2.安装并配置组件(Compute节点)
1.安装软件包
# yum -y install openstack-cinder targetcli python-keystone
2.编辑 /etc/cinder/cinder.conf
vi /etc/cinder/cinder.conf
在[DEFAULT]下添加
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 192.168.100.20 #这里的IP地址是存储节点的ip
enabled_backends = lvm
glance_api_servers = http://controller:9292
在[database]下添加
connection = mysql+pymysql://cinder:[email protected]/cinder
在[oslo_messaging_rabbit]”部分,配置 “RabbitMQ” 消息队列访问:
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 000000
在[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 = 000000
添加[lvm]项
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
在 [oslo_concurrency] 部分,配置锁路径:
lock_path = /var/lib/cinder/tmp
3.启动块存储卷服务及其依赖的服务,并将其配置为随系统启动
# systemctl start openstack-cinder-volume.service target.service
# systemctl enable openstack-cinder-volume.service target.service
9.验证操作
# . /root/admin-openrc
列出服务组件以验证是否每个进程都成功启动:
#cinder service-list
创建卷
# cinder create --display-name v1 1
# cinder list
原文地址:https://www.cnblogs.com/zhijian1574/p/11956850.html
时间: 2024-11-10 00:03:01