OpenStack系列之Cinder使用NFS作为后端存储

1.Cinder使用NFS作为后端存储

搭建Cinder服务详细细节参考次文章https://www.xionghaier.cn/archives/564.html

此处不再做演示

1.1控制节点安装Cinder服务

此处安装步骤省略

[root@controller ~]# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:openstack@118.190.201.11
auth_strategy = keystone
iscsi_ip_address = 118.190.201.11
[BACKEND]
[BRCD_FABRIC_EXAMPLE]
[CISCO_FABRIC_EXAMPLE]
[COORDINATION]
[FC-ZONE-MANAGER]
[KEYMGR]
[cors]
[cors.subdomain]
[database]
connection = mysql+pymysql://cinder:cinder@118.190.201.11/cinder
[keystone_authtoken]
auth_uri = http://118.190.201.11:5000
auth_url = http://118.190.201.11:35357
memcached_servers = 118.190.201.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[matchmaker_redis]
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[ssl]
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm

1.2计算节点安装Cinder服务

[root@compute1 ~]# yum install openstack-cinder targetcli python-keystone -y

1.3安装NFS服务

[root@compute1 ~]# yum install -y nfs-utils rpcbind

1.4创建挂载目录

[root@compute1 ~]# mkdir -p /data/nfs
#共享目录
[root@compute1 ~]# cat /etc/exports
/data/nfs *(rw,no_root_squash,)
#启动服务
[root@compute1 ~]# systemctl start rpcbind
[root@compute1 ~]# systemctl start nfs

1.5Cider计算节点配置文件内容

[root@compute1 ~]# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:openstack@118.190.201.11
auth_strategy = keystone
iscsi_ip_address = 118.190.201.31
enabled_backends = lvm
glance_api_servers = http://118.190.201.11:9292
[BACKEND]
[BRCD_FABRIC_EXAMPLE]
[CISCO_FABRIC_EXAMPLE]
[COORDINATION]
[FC-ZONE-MANAGER]
[KEYMGR]
[cors]
[cors.subdomain]
[database]
connection = mysql+pymysql://cinder:cinder@118.190.201.11/cinder
[keystone_authtoken]
auth_uri = http://118.190.201.11:5000
auth_url = http://118.190.201.11:35357
memcached_servers = 118.190.201.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[matchmaker_redis]
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[ssl]

在/etc/cinder/cinder.conf下

添加[nfs]配置文件

[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config = /etc/cinder/nfs_shares
nfs_mount_point_base = $state_path/mnt  #state_path=/var/lib/cinder

注释说明:

#nfs配置思路
[root@compute1 drivers]# cd /usr/lib/python2.7/site-packages/cinder/volume/drivers/
[root@compute1 drivers]# ls nfs*
nfs.py nfs.pyc nfs.pyo

创建共享文件

vim /etc/cinder/nfs_shares
118.190.201.31:/data/nfs
#修改权限
chown root:cinder /etc/cinder/nfs_shares
chmod 640 /etc/cinder/nfs_shares

修改cinder配置文件

把enabled_backends = lvm修改为enabled_backends = nfs

1.6启动服务

systemctl enable openstack-cinder-volume
systemctl start openstack-cinder-volume

1.7创建存储类型

因为之前有LVM现在有NFS,它不知道要用那个所有需要创建

[root@controller ~]# cinder type-create NFS
[root@controller ~]# cinder type-create ISCSI
#在控制节点的[lvm]下添加
volume_backend_name = ISCSI-Storage
#重新启动
systemctl restart openstack-cinder-volume
#计算节点在[nfs]下添加
volume_backend_name = NFS-Storage
#重启
systemctl restart openstack-cinder-volume

1.8设置卷类型

[root@controller ~]# cinder type-key NFS set volume_backend_name=ISCSI-Storage
[root@controller ~]# cinder type-key NFS set volume_backend_name=NFS-Storage
1
如无特殊说明,文章均为本站原创,转载请注明出处

该文章由 发布

这货来去如风,什么鬼都没留下!!!