首页 > 代码库 > openstack controller ha测试环境搭建记录(十四)——配置cinder(存储节点)
openstack controller ha测试环境搭建记录(十四)——配置cinder(存储节点)
先简述cinder存储节点的配置:
1、IP地址是10.0.0.41;
2、主机名被设置为block1;
3、所有节点的hosts文件已添加相应条目;
4、已经配置了ntp时间同步;
5、已安装lvm2,并设置为开机自动启动;
6、已经挂载了新的存储设备/dev/sdb。
在存储节点执行下列命令:
pvcreate /dev/sdb1
vgcreate cinder-volumes /dev/sdb1
在存储节点和计算节点执行df命令:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 4.0G 2.3G 1.8G 56% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 39M 1.9G 3% /dev/shm
tmpfs 1.9G 17M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 497M 145M 353M 30% /boot
发现操作系统也是安装在LVM分区上。
编辑存储节点lvm.conf文件:
vi /etc/lvm/lvm.conf
devices {
...
filter = [ "a/sda/", "a/sdb/", "r/.*/"]
编辑计算节点lvm.conf文件:
filter = [ "a/sda/", "r/.*/"]
在存储节点上安装相关软件:
yum install openstack-cinder targetcli python-oslo-db MySQL-python
在存储节点上配置文件:
openstack-config --set /etc/cinder/cinder.conf database connection mysql://cinder:123456@myvip/cinder
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_password 123456
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_hosts controller1:5672,controller2:5672,controller3:5672
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_retry_interval 1
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_retry_backoff 2
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_max_retries 0
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_durable_queues true
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_ha_queues true
openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_uri http://myvip:5000/v2.0
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken identity_uri http://myvip:35357
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_user cinder
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name service
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password 123456
openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 10.0.0.41
openstack-config --set /etc/cinder/cinder.conf DEFAULT glance_host myvip
openstack-config --set /etc/cinder/cinder.conf DEFAULT iscsi_helper lioadm
openstack-config --set /etc/cinder/cinder.conf DEFAULT verbose True
在存储节点上设置服务开机启动并立即启动服务:
systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service
验证:
source admin-openrc.sh
cinder service-list
+------------------+-------------+------+---------+-------+----------------------------+-----------------+
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------------------+-------------+------+---------+-------+----------------------------+-----------------+
| cinder-scheduler | controller1 | nova | enabled | up | 2015-12-17T17:16:39.000000 | None |
| cinder-volume | block1 | nova | enabled | up | 2015-12-17T17:16:37.000000 | None |
+------------------+-------------+------+---------+-------+----------------------------+-----------------+
source demo-openrc.sh
cinder create --display-name demo-volume1 1
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2015-12-18T11:46:13.394550 |
| display_description | None |
| display_name | demo-volume1 |
| encrypted | False |
| id | d3621c40-ee86-4969-9fad-d32a9c507527 |
| metadata | {} |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | None |
+---------------------+--------------------------------------+
cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| d3621c40-ee86-4969-9fad-d32a9c507527 | available | demo-volume1 | 1 | None | false | |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
openstack controller ha测试环境搭建记录(十四)——配置cinder(存储节点)