OpenStack共享檔案系統manila服務的安裝與使用
阿新 • • 發佈:2022-05-06
OpenStack共享服務介紹
OpenStack共享檔案系統服務(manila)提供對共享或分散式檔案系統的協調訪問。供應和使用共享的方法由共享檔案系統驅動程式或多後端配置情況下的驅動程式確定。有多種驅動程式也支援NFS、CIFS、HDFS、GlusterFS、CEPHFS、MAPRFS和其他協議。
共享檔案系統API和排程程式服務通常在控制器節點上執行。根據使用的驅動程式,共享服務可以在控制器、計算節點或儲存節點上執行。
節點 | IP |
---|---|
controller | 172.30.17.14 |
compute | 172.30.17.5 |
Manila服務安裝
使用命令編輯/etc/openstack/openrc.sh配置檔案,新增Manila環境變數引數,SHARE_DISK為儲存分割槽名稱
##--------------------Manila Config----------------##
##Password for Mysql Manila user. exmaple:000000
MANILA_DBPASS=000000
##Password for Keystore Manila user. exmaple:000000
MANILA_PASS=000000
#The NODE Object Disk for Manila. example:md126p5.
SHARE_DISK=vdb3
使用CRT等遠端連線工具,連線至172.30.17.14控制節點,執行iaas-install-manila-controller.sh安裝指令碼
[root@controller ~]# iaas-install-manila-controller.sh
使用CRT等遠端連線工具,連線至172.30.17.5計算節點,執行iaas-install-manila-compute.sh安裝指令碼
[root@compute ~]# iaas-install-manila-compute.sh
使用Manila命令建立default_share_type共享型別
[root@controller ~]# source /etc/keystone/admin-openrc.sh [root@controller ~]# manila type-create default_share_type False +----------------------+--------------------------------------+ | Property | Value | +----------------------+--------------------------------------+ | required_extra_specs | driver_handles_share_servers : False | | Name | default_share_type | | Visibility | public | | is_default | YES | | ID | 0fec7bca-f1a1-4e92-8d4b-aaf02147571a | | optional_extra_specs | | | Description | None | +----------------------+--------------------------------------+
使用Manila命令查詢型別列表資訊
[root@controller ~]# manila type-list
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
| ID | Name | visibility | is_default | required_extra_specs | optional_extra_specs | Description |
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
| 0fec7bca-f1a1-4e92-8d4b-aaf02147571a | default_share_type | public | YES | driver_handles_share_servers : False | | None |
+--------------------------------------+--------------------+------------+------------+--------------------------------------+----------------------+-------------+
建立共享檔案目錄
使用Manila命令建立目錄大小為2G的共享目錄share-test
[root@controller ~]# manila create NFS 2 --name share-test
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| status | creating |
| share_type_name | default_share_type |
| description | None |
| availability_zone | None |
| share_network_id | None |
| share_server_id | None |
| share_group_id | None |
| host | |
| revert_to_snapshot_support | False |
| access_rules_status | active |
| snapshot_id | None |
| create_share_from_snapshot_support | False |
| is_public | False |
| task_state | None |
| snapshot_support | False |
| id | a4b2a4f1-421f-4de3-8fca-d2ee8a5f4bb9 |
| size | 2 |
| source_share_group_snapshot_member_id | None |
| user_id | 89f8027475294689ae6c0183fa35bf5a |
| name | share-test |
| share_type | 0fec7bca-f1a1-4e92-8d4b-aaf02147571a |
| has_replicas | False |
| replication_type | None |
| created_at | 2022-05-06T11:24:02.000000 |
| share_proto | NFS |
| mount_snapshot_support | False |
| project_id | 0b6f2d0be1d342e09edc31dc841db7a5 |
| metadata | {} |
+---------------------------------------+--------------------------------------+
用Manila命令查詢所建立的共享目錄列表資訊
[root@controller ~]# manila list
+--------------------------------------+------------+------+-------------+-----------+-----------+--------------------+--------------------------------+-------------------+
| ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone |
+--------------------------------------+------------+------+-------------+-----------+-----------+--------------------+--------------------------------+-------------------+
| a4b2a4f1-421f-4de3-8fca-d2ee8a5f4bb9 | share-test | 2 | NFS | available | False | default_share_type | controller@lvm#lvm-single-pool | nova |
+--------------------------------------+------------+------+-------------+-----------+-----------+--------------------+--------------------------------+-------------------+
掛載共享目錄
使用Manila命令開放share-test目錄對OpenStack管理網段使用許可權
[root@controller ~]# manila access-allow share-test ip 10.24.195.0/24 --access-level rw
+--------------+--------------------------------------+
| Property | Value |
+--------------+--------------------------------------+
| access_key | None |
| share_id | a4b2a4f1-421f-4de3-8fca-d2ee8a5f4bb9 |
| created_at | 2022-05-06T11:27:19.000000 |
| updated_at | None |
| access_type | ip |
| access_to | 10.24.195.0/24 |
| access_level | rw |
| state | queued_to_apply |
| id | 9813f7f2-d15f-46cf-ad2d-062ce6ce3264 |
| metadata | {} |
+--------------+--------------------------------------+
檢視share-test目錄共享目錄許可權及開放網段
[root@controller ~]# manila access-list share-test
+--------------------------------------+-------------+----------------+--------------+--------+------------+----------------------------+------------+
| id | access_type | access_to | access_level | state | access_key | created_at | updated_at |
+--------------------------------------+-------------+----------------+--------------+--------+------------+----------------------------+------------+
| 9813f7f2-d15f-46cf-ad2d-062ce6ce3264 | ip | 10.24.195.0/24 | rw | active | None | 2022-05-06T11:27:19.000000 | None |
+--------------------------------------+-------------+----------------+--------------+--------+------------+----------------------------+------------+
檢視share-test共享檔案目錄的訪問路徑
[root@controller ~]# manila show share-test | grep path | cut -d'|' -f3
path = 127.0.0.1:/var/lib/manila/mnt/share-55f94a46-9ac0-4b7e-8981-d83ac6fce8d7
在OpenStack控制節點將share-test共享目錄掛載至/mnt目錄下
[root@controller ~]# mount -t nfs 172.30.17.5:/var/lib/manila/mnt/share-c3f5a9fc-a8e7-40a6-a43b-56cfd1738724 /mnt/
在控制節點查詢掛載資訊,可以看到share01共享路徑掛載至/mnt目錄下
[root@controller ~]# df -th
檔案系統 型別 容量 已用 可用 已用% 掛載點
devtmpfs devtmpfs 5.8G 0 5.8G 0% /dev
tmpfs tmpfs 5.8G 68K 5.8G 1% /dev/shm
tmpfs tmpfs 5.8G 592M 5.3G 10% /run
tmpfs tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup
/dev/vda1 xfs 50G 8.1G 42G 17% /
tmpfs tmpfs 1.2G 0 1.2G 0% /run/user/0
172.30.17.5:/var/lib/manila/mnt/share-c3f5a9fc-a8e7-40a6-a43b-56cfd1738724 nfs4 2.0G 6.0M 1.8G 1% /mnt