1. 程式人生 > >OpenStack架構----cinder元件(六)

OpenStack架構----cinder元件(六)

整個OpenStack是由控制節點,計算節點,網路節點,儲存節點四大部分組成。上篇博文詳細講述了控制節點服務controller中的horizon元件,本篇博文將詳解儲存節點cinder的部署。分為兩部分:控制節點和儲存節點

OpenStack儲存節點架構

儲存節點包含Cinder,Swift等服務

  • Cinder:塊儲存服務,提供相應的塊儲存,簡單來說,就是虛擬出一塊磁碟,可以掛載到相應的虛擬機器之上,不受檔案系統等因素影響,對虛擬機器來說,這個操作就像是新加了一塊硬碟,可以完成對磁碟的任何操作,包括掛載,解除安裝,格式化,轉換檔案系統等等操作,大多應用於虛擬機器空間不足的情況下的空間擴容等等
  • Swift:物件儲存服務,提供相應的物件儲存,簡單來說,就是虛擬出一塊磁碟空間,可以在這個空間當中存放檔案,也僅僅只能存放檔案,不能進行格式化,轉換檔案系統,大多應用於雲磁碟/檔案
    儲存節點包含最少兩個網路介面
    eth0:與控制節點進行通訊,接受控制節點任務,受控制節點統一調配
    eth1:與計算/網路節點進行通訊,完成控制節點下發的各類任務

    實驗環境

主 機 系 統 IP地址 角 色
controller CentOS7 192.168.37.128 keystone、nova、glance、neutron、horizon、cinder
、ntp、mariadb、rabbitmq、memcached、etcd、apache
compute CentOS7 192.168.37.130 nova、neutron、ntp
cinder CentOS7 192.168.37.131 cinder、ntp

實驗過程

++安裝和配置Cinder節點++
1、新增、新建一塊磁碟sdb

fdisk /dev/sdb

2、建立LVM物理邏輯卷/dev/sdb1

pvcreate /dev/sdb1

3、建立cinder-volumes邏輯卷組

vgcreate cinder-volumes /dev/sdb1

4、yum安裝cinder軟體包

yum install openstack-cinder targetcli python-keystone -y

5、編輯配置檔案
vim /etc/cinder/cinder.conf

[DEFAULT]
#1302
transport_url = rabbit://openstack:[email protected]
#399
auth_strategy = keystone
#291
my_ip = 192.168.175.155
#403
enabled_backends = lvm        #支援格式
#296
glance_api_servers = http://controller:9292

[database]
#3586
connection = mysql+pymysql://cinder:[email protected]/cinder

[keystone_authtoken]
#3850
auth_uri = http://controller:5000
auth_url = http://controller:35357
#3901
memcached_servers = controller:11211
#4008
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = 123456

[oslo_concurrency]
#4125
lock_path = /var/lib/cinder/tmp

#末尾新增[lvm] 模組,使用LVM驅動程式,cinder-volumes卷組,iSCSI協議和相應的iSCSI服務配置LVM後端。 
[lvm]              
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm

6、開啟cinder服務,設定開機自啟動

systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service

++安裝和配置controller節點++
1、配置資料庫

mysql -u root -p
create database cinder;
grant all privileges on cinder. to 'cinder'@'localhost' identified by '123456';
grant all privileges on cinder.
to 'cinder'@'%' identified by '123456';

2、建立使用者cinder

source ~/admin-openrc
openstack user create --domain default --password-prompt cinder
密碼:123456

OpenStack架構----cinder元件(六)

3、新增角色

openstack role add --project service --user cinder admin

4、建立cinderv2和cinderv3服務實體

openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3

OpenStack架構----cinder元件(六)
5、建立塊儲存服務API

openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s

openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s

6、安裝cinder軟體包

yum install openstack-cinder -y

7、編輯配置檔案
vim /etc/cinder/cinder.conf

[database]
#3586
connection = mysql+pymysql://cinder:[email protected]/cinder

[DEFAULT]
#1302
transport_url = rabbit://openstack:[email protected]
#399
auth_strategy = keystone
#291
my_ip = 192.168.175.145

[keystone_authtoken]
#3850
auth_uri = http://controller:5000
auth_url = http://controller:35357
#3901
memcached_servers = controller:11211
#4008
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = 123456

[oslo_concurrency]
#4126
lock_path = /var/lib/cinder/tmp

8、同步資料庫

su -s /bin/sh -c "cinder-manage db sync" cinder

OpenStack架構----cinder元件(六)

9、編輯nova配置檔案
vim /etc/nova/nova.conf

[cinder]
#4237
os_region_name = RegionOne

10、重啟openstack-nova-api服務,開啟cinder服務

systemctl restart openstack-nova-api.service
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

11、檢視使用者cinder
OpenStack架構----cinder元件(六)
12、檢視服務實體
OpenStack架構----cinder元件(六)

到此為止,cinder元件部分已部署完整,謝謝閱讀!