一。块存储服务Cinder控制节点
1.安装cinder:
yum install openstack-cinder python-cinderclient
2.修改配置文件:
vim /etc/cinder/cinder.conf
rabbit_host=172.16.1.210
rabbit_port=5672
rabbit_use_ssl=false
rabbit_userid=guest
rabbit_password=guest
rpc_backend=rabbit
my_ip=172.16.1.210
glance_host=$my_ip
auth_strategy=keystone
connection=mysql://cinder:[email protected]/cinder
auth_host=172.16.1.210
auth_port=35357
auth_protocol=http
auth_uri=http://172.16.1.210:5000
identity_uri=http://172.16.1.210:35357/
auth_version=v2.0
admin_user=cinder
admin_password=cinder
admin_tenant_name=service
3.初始化cinder数据库:
cinder-manage db sync
4.在keystone上面创建cinder用户:
keystone user-create --name=cinder --pass=cinder
keystone user-role-add --user=cinder --tenant=service --role=admin
5.将cinder在keystone注册服务和注册url:
keystone service-create --name=cinder --type=volume
keystone endpoint-create --service-id=$(keystone service-list|awk '/ cinder / {print $2}') --publicurl=http://172.16.1.210:8776/v1/%\(tenant_id\)s --internalurl=http://172.16.1.210:8776/v1/%\(tenant_id\)s --adminurl=http://172.16.1.210:8776/v1/%\(tenant_id\)s
keystone service-create --name=cinderv2 --type=volumev2
keystone endpoint-create --service-id=$(keystone service-list|awk '/ cinderv2 / {print $2}') --publicurl=http://172.16.1.210:8776/v2/%\(tenant_id\)s --internalurl=http://172.16.1.210:8776/v2/%\(tenant_id\)s --adminurl=http://172.16.1.210:8776/v2/%\(tenant_id\)s
6.启动cinder服务:
/etc/init.d/openstack-cinder-api start
/etc/init.d/openstack-cinder-scheduler start
7.查看cinder服务上面注册了哪些云硬盘:
cinder service-list
二。块存储服务Cinder存储节点(LVM)
1.在存储节点上面创建一块硬盘,然后用pv初始化:
pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb
2.修改配置文件:
vim /etc/lvm/lvm.conf
# Use anchors if you want to be really specific
filter = [ "a/sda1/","a/sdb/","r/.*/" ]
3.安装共享存储target服务:
yum install scsi-target-utils
4.修改配置文件:
vim /etc/tgt/targets.conf
include /etc/cinder/volumes/* (添加)
4.安装cinder服务:
yum install openstack-cinder
5.将控制节点的配置文件拷贝到存储节点:
scp /etc/cinder/cinder.conf 172.16.1.211:/etc/cinder/cinder.conf
6.修改配置文件:
vim /etc/cinder/cinder.conf
my_ip=172.16.1.211
glance_host=172.16.1.210
iscsi_ip_address=$my_ip
volume_backend_name=iSCSI-Storage
iscsi_helper=tgtadm
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
7.启动相关服务:
/etc/init.d/tgtd start
/etc/init.d/openstack-cinder-volume start
8.创建cinder的iscsi类型(方便选择后端的存储位置):
cinder type-create iSCSI
cinder type-key iSCSI set volume_backend_name=iSCSI-Storage
(命令在控制节点上操作,“iSCSI-Storage”这个是配置文件里面命名的)
9.下面可以通过网页的云硬盘操作了。
三。块存储服务Cinder存储节点(NFS)
1.创建NFS共享(不说明了):
2.修改cinder配置文件:
vim /etc/cinder/cinder.conf
volume_backend_name=Nfs-Storage
nfs_shares_config=/etc/cinder/nfs_shares
nfs_mount_point_base=$state_path/mnt
volume_driver=cinder.volume.drivers.nfs.NfsDriver
vim /etc/cinder/nfs_shares
172.16.1.210:/data/nfs
NFS地址
3.启动cinder服务:
/etc/init.d/openstack-cinder-volume start
4.创建cinder的nfs类型:
cinder type-create NFS
cinder type-key NFS set volume_backend_name=Nfs-Storage
5.下面可以通过网页的云硬盘操作了。
四。块存储服务Cinder存储节点(glusterfs)
1.安装glusterfs服务(两个存储节点都装上):
wget http://download.gluster.org/pub/gluster/glusterfs/3.7/3.7.14/CentOS/glusterfs-epel.repo
mv glusterfs-epel.repo /etc/yum.repos.d/
yum install glusterfs-server
2.启动两台机器的glusterfs:
/etc/init.d/glusterd start
3.创建glusterfs劵:
mkdir /data/glusterfs/exp1 (两台机器都要操作)
gluster peer probe 172.16.1.211 (创建对等节点,在210上面操作)
gluster volume create cinder-volume01 replica 2 172.16.1.210:/data/glusterfs/exp1 172.16.1.211:/data/glusterfs/exp1 force (创建cinder-volume01劵)
gluster vol start cinder-volume01 (启动卷)
gluster vol info (查看劵的状态)
4.修改cinder配置文件:
vim /etc/cinder/glusterfs_shares (本来没有,需要创建)
172.16.1.210:/cinder-volome01
vim /etc/cinder/cinder.conf
volume_backend_name=GLS-Storage
glusterfs_shares_config=/etc/cinder/glusterfs_shares
volume_driver=cinder.volume.drivers.glusterfs.GlusterfsDriver
5.创建cinder的glusterfs类型:
cinder type-create GLS
cinder type-key GLS set volume_backend_name=GLS-Storage
6.现在可以到网页上面创建云硬盘了