一.配置控制节点的nfs服务--nfs服务端
1. 在控制节点192.168.15.180上配置nfs服务
# yum install nfs-utils portmap
# yum -y install nfs-utils rpcbind
创建nfs服务的目录:
#mkdir /root/nfs_dir
改配置:
[root@controller-rdo nfs_dir(keystone_admin)]# cat /etc/exports
/var/nfs *(rw,sync,no_root_squash)
# exportfs -r
# service rpcbind start
#service nfs start
[root@controller-rdo nfs_dir(keystone_admin)]# showmount -e 192.168.15.180
Export list for 192.168.15.180:
/root/nfs_dir 192.168.15.*
在计算节点测试:
关闭180的防火墙:
关闭命令: service iptables stop
永久关闭防火墙:chkconfig iptables off
[root@controller-rdo nfs]# exportfs -r
[root@controller-rdo nfs]# service rpcbind restart
Redirecting to /bin/systemctl restart rpcbind.service
[root@controller-rdo nfs]# service nfs restart
Redirecting to /bin/systemctl restart nfs.service
OK,在182上挂载nfs成功:
[root@compute01-rdo ~]# mount -t nfs 192.168.15.180:/var/nfs ./nfs
[root@compute01-rdo ~]#
# mount |grep nfs
192.168.15.180:/var/nfs on /root/nfs type nfs4 (rw,relatime,vers=4.0,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.15.182,local_lock=none,addr=192.168.15.180)
二.计算节点后端配置为nfs存储--计算节点cinder.conf配置
Cinder.conf中的配置:
[DEFAULT]
enabled_backends=nfs
[nfs]
volume_driver=cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config = /etc/cinder/nfs_shares
nfs_mount_point_base = /var/nfs/
volume_backend_name = NFS1
然后挂载配置文件:
[root@compute01-rdo cinder]# cat /etc/cinder/nfs_shares
192.168.15.180:/var/nfs
重启cinder-volume:
创建卷:
所创建的文件: