日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux 后端存储,配置NFS网络存储作为cinder的后端存储

發布時間:2024/10/5 linux 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux 后端存储,配置NFS网络存储作为cinder的后端存储 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

安裝cinder和nfs

yum install -y openstack-cinder

yum install cifs-utils

在controller節點配置nfs

[[email?protected] ~]# mkdir -p /data/nfs #創建一個共享掛載資源的目錄

[[email?protected] ~]# cat /etc/exports

/data/nfs *(rw,sync,root_squash) #NFS服務程序的配置文件為/etc/exports sync 同時將數據寫入到內存與硬盤中,保證不丟失數據 rw 讀寫 no_root_squash 當NFS客戶端以root管理員訪問時,映射為NFS服務器的root管理員

啟動和啟用NFS服務程序。由于在使用NFS服務進行文件共享之前,需要使用RPC(Remote Procedure Call,遠程過程調用)服務將NFS服務器的IP地址和端口號等信息發送給客戶端。因此,在啟動NFS服務之前,還需要順帶重啟并啟用rpcbind服務程序,并將這兩個服務一并加入開機啟動項中

[[email?protected] ~]# systemctl resatrt rpcbind

[[email?protected] ~]# systemctl enable rpcbind

[[email?protected] ~]# systemctl start nfs-server

[[email?protected] ~]# systemctl enable nfs-server

使用showmount命令查詢NFS服務器的遠程共享信息

[[email?protected] ~]# showmount -e 192.168.100.10

Export list for 192.168.100.10:

/data/nfs *

測試掛載

[[email?protected] ~]# mount 192.168.100.10:/data/nfs /mnt/

192.168.100.10:/data/nfs nfs4 197G 19G 169G 10% /mnt

#掛載成功

[[email?protected] ~]# umount /mnt/

[[email?protected] ~]# df -Th

Filesystem Type Size Used Avail Use% Mounted on

/dev/mapper/centos-root ext4 2.9T 1.8G 2.8T 1% /

devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev

tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm

tmpfs tmpfs 7.8G 17M 7.8G 1% /run

tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup

/dev/md126p2 xfs 495M 129M 367M 27% /boot

tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0

配置nfs作為cinder后端存儲

[[email?protected] ~]# vi /etc/cinder/cinder.conf

[DEFAULT]

volume_driver = cinder.volume.drivers.nfs.NfsDriver

nfs_shares_config = /etc/cinder/nfs.conf

去創建/etc/cinder/nfs.conf這個文件

[[email?protected] ~]# vi /etc/cinder/nfs.conf

192.168.100.10:/data/nfs

重啟服務nfs后端存儲自動掛載

[[email?protected] ~]# systemctl restart openstack-cinder-api.service

[[email?protected] ~]# systemctl restart openstack-cinder-volume.service

[[email?protected] ~]# systemctl restart openstack-cinder-scheduler.service

[[email?protected] ~]# df -Th

Filesystem Type Size Used Avail Use% Mounted on

/dev/mapper/centos-root ext4 197G 19G 169G 10% /

devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev

tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm

tmpfs tmpfs 7.8G 8.7M 7.8G 1% /run

tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup

/dev/sda1 xfs 494M 126M 368M 26% /boot

/dev/loop0 iso9660 4.1G 4.1G 0 100% /opt/centos

/dev/loop1 iso9660 2.7G 2.7G 0 100% /opt/iaas

tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0

192.168.100.10:/data/nfs nfs4 197G 19G 169G 10% /var/lib/cinder/mnt/cfee723fff086429eb82121076ac5407

創建volume測試

[[email?protected] ~]# cinder create --display-name ‘volume‘ 1

+--------------------------------+--------------------------------------+

| Property | Value |

+--------------------------------+--------------------------------------+

| attachments | [] |

| availability_zone | nova |

| bootable | false |

| consistencygroup_id | None |

| created_at | 2019-04-24T15:36:11.000000 |

| description | None |

| encrypted | False |

| id | d259218e-45ec-4d31-a97c-b7e006cf957e |

| metadata | {} |

| migration_status | None |

| multiattach | False |

| name | volume |

| os-vol-host-attr:host | None |

| os-vol-mig-status-attr:migstat | None |

| os-vol-mig-status-attr:name_id | None |

| os-vol-tenant-attr:tenant_id | 89b7ee9ffd73479b9446a3bf296bacbb |

| replication_status | disabled |

| size | 1 |

| snapshot_id | None |

| source_volid | None |

| status | creating |

| updated_at | None |

| user_id | 3469ea43ec3345d2a29606c4566cd43a |

| volume_type | None |

+--------------------------------+--------------------------------------+

[[email?protected] ~]# openstack volume list

+--------------------------------------+--------------+--------+------+-------------+

| ID | Display Name | Status | Size | Attached to |

+--------------------------------------+--------------+--------+------+-------------+

| d259218e-45ec-4d31-a97c-b7e006cf957e | volume | error | 1 | |

+--------------------------------------+--------------+--------+------+-------------+

#volume狀態erros 去查看日志

[[email?protected] cinder]# tail -f volume.log

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/cinder/utils.py", line 148, in execute

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher return processutils.execute(*cmd, **kwargs)

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py", line 389, in execute

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher cmd=sanitized_cmd)

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher ProcessExecutionError: Unexpected error while running command.

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher Command: truncate -s 1G /var/lib/cinder/mnt/cfee723fff086429eb82121076ac5407/volume-d259218e-45ec-4d31-a97c-b7e006cf957e

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher Exit code: 1

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher Stdout: u‘‘

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher Stderr: ‘truncate: cannot open \xe2\x80\x98/var/lib/cinder/mnt/cfee723fff086429eb82121076ac5407/volume-d259218e-45ec-4d31-a97c-b7e006cf957e\xe2\x80\x99 for writing: Permission denied\n‘

2019-04-24 11:36:13.359 461 ERROR oslo_messaging.rpc.dispatcher

失敗原因沒有權限

[[email?protected] ~]# ls /data/nfs/ -ld

drwxr-xr-x. 2 root root 4096 Apr 24 10:19 /data/nfs/

[[email?protected] ~]# chmod o+w /data/nfs/

[[email?protected] ~]# ls /data/nfs/ -ld

drwxr-xrwx. 2 root root 4096 Apr 24 10:19 /data/nfs/

重新創建volume測試

[[email?protected] ~]# cinder create --display-name ‘volume‘ 1

+--------------------------------+--------------------------------------+

| Property | Value |

+--------------------------------+--------------------------------------+

| attachments | [] |

| availability_zone | nova |

| bootable | false |

| consistencygroup_id | None |

| created_at | 2019-04-24T15:41:56.000000 |

| description | None |

| encrypted | False |

| id | 16b0c969-c71f-47e0-b898-1c2098e41338 |

| metadata | {} |

| migration_status | None |

| multiattach | False |

| name | volume |

| os-vol-host-attr:host | None |

| os-vol-mig-status-attr:migstat | None |

| os-vol-mig-status-attr:name_id | None |

| os-vol-tenant-attr:tenant_id | 89b7ee9ffd73479b9446a3bf296bacbb |

| replication_status | disabled |

| size | 1 |

| snapshot_id | None |

| source_volid | None |

| status | creating |

| updated_at | None |

| user_id | 3469ea43ec3345d2a29606c4566cd43a |

| volume_type | None |

+--------------------------------+--------------------------------------+

[[email?protected] ~]# cinder list

+--------------------------------------+-----------+--------+------+-------------+----------+-------------+

| ID | Status | Name | Size | Volume Type | Bootable | Attached to |

+--------------------------------------+-----------+--------+------+-------------+----------+-------------+

| 16b0c969-c71f-47e0-b898-1c2098e41338 | available | volume | 1 | - | false | |

+--------------------------------------+-----------+--------+------+-------------+----------+-------------+

volume狀態可用

[[email?protected] ~]# ls /data/nfs/

volume-16b0c969-c71f-47e0-b898-1c2098e41338

#volume被寫入nfs作為后端存儲

總結

以上是生活随笔為你收集整理的linux 后端存储,配置NFS网络存储作为cinder的后端存储的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。