OpenStack Train version of the two-node installation (xv) installed cinder block storage service

cinder in articulated manner openstack added to the existing environment.
cinder block storage service requires at least one additional storage node which provides the volume for the examples.
This experimental set up a dedicated storage node and using a blank disk above it (/ dev / sdb), in roll form, to provide data to the disks instance.

Install centos system good storage node, and configured IP and hostname, edit the hosts file on the host resolution and so on.
Ip address management of network storage node is 192.168.10.44, the host name is b1.

Installation and configuration of the controller node
to create a database
mysql -u root -p

Create a cinder database
MariaDB [(none)]> CREATE DATABASE cinder;

Granting appropriate access to the cinder database
. MariaDB [(none)]> the GRANT ALL PRIVILEGES the ON cinder * the TO 'cinder' @ 'localhost' the IDENTIFIED BY 'CINDER_DBPASS';
MariaDB [(none)]> the GRANT ALL PRIVILEGES the ON cinder *. the TO 'Cinder' @ '%' the IDENTIFIED BY 'CINDER_DBPASS';
MariaDB [(none)]> Exit;

Create a service ticket
. Admin-openrc
create cinder user
openstack user create --domain default --password CINDER_PASS cinder

Adding admin role to a cinder user
openstack role add --project service --user cinder admin

创建cinderv2和cinderv3服务实体
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3

创建块存储服务API端点
openstack endpoint create --region RegionOne volumev2 public http://ct:8776/v2/%(project_id)s
openstack endpoint create --region RegionOne volumev2 internal http://ct:8776/v2/%(project_id)s
openstack endpoint create --region RegionOne volumev2 admin http://ct:8776/v2/%(project_id)s
openstack endpoint create --region RegionOne volumev3 public http://ct:8776/v3/%(project_id)s
openstack endpoint create --region RegionOne volumev3 internal http://ct:8776/v3/%(project_id)s
openstack endpoint create --region RegionOne volumev3 admin http://ct:8776/v3/%(project_id)s

安装软件包
yum install openstack-cinder
cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
grep -Ev '#|^$' /etc/cinder/cinder.conf.bak>/etc/cinder/cinder.conf
vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@ct/cinder

[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@ct
auth_strategy = keystone
my_ip = 192.168.10.41

[keystone_authtoken]
www_authenticate_uri = http://ct:5000
auth_url = http://ct:5000
memcached_servers = ct:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS

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

填充块存储数据库
su -s /bin/sh -c "cinder-manage db sync" cinder

配置计算以使用块存储
vim /etc/nova/nova.conf
[oslo_concurrency]
os_region_name = RegionOne

重新启动Compute API服务
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

安装和配置存储节点
存储节点的管理网络的ip地址为192.168.10.44

安装LVM软件包
yum install lvm2 device-mapper-persistent-data

启动LVM元数据服务,并将其配置为在系统引导时启动
systemctl enable lvm2-lvmetad.service
systemctl start lvm2-lvmetad.service

创建LVM物理卷/dev/sdb
pvcreate /dev/sdb

创建LVM卷组cinder-volumes
vgcreate cinder-volumes /dev/sdb

将LVM重新配置为仅扫描包含cinder-volumes卷组的设备
vim /etc/lvm/lvm.conf
在devices部分中,添加一个接受/dev/sdb设备并拒绝所有其他设备的过滤器:
devices {
filter = [ "a/sdb/", "r/.*/"]
a用于接受,r用于拒绝。

安装软件包
yum install centos-release-openstack-train -y
yum upgrade -y
yum install python-openstackclient -y
yum install openstack-selinux -y
yum install openstack-cinder targetcli python-keystone -y

修改配置文件
cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
grep -Ev '#|^$' /etc/cinder/cinder.conf.bak>/etc/cinder/cinder.conf
vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@ct/cinder

[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@ct
auth_strategy = keystone
my_ip = 192.168.10.44
enabled_backends = lvm
glance_api_servers = http://ct:9292

[keystone_authtoken]
www_authenticate_uri = http://ct:5000
auth_url = http://ct:5000
memcached_servers = ct:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS

[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
target_protocol = iscsi
target_helper = lioadm

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

启动块存储卷服务及其相关,并将其配置为在系统启动时启动:
systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service

验证cinder块存储服务
. admin-openrc
openstack volume service list

使用块存储服务向实例提供数据盘
创建卷(volume)
. ygj-openrc
创建一个10 GB的卷:
openstack volume create --size 10 volume1
很短的时间后,卷状态应该从creating 到available
openstack volume list

将卷附加到实例
openstack server add volume INSTANCE_NAME VOLUME_NAME
将volume1卷附加到centos7-instance1实例:
openstack server add volume centos7-instance1 volume1
openstack volume list

使用SSH访问实例,并使用以下fdisk命令验证该卷是否作为/dev/vdb块存储设备:
sudo fdisk -l
分区并格式化新添加的/dev/vdb
fdisk /dev/vdb
mk2fs.ext4 /dev/vdb1


Guess you like

Origin blog.51cto.com/11694088/2464232