cinder连接mysql数据库_配置cinder使用NFS后端

首先先使用“cinder delete”命令删除所有实例,释放磁盘空间。

停止cinder服务:

service openstack-cinder-api stop

service openstack-cinder-scheduler stop

service openstack-cinder-volume stop

备份配置文件:

cp -a /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak

cat /etc/cinder/cinder.conf.bak|grep -v ‘#‘|grep -v ‘^$‘>/etc/cinder/cinder.conf

修改配置文件:

[DEFAULT]

iscsi_ip_address=168.5.22.4

volume_backend_name=DEFAULT

iscsi_helper=tgtadm

volume_group=cinder

改为:

nfs_shares_config=/etc/cinder/nfs_shares

nfs_sparsed_volumes=true

nfs_mount_options=v3

volume_driver=cinder.volume.drivers.nfs.NfsDriver

创建挂载点配置文件:

echo ‘168.5.22.100:/volumes‘>/etc/cinder/nfs_shares

chown root:cinder /etc/cinder/nfs_shares

chmod 0640 /etc/cinder/nfs_shares

查看cinder用户密码:

cat /etc/cinder/cinder.conf|grep connection

connection=mysql://cinder:[email protected]/cinder?charset=utf8&read_timeout=60

密码是:eVUZuEyb

在任一节点重建数据库:

mysql -h 168.5.23.2 -u cinder -p -e ‘drop database cinder;‘

mysql -h 168.5.23.2 -u cinder -p -e ‘create database cinder;‘

su -s /bin/sh -c "cinder-manage db sync" cinder

启动cinder服务:

service openstack-cinder-volume start

service openstack-cinder-scheduler start

service openstack-cinder-api start

测试:

# source openrc

# nova list

+--------------------------------------+-----------------+--------+------------+-------------+---------------------+

| ID                                   | Name            | Status | Task State | Power State | Networks            |

+--------------------------------------+-----------------+--------+------------+-------------+---------------------+

| 312ba535-4279-4338-862e-4892a8393c65 | admin-instance1 | ACTIVE | -          | Running     | VLAN549=168.5.49.33 |

+--------------------------------------+-----------------+--------+------------+-------------+---------------------+

# cinder create --display-name admin-instance1-vol01 50

+---------------------+--------------------------------------+

|       Property      |                Value                 |

+---------------------+--------------------------------------+

|     attachments     |                  []                  |

|  availability_zone  |                 nova                 |

|       bootable      |                false                 |

|      created_at     |      2016-01-13T01:29:36.916617      |

| display_description |                 None                 |

|     display_name    |        admin-instance1-vol01         |

|      encrypted      |                False                 |

|          id         | 3f84fef7-50bc-4794-9d24-07e13967cd6b |

|       metadata      |                  {}                  |

|         size        |                  50                  |

|     snapshot_id     |                 None                 |

|     source_volid    |                 None                 |

|        status       |               creating               |

|     volume_type     |                 None                 |

+---------------------+--------------------------------------+

# cinder show 3f84fef7-50bc-4794-9d24-07e13967cd6b

+---------------------------------------+--------------------------------------+

|                Property               |                Value                 |

+---------------------------------------+--------------------------------------+

|              attachments              |                  []                  |

|           availability_zone           |                 nova                 |

|                bootable               |                false                 |

|               created_at              |      2016-01-13T01:29:37.000000      |

|          display_description          |                 None                 |

|              display_name             |        admin-instance1-vol01         |

|               encrypted               |                False                 |

|                   id                  | 3f84fef7-50bc-4794-9d24-07e13967cd6b |

|                metadata               |                  {}                  |

|         os-vol-host-attr:host         |    node-1.evecom.net#Generic_NFS     |

|     os-vol-mig-status-attr:migstat    |                 None                 |

|     os-vol-mig-status-attr:name_id    |                 None                 |

|      os-vol-tenant-attr:tenant_id     |   df54866bc83f4f5f96fae17b3810a343   |

|   os-volume-replication:driver_data   |                 None                 |

| os-volume-replication:extended_status |                 None                 |

|                  size                 |                  50                  |

|              snapshot_id              |                 None                 |

|              source_volid             |                 None                 |

|                 status                |              available               |

|              volume_type              |                 None                 |

+---------------------------------------+--------------------------------------+

# nova volume-attach admin-instance1 3f84fef7-50bc-4794-9d24-07e13967cd6b

+----------+--------------------------------------+

| Property | Value                                |

+----------+--------------------------------------+

| device   | /dev/vdb                             |

| id       | 3f84fef7-50bc-4794-9d24-07e13967cd6b |

| serverId | 312ba535-4279-4338-862e-4892a8393c65 |

| volumeId | 3f84fef7-50bc-4794-9d24-07e13967cd6b |

+----------+--------------------------------------+

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值