八、OpenStack—Cinder組件安裝
一、安裝和配置控制器節點
1、先決條件
1)創建數據庫
# mysql -u root -p
2)創建cinder數據庫
MariaDB [(none)]> CREATE DATABASE cinder;
3)授予對cinder數據庫的適當訪問權限
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘localhost‘ IDENTIFIED BY ‘CINDER_DBPASS‘; MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘%‘ IDENTIFIED BY ‘CINDER_DBPASS‘;
4)退出數據庫訪問客戶端
2、申明環境變量
# source openrc
3、創建cinder用戶
# openstack user create --domain default --password=cinder cinder
4、將cinder用戶添加到admin角色
# openstack role add --project service --user cinder admin
5、創建cinderv2和cinderv3服務實體
# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2 # openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
6、創建Block Storage服務API端點
# openstack endpoint create --region RegionOne volumev2 public http://node1:8776/v2/%\(project_id\)s # openstack endpoint create --region RegionOne volumev2 internal http://node1:8776/v2/%\(project_id\)s
# openstack endpoint create --region RegionOne volumev2 admin http://node1:8776/v2/%\(project_id\)s# openstack endpoint create --region RegionOne volumev3 public http://node1:8776/v3/%\(project_id\)s # openstack endpoint create --region RegionOne volumev3 internal http://node1:8776/v3/%\(project_id\)s # openstack endpoint create --region RegionOne volumev3 admin http://node1:8776/v3/%\(project_id\)s
二、安裝和配置
1、下載安裝包
# yum install openstack-cinder
2、編輯配置文件
# vim /etc/cinder/cinder.conf
[DEFAULT] my_ip = 172.16.254.63#本機管理網ip glance_api_servers = http://node1:9292 auth_strategy = keystone enabled_backends = lvm transport_url = rabbit://openstack:[email protected] [backend] [barbican] [brcd_fabric_example] [cisco_fabric_example] [coordination] [cors] [cors.subdomain] [database] connection = mysql+pymysql://cinder:[email protected]/cinder [fc-zone-manager] [healthcheck] [key_manager] [keystone_authtoken] auth_uri = http://node1:5000 auth_url = http://node1:35357 memcached_servers = node1:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = cinder [matchmaker_redis] [oslo_concurrency] lock_path = /var/lib/cinder/tmp [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [oslo_reports] [oslo_versionedobjects] [profiler] [ssl] [lvm] #volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver #volume_group = cinder-vg #volumes_dir = $state_path/volumes #iscsi_protocol = iscsi #iscsi_helper = lioadm #iscsi_ip_address = 172.16.254.63
3、同步數據庫
# su -s /bin/sh -c "cinder-manage db sync" cinder
三、配置計算以使用存儲
1、編輯/etc/nova/nova.conf文件
# vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
四、完成安裝
1、重新啟動Compute API服務
# systemctl restart openstack-nova-api.service
2、啟動Block Storage服務並將其設置開機自啟
# systemctl enable openstack-cinder-api openstack-cinder-scheduler
# systemctl start openstack-cinder-api openstack-cinder-scheduler
至此控制節點配置完成,接下來存儲節點配置
在配置存儲節點之前請準備第二塊磁盤
一、安裝和配置存儲節點
1、安裝LVM包
# yum install lvm2
2、啟動LVM元數據服務並設置開機自啟
# systemctl enable lvm2-lvmetad.service
# systemctl start lvm2-lvmetad.service
3、創建LVM物理卷/dev/sdb
# pvcreate /dev/sdb
4、創建LVM卷組cinder-volumes
# vgcreate cinder-volumes /dev/sdb
5、編輯 /etc/lvm/lvm.conf,在該devices部分中,添加一個接受/dev/sdb設備的過濾 器並拒絕所有其他設備
devices { ... filter = [ "a/sdb/", "r/.*/"]
二、安裝和配置組件
1、下載安裝包
# yum install openstack-cinder targetcli python-keystone
2、編輯/etc/cinder/cinder.conf
# vim /etc/cinder/cinder.conf
[DEFAULT] my_ip = 172.16.254.63#存儲節點ip glance_api_servers = http://node1:9292 auth_strategy = keystone enabled_backends = lvm transport_url = rabbit://openstack:[email protected] [backend] [barbican] [brcd_fabric_example] [cisco_fabric_example] [coordination] [cors] [cors.subdomain] [database] connection = mysql+pymysql://cinder:[email protected]/cinder [fc-zone-manager] [healthcheck] [key_manager] [keystone_authtoken] auth_uri = http://node1:5000 auth_url = http://node1:35357 memcached_servers = node1:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = cinder [matchmaker_redis] [oslo_concurrency] lock_path = /var/lib/cinder/tmp [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [oslo_reports] [oslo_versionedobjects] [profiler] [ssl] [lvm] volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver volume_group = cinder-volumes volumes_dir = $state_path/volumes iscsi_protocol = iscsi iscsi_helper = lioadm iscsi_ip_address = 172.16.254.63#存儲節點ip
3、完成安裝
# systemctl enable openstack-cinder-volume.service target.service
# systemctl start openstack-cinder-volume.service target.service
三、驗證
1、控制節點驗證
# openstack volume service list
+------------------+------------+------+---------+-------+----------------------------+ | Binary | Host | Zone | Status | State | Updated_at | +------------------+------------+------+---------+-------+----------------------------+ | cinder-scheduler | controller | nova | enabled | up | 2016-09-30T02:27:41.000000 | | cinder-volume | [email protected] | nova | enabled | up | 2016-09-30T02:27:46.000000 | +------------------+------------+------+---------+-------+----------------------------+
2、至此openstack需要組件全部搭完,可以到web界面創造實例檢查是否搭建成功
3、檢查opensatck服務是否正常常用命令
1 # opensatck network agent list 2 # opensatck compute service list 3 # opnsatck volume service list
八、OpenStack—Cinder組件安裝