一、安装和配置控制器节点
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:admin@node1 [backend] [barbican] [brcd_fabric_example] [cisco_fabric_example] [coordination] [cors] [cors.subdomain] [database] connection = mysql+pymysql://cinder:CINDER_DBPASS@node1/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:admin@node1 [backend] [barbican] [brcd_fabric_example] [cisco_fabric_example] [coordination] [cors] [cors.subdomain] [database] connection = mysql+pymysql://cinder:CINDER_DBPASS@node1/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 | block@lvm | 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