Openstack Cinder 설정
페이지 정보
작성자 IaaSM 작성일 21-01-13 11:13 조회 8,449 댓글 0본문
Openstack Cinder 설정방법
Cinder는 Openstack에서 제공하는 block storage 입니다.
블록 스토리지는 파일이 균일한 블록에 저장되는 데이터 저장소를 의미합니다.
가장 일반적인 저장소이며, 대체로 SAN(Storage Area Network) 환경에서 배포되어 가동되는 서버에
연결됩니다.
구성방법
- 해당 구성은 테스트 서버에서 구성한 내용입니다
----------------------------------------------------------------------------------------------------------------------------------------------
- 설치 환경 Openstack Ussuri / CentOS 8.2
- 해당 방법은 iscsi를 이용한 방법입니다.
Controller Node
1. Cinder service 및 User를 생성합니다.
# openstack user create --domain default --project service --password 111111 cinder
+------------------------------+---------------------------------------------------+
| Field | Value |
+------------------------------+---------------------------------------------------+
| default_project_id | 08218a458b224d49b23f68befab3d325 |
| domain_id | default |
| enabled | True |
| id | 3390e9f195f740c2b3657abb0575c17d |
| name | cinder |
| options | {} |
| password_expires_at | None |
+------------------------------+---------------------------------------------------+
# openstack role add --project service --user cinder admin
# openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | d721310ce5ac47828d8d8e04bbea9bd9 |
| name | cinderv3 |
| type | volumev3 |
+-------------------+----------------------------------------------------+
2. Cinder 의 Endpoint를 생성합니다.
# openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(tenant_id\)s
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| enabled | True |
| id | 1cd95e6d27a04d4bb1eaf038a5c1eeac |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | d721310ce5ac47828d8d8e04bbea9bd9 |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://controller:8776/v3/%(tenant_id)s |
+-------------------+----------------------------------------------------+
# openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(tenant_id\)s
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| enabled | True |
| id | c04cdaacba6a42e687fba035e5220b47 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | d721310ce5ac47828d8d8e04bbea9bd9 |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://controller:8776/v3/%(tenant_id)s |
+-------------------+----------------------------------------------------+
# openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(tenant_id\)s
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| enabled | True |
| id | 20c776beb78048e98d60f6a74581cb48 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | d721310ce5ac47828d8d8e04bbea9bd9 |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://controller:8776/v3/%(tenant_id)s |
+-------------------+----------------------------------------------------+
3. Cinder User의 DB를 설치하고 권한을 부여합니다.
# mysql -u root -p
# create database cinder;
# grant all privileges on cinder.* to cinder@'localhost' identified by '111111';
# grant all privileges on cinder.* to cinder@'%' identified by '111111';
# flush privileges;
# exit;
4. Cinder를 설치합니다.
# dnf --enablerepo=centos-openstack-ussuri,powertools,epel -y install openstack-cinder
# vi /etc/cinder/cinder.conf
[DEFAULT]
my_ip = controller
log_dir = /var/log/cinder
state_path = /var/lib/cinder
auth_strategy = keystone
transport_url = rabbit://openstack:111111@controller
enable_v3_api = True
[database]
connection = mysql+pymysql://cinder:111111@controller/cinder
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = 111111
[oslo_concurrency]
lock_path = $state_path/tmp
5. cinder DB를 임포트 시키고, 서비스를 등록합니다.
# su -s /bin/bash cinder -c "cinder-manage db sync"
# systemctl enable --now openstack-cinder-api openstack-cinder-scheduler
# echo "export OS_VOLUME_API_VERSION=3" >> ~/admin_key
# source ~/admin_key
# firewall-cmd --add-port=8776/tcp --permanent
# firewall-cmd --reload
Storage Node
1. Cinder를 설치합니다.
# dnf --enablerepo=centos-openstack-ussuri,powertools,epel -y install openstack-cinder targetcli
2. 배포할 디스크를 파티셔닝 합니다.
# fdisk /dev/sdb
.
.
.
# scp /etc/cinder/cinder.conf storage:/etc/cinder/cinder.conf -> controller에서 파일을 복사한후 내용을 추가/수정합니다.
# vi /etc/cinder/cinder.conf
[default]
my_ip = storage
...
...
glance_api_servers = http://controller:9292
enabled_backends = lvm
[lvm]
target_helper = lioadm
target_protocol = iscsi
target_ip_address = storage
volume_group = cinder
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volumes_dir = $state_path/volumes
# vi /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
# systemctl restart openstack-nova-compute
# systemctl enable --now openstack-cinder-volume
# vi iscsiadm.te
module iscsiadm 1.0;
require {
type iscsid_t;
class capability dac_override;
}
#============= iscsid_t ==============
allow iscsid_t self:capability dac_override;
# checkmodule -m -M -o iscsiadm.mod iscsiadm.te
# semodule_package --outfile iscsiadm.pp --module iscsiadm.mod
# semodule -i iscsiadm.pp
# firewall-cmd --add-service=iscsi-target --permanent
# firewall-cmd --reload
----------------------------------------------------------------------------------------------------------------------------------------------
설치 확인
Controller
# openstack volume service list
+-------------------+--------------------+------+---------+------------+----------------------------------------+
| Binary | Host | Zone | Status | State | Updated At |
+-------------------+--------------------+------+---------+------------+----------------------------------------+
| cinder-scheduler | controller | nova | enabled | up | 2021-01-04T06:50:59.000000 |
| cinder-volume | storage@lvm | nova | enabled | up | 2021-01-04T06:50:55.000000 |
+-------------------+--------------------+------+---------+------------+----------------------------------------+
# openstack volume create --size 1 test
+------------------------------+---------------------------------------------------+
| Field | Value |
+------------------------------+---------------------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2021-01-04T06:52:43.000000 |
| description | None |
| encrypted | False |
| id | dd74c71f-f35d-46d2-93d6-d06cb941e45a |
| migration_status | None |
| multiattach | False |
| name | test |
| properties | |
| replication_status | None |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | __DEFAULT__ |
| updated_at | None |
| user_id | 5c28209bcd574348bd9884720498a7f2 |
+------------------------------+---------------------------------------------------+
# openstack volume list
+---------------------------------------------------+---------+-------------------+---------+--------------------+
| ID | Name | Status | Size | Attached to |
+---------------------------------------------------+---------+-------------------+---------+--------------------+
| dd74c71f-f35d-46d2-93d6-d06cb941e45a | test | available | 1 | |
+---------------------------------------------------+---------+-------------------+---------+--------------------+
Cinder는 Openstack에서 제공하는 block storage 입니다.
블록 스토리지는 파일이 균일한 블록에 저장되는 데이터 저장소를 의미합니다.
가장 일반적인 저장소이며, 대체로 SAN(Storage Area Network) 환경에서 배포되어 가동되는 서버에
연결됩니다.
구성방법
- 해당 구성은 테스트 서버에서 구성한 내용입니다
----------------------------------------------------------------------------------------------------------------------------------------------
- 설치 환경 Openstack Ussuri / CentOS 8.2
- 해당 방법은 iscsi를 이용한 방법입니다.
Controller Node
1. Cinder service 및 User를 생성합니다.
# openstack user create --domain default --project service --password 111111 cinder
+------------------------------+---------------------------------------------------+
| Field | Value |
+------------------------------+---------------------------------------------------+
| default_project_id | 08218a458b224d49b23f68befab3d325 |
| domain_id | default |
| enabled | True |
| id | 3390e9f195f740c2b3657abb0575c17d |
| name | cinder |
| options | {} |
| password_expires_at | None |
+------------------------------+---------------------------------------------------+
# openstack role add --project service --user cinder admin
# openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | d721310ce5ac47828d8d8e04bbea9bd9 |
| name | cinderv3 |
| type | volumev3 |
+-------------------+----------------------------------------------------+
2. Cinder 의 Endpoint를 생성합니다.
# openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(tenant_id\)s
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| enabled | True |
| id | 1cd95e6d27a04d4bb1eaf038a5c1eeac |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | d721310ce5ac47828d8d8e04bbea9bd9 |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://controller:8776/v3/%(tenant_id)s |
+-------------------+----------------------------------------------------+
# openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(tenant_id\)s
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| enabled | True |
| id | c04cdaacba6a42e687fba035e5220b47 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | d721310ce5ac47828d8d8e04bbea9bd9 |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://controller:8776/v3/%(tenant_id)s |
+-------------------+----------------------------------------------------+
# openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(tenant_id\)s
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| enabled | True |
| id | 20c776beb78048e98d60f6a74581cb48 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | d721310ce5ac47828d8d8e04bbea9bd9 |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://controller:8776/v3/%(tenant_id)s |
+-------------------+----------------------------------------------------+
3. Cinder User의 DB를 설치하고 권한을 부여합니다.
# mysql -u root -p
# create database cinder;
# grant all privileges on cinder.* to cinder@'localhost' identified by '111111';
# grant all privileges on cinder.* to cinder@'%' identified by '111111';
# flush privileges;
# exit;
4. Cinder를 설치합니다.
# dnf --enablerepo=centos-openstack-ussuri,powertools,epel -y install openstack-cinder
# vi /etc/cinder/cinder.conf
[DEFAULT]
my_ip = controller
log_dir = /var/log/cinder
state_path = /var/lib/cinder
auth_strategy = keystone
transport_url = rabbit://openstack:111111@controller
enable_v3_api = True
[database]
connection = mysql+pymysql://cinder:111111@controller/cinder
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = 111111
[oslo_concurrency]
lock_path = $state_path/tmp
5. cinder DB를 임포트 시키고, 서비스를 등록합니다.
# su -s /bin/bash cinder -c "cinder-manage db sync"
# systemctl enable --now openstack-cinder-api openstack-cinder-scheduler
# echo "export OS_VOLUME_API_VERSION=3" >> ~/admin_key
# source ~/admin_key
# firewall-cmd --add-port=8776/tcp --permanent
# firewall-cmd --reload
Storage Node
1. Cinder를 설치합니다.
# dnf --enablerepo=centos-openstack-ussuri,powertools,epel -y install openstack-cinder targetcli
2. 배포할 디스크를 파티셔닝 합니다.
# fdisk /dev/sdb
.
.
.
# scp /etc/cinder/cinder.conf storage:/etc/cinder/cinder.conf -> controller에서 파일을 복사한후 내용을 추가/수정합니다.
# vi /etc/cinder/cinder.conf
[default]
my_ip = storage
...
...
glance_api_servers = http://controller:9292
enabled_backends = lvm
[lvm]
target_helper = lioadm
target_protocol = iscsi
target_ip_address = storage
volume_group = cinder
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volumes_dir = $state_path/volumes
# vi /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
# systemctl restart openstack-nova-compute
# systemctl enable --now openstack-cinder-volume
# vi iscsiadm.te
module iscsiadm 1.0;
require {
type iscsid_t;
class capability dac_override;
}
#============= iscsid_t ==============
allow iscsid_t self:capability dac_override;
# checkmodule -m -M -o iscsiadm.mod iscsiadm.te
# semodule_package --outfile iscsiadm.pp --module iscsiadm.mod
# semodule -i iscsiadm.pp
# firewall-cmd --add-service=iscsi-target --permanent
# firewall-cmd --reload
----------------------------------------------------------------------------------------------------------------------------------------------
설치 확인
Controller
# openstack volume service list
+-------------------+--------------------+------+---------+------------+----------------------------------------+
| Binary | Host | Zone | Status | State | Updated At |
+-------------------+--------------------+------+---------+------------+----------------------------------------+
| cinder-scheduler | controller | nova | enabled | up | 2021-01-04T06:50:59.000000 |
| cinder-volume | storage@lvm | nova | enabled | up | 2021-01-04T06:50:55.000000 |
+-------------------+--------------------+------+---------+------------+----------------------------------------+
# openstack volume create --size 1 test
+------------------------------+---------------------------------------------------+
| Field | Value |
+------------------------------+---------------------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2021-01-04T06:52:43.000000 |
| description | None |
| encrypted | False |
| id | dd74c71f-f35d-46d2-93d6-d06cb941e45a |
| migration_status | None |
| multiattach | False |
| name | test |
| properties | |
| replication_status | None |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | __DEFAULT__ |
| updated_at | None |
| user_id | 5c28209bcd574348bd9884720498a7f2 |
+------------------------------+---------------------------------------------------+
# openstack volume list
+---------------------------------------------------+---------+-------------------+---------+--------------------+
| ID | Name | Status | Size | Attached to |
+---------------------------------------------------+---------+-------------------+---------+--------------------+
| dd74c71f-f35d-46d2-93d6-d06cb941e45a | test | available | 1 | |
+---------------------------------------------------+---------+-------------------+---------+--------------------+
댓글목록 0
등록된 댓글이 없습니다.