cinder存储服务部署
部署
进入数据库
mysql -uroot -p123
创建数据库
CREATE DATABASE cinder;
创建数据库用户,允许本地和远程登录
GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder’@‘localhost’
IDENTIFIED BY ‘123’;
GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder’@’%’
IDENTIFIED BY ‘123’;
退出
exit
宣告环境
source openrc # 这里我用的是openrc这个文件
创建用户
openstack user create --domain default --password=cinder cinder
[[email protected] ~]# openstack user create --domain default --password=cinder cinder
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 5c9af827d07f4b3c93fad80d42a15412 |
| name | cinder |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
给与用户管理员权限
openstack role add --project service --user cinder admin
创建服务v2、v3
openstack service create --name cinderv2
–description “OpenStack Block Storage” volumev2
[[email protected] ~]# openstack service create --name cinderv2 \
> --description "OpenStack Block Storage" volumev2
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | 4d58bc9300ad42acad98e9665f472bbb |
| name | cinderv2 |
| type | volumev2 |
+-------------+----------------------------------+
openstack service create --name cinderv3
–description “OpenStack Block Storage” volumev3
[[email protected] ~]# openstack service create --name cinderv3 \
> --description "OpenStack Block Storage" volumev3
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | f6b71f6640df4e73a2eaad10103e2ade |
| name | cinderv3 |
| type | volumev3 |
+-------------+----------------------------------+
创建端口号
openstack endpoint create --region RegionOne
volumev2 public http://chen1:8776/v2/%(project_id)s
[[email protected] ~]# openstack endpoint create --region RegionOne \
> volumev2 public http://chen1:8776/v2/%\(project_id\)s
+--------------+-------------------------------------+
| Field | Value |
+--------------+-------------------------------------+
| enabled | True |
| id | d7378d1697434c63b7f5bec381a4bce0 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4d58bc9300ad42acad98e9665f472bbb |
| service_name | cinderv2 |
| service_type | volumev2 |
| url | http://chen1:8776/v2/%(project_id)s |
+--------------+-------------------------------------+
openstack endpoint create --region RegionOne
volumev2 internal http://chen1:8776/v2/%(project_id)s
[[email protected] ~]# openstack endpoint create --region RegionOne \
> volumev2 internal http://chen1:8776/v2/%\(project_id\)s
+--------------+-------------------------------------+
| Field | Value |
+--------------+-------------------------------------+
| enabled | True |
| id | 918ba938faa04ee7a0f4be350f91e49e |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4d58bc9300ad42acad98e9665f472bbb |
| service_name | cinderv2 |
| service_type | volumev2 |
| url | http://chen1:8776/v2/%(project_id)s |
+--------------+-------------------------------------+
openstack endpoint create --region RegionOne
volumev2 admin http://chen1:8776/v2/%(project_id)s
[[email protected] ~]# openstack endpoint create --region RegionOne \
> volumev2 admin http://chen1:8776/v2/%\(project_id\)s
+--------------+-------------------------------------+
| Field | Value |
+--------------+-------------------------------------+
| enabled | True |
| id | 6ce2d633dcd14d82bcd8f8004d8da566 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 4d58bc9300ad42acad98e9665f472bbb |
| service_name | cinderv2 |
| service_type | volumev2 |
| url | http://chen1:8776/v2/%(project_id)s |
+--------------+-------------------------------------+
openstack endpoint create --region RegionOne
volumev3 public http://chen1:8776/v3/%(project_id)s
[[email protected] ~]# openstack endpoint create --region RegionOne \
> volumev3 public http://chen1:8776/v3/%\(project_id\)s
+--------------+-------------------------------------+
| Field | Value |
+--------------+-------------------------------------+
| enabled | True |
| id | f8ef62f360f747088726beda5b18c487 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | f6b71f6640df4e73a2eaad10103e2ade |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://chen1:8776/v3/%(project_id)s |
+--------------+-------------------------------------+
openstack endpoint create --region RegionOne
volumev3 internal http://chen1:8776/v3/%(project_id)s
[[email protected] ~]# openstack endpoint create --region RegionOne \
> volumev3 internal http://chen1:8776/v3/%\(project_id\)s
+--------------+-------------------------------------+
| Field | Value |
+--------------+-------------------------------------+
| enabled | True |
| id | a2044a52ebaf40288e145921fa142f6c |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | f6b71f6640df4e73a2eaad10103e2ade |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://chen1:8776/v3/%(project_id)s |
+--------------+-------------------------------------+
openstack endpoint create --region RegionOne
volumev3 admin http://chen1:8776/v3/%(project_id)s
[[email protected] ~]# openstack endpoint create --region RegionOne \
> volumev3 admin http://chen1:8776/v3/%\(project_id\)s
+--------------+-------------------------------------+
| Field | Value |
+--------------+-------------------------------------+
| enabled | True |
| id | de7236575f994632b5b31b48af1c2022 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | f6b71f6640df4e73a2eaad10103e2ade |
| service_name | cinderv3 |
| service_type | volumev3 |
| url | http://chen1:8776/v3/%(project_id)s |
+--------------+-------------------------------------+
安装cinder服务
yum -y install openstack-cinder
编辑配置文件
cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
vim /etc/cinder/cinder.conf
[DEFAULT]
my_ip = 192.168.1.13
#glance_api_servers = http://chen1: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://chen1:5000
auth_url = http://chen1:35357
memcached_servers = chen1: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
同步数据库
su -s /bin/sh -c “cinder-manage db sync” cinder
编辑计算节点
cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
在控制节点重启nova-api服务 #因为nova-api能够帮助找到cinder服务
systemctl restart openstack-nova-api.service
计算节点重启计算服务
systemctl restart openstack-nova-compute.service
控制节点
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
第三台存储节点192.168.1.15
环境:内存至少2G,两块硬盘。
下载:
yum install lvm2 -y
之后创建分区,指定分区类型lvm
创建分区-----》t ------》输入类型 l ------》8e(每个版本号不一样)----》w保存退出
创建pv
pvcreate /dev/sdb1
创建VG,取名为volumes
vgcreate cinder-volumes /dev/sdb1
编辑配置文件
vim /etc/lvm/lvm.conf #在devices中加入以下
devices {
…
filter = [ “a/sdb1/”, “r/.*/”]
安装相关服务
yum -y install openstack-cinder targetcli python-keystone
配置文件
cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
vim /etc/cinder/cinder.conf
[DEFAULT]
my_ip = 192.168.1.15
glance_api_servers = http://chen1: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://chen1:5000
auth_url = http://chen1:35357
memcached_servers = chen1: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 = 192.168.1.15 #本机IP
systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service
推荐阅读
-
使用七牛的镜像存储作为discuz的第三方服务器解决方案这样好嘛?
-
阿里云文件存储SMB协议服务及其申请和使用指南 虚拟机浏览器windowsdosunix
-
springboot打包部署到linux服务器的方法
-
IDEA部署JavaWeb项目到Tomcat服务器的方法
-
iOS视频压缩存储至本地并上传至服务器实例代码
-
thinkphp项目部署到Linux服务器上报错“模板不存在”如何解决
-
springboot工程jar包部署到云服务器的方法
-
具有负载均衡功能的MySQL服务器集群部署及实现
-
springboot打包部署到linux服务器的方法
-
IDEA部署JavaWeb项目到Tomcat服务器的方法