본문 바로가기
서버/Cloud

오픈스택 클라우드 서버 구축(Stein)(12)-Block Storage(Cinder) 설정(NFS)

by WYYOON 2023. 2. 2.
728x90
반응형
SMALL

#Storage Node 설정

1) Configure Storage Node.

더보기

[root@storage ~]# yum -y install nfs-utils
[root@storage ~]# vi /etc/idmapd.conf
# line 5: uncomment and change to the own domain name
Domain = srv.world
[root@storage ~]# systemctl start rpcbind
[root@storage ~]# systemctl enable rpcbind
[root@storage ~]# vi /etc/cinder/cinder.conf
# add follows in the [DEFAULT] section
enabled_backends = nfs
# add follows to the end
[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config = /etc/cinder/nfs_shares
nfs_mount_point_base = $state_path/mnt
[root@storage ~]# vi /etc/cinder/nfs_shares
# create new : specify NFS shared directory
nfs.srv.world:/var/lib/nfs-share

 

[root@storage ~]# chmod 640 /etc/cinder/nfs_shares
[root@storage ~]# chgrp cinder /etc/cinder/nfs_shares
[root@storage ~]# systemctl restart openstack-cinder-volume
[root@storage ~]# chown -R cinder. /var/lib/cinder/mnt

#Compute Node 설정

1) Change Nova settings on Compute Node to mount NFS.

더보기

[root@computer ~]# yum -y install nfs-utils
[root@computer ~]# vi /etc/idmapd.conf
# 5번 줄 수정
Domain = srv.world
[root@computer ~]# systemctl start rpcbind
[root@computer ~]# systemctl enable rpcbind
[root@computer ~]# vi /etc/nova/nova.conf
# 마지막 줄 추가
[cinder]
os_region_name = RegionOne
[root@computer ~]# systemctl restart openstack-nova-compute

#Controller Node 설정

1) Login as a common user you'd like to add volumes to own instances.

더보기

[root@controller ~(keystone)]# echo "export OS_VOLUME_API_VERSION=3" >> ~/keystonerc
[root@controller ~(keystone)]# source ~/keystonerc
[root@controller ~(keystone)]# openstack volume create --size 10 disk01
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2019-05-16T08:12:56.000000           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | 20a0d42c-3abf-402a-a1bf-6461c769c04b |
| multiattach         | False                                |
| name                | disk01                               |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 10                                   |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | None                                 |
| updated_at          | None                                 |
| user_id             | b5dd128c2fd744c892ad7d1fb39d21a0     |
+---------------------+--------------------------------------+

[root@controller ~(keystone)]# openstack volume list
+--------------------------------------+--------+-----------+------+-------------+
| ID                                   | Name   | Status    | Size | Attached to |
+--------------------------------------+--------+-----------+------+-------------+
| 20a0d42c-3abf-402a-a1bf-6461c769c04b | disk01 | available |   10 |             |
+--------------------------------------+--------+-----------+------+-------------+

2) Attach the virtual disk to an Instance.

더보기

[root@controller ~(keystone)]# openstack server list
+--------------------------------------+----------+---------+------------------------------------+---------+----------+
| ID                                   | Name     | Status  | Networks                           | Image   | Flavor   |
+--------------------------------------+----------+---------+------------------------------------+---------+----------+
| aced428a-2d16-4679-9798-50e69c7aaf1d | CentOS_7 | SHUTOFF | int_net=192.168.100.59, 10.0.0.240 | CentOS7 | m1.small |
+--------------------------------------+----------+---------+------------------------------------+---------+----------+

[root@controller ~(keystone)]# openstack server add volume CentOS_7 disk01


# the status of attached disk turns [in-use] like follows
[root@controller ~(keystone)]# openstack volume list
+--------------------------------------+--------+--------+------+-----------------------------------+
| ID                                   | Name   | Status | Size | Attached to                       |
+--------------------------------------+--------+--------+------+-----------------------------------+
| 20a0d42c-3abf-402a-a1bf-6461c769c04b | disk01 | in-use |   10 | Attached to CentOS_7 on /dev/vdb  |
+--------------------------------------+--------+--------+------+-----------------------------------+

# detach the disk
[root@controller ~(keystone)]# openstack server remove volume CentOS_7 disk01

 

728x90
반응형
SMALL