↓↓↓↓↓↓↓↓视频已上线 B 站↓↓↓↓↓↓↓↓
<h2 id="1">1.创建数据库并授权</h2>
# 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';
复制代码
<h2 id="2">2.获得 admin 凭证执行管理员命令并创建服务证书</h2>
# . /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
复制代码
<h2 id="3">3.创建块存储设备 API 接口</h2>
#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
复制代码
<h2 id="4">4.Controller 节点安装块存储组件并配置</h2>
[root@controller ~]# 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:000000@controller/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
复制代码
<h2 id="5">5.初始化块设备服务的数据库</h2>
# su -s /bin/sh -c "cinder-manage db sync" cinder
复制代码
<h2 id="6">6.配置计算节点以使用块设备存储</h2>
编辑文件 /etc/nova/nova.conf 并添加如下到其中:
# [root@controller ~]# vi /etc/nova/nova.conf
在[cinder]下添加
os_region_name = RegionOne
复制代码
<h2 id="7">7.重启服务并设置开机启动</h2>
重启计算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
复制代码
<h2 id="8">8.Compute 节点安装并配置一个存储节点,此处用 Compute 节点代替</h2>
1.安装并配置
1.安装支持的工具包 LVM:
[root@compute ~]# yum -y install lvm2
启动LVM的metadata服务并且设置该服务随系统启动:
# systemctl start lvm2-lvmetad.service
# systemctl enable lvm2-lvmetad.service
复制代码
2.创建 LVM 物理卷 /dev/sdb:
首先查看是否存在 sdb
首先执行如下命令
创建分区:
[root@compute ~]# fdisk /dev/sdb
复制代码
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:000000@controller/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
复制代码
<h2 id="9">9.验证操作</h2>
# . /root/admin-openrc
列出服务组件以验证是否每个进程都成功启动:
#cinder service-list
复制代码
创建卷
# cinder create --display-name v1 1
# cinder list
复制代码
评论