1. 已用RDO安装好openstack

  2. 扩展swift的存储空间

rdo安装的swift存储的地方为2G左右/srv/node/swiftloopback ,太小需扩大

  • 本实验环境,swift节点可以将某个磁盘再分个区使用,如下:

1>.fdisk /dev/nvme0n1

2>.mkfs.ext4 -s 1024 /dev/nvme0n1p2

3>.mkdir /srv/node/nvme0n1p2

4>.chown -R swift:swift /srv/node

5>.vi /etc/fstab,加一行如下:

/dev/nvme0n1p2  /srv/node/nvme0n1p2     ext4    noatime,nodiratime,nobarrier,loop,user_xattr    0       0

6>.mount  /srv/node/nvme0n1p2

  • 配置swift

1>.cd /etc/swift/

2>.查看

swift-ring-builder account.builder

swift-ring-builder container.builder

swift-ring-builder object.builder

3>.平滑添加

 swift-ring-builder account.builder add z1-192.168.1.76:6002/nvme0n1p2 50

 swift-ring-builder container.builder add  z1-192.168.1.76:6001/nvme0n1p2 50

 swift-ring-builder object.builder add z1-192.168.1.76:6000/nvme0n1p2 50


 swift-ring-builder account.builder rebalance

 swift-ring-builder container.builder rebalance

 swift-ring-builder object.builder rebalance


 swift-ring-builder account.builder

 swift-ring-builder container.builder

 swift-ring-builder object.builder


 swift-ring-builder account.builder set_weight z1-192.168.1.76:6002/nvme0n1p2 100

 swift-ring-builder container.builder set_weight z1-192.168.1.76:6001/nvme0n1p2 100

 swift-ring-builder object.builder set_weight z1-192.168.1.76:6000/nvme0n1p2 100


 swift-ring-builder account.builder

 swift-ring-builder container.builder

 swift-ring-builder object.builder


 swift-ring-builder account.builder rebalance

 swift-ring-builder container.builder rebalance

 swift-ring-builder object.builder rebalance


参考:

http://blog.fatedier.com/2016/05/25/deploy-openstack-swift/

https://my.oschina.net/u/138210/blog/195570



3. 设置glance使用swift作为后端存储

修改一些

[glance_store]

......

stores=glance.store.filesystem.Store,glance.store.swift.Store,glance.store.http.Store

default_store=swift

swift_store_auth_address=http://192.168.1.76:5000/v2.0/

swift_store_user=services:glance

swift_store_key=f2ec0b25ee4f42d2      //glance用户的keystone认证密码

swift_store_container=glance

swift_store_create_container_on_put=True

swift_store_large_object_size=5120

swift_store_large_object_chunk_size=200

os_region_name=RegionOne

......

重启glance服务或者整个重启服务

systemctl restart openstack-glance-api

openstack-service restart

4.登录dashboard的上传镜像,查看到镜像存储到swift里面了

ll /srv/node/nvme0n1p2/

总用量 32

drwxr-xr-x   3 swift swift  4096 9月  12 10:44 accounts

drwxr-xr-x   3 swift swift  4096 9月  12 10:44 containers

drwx------   2 swift swift 16384 9月   9 10:46 lost+found

drwxr-xr-x 172 swift swift  4096 9月  12 20:16 objects

drwxr-xr-x   2 swift swift  4096 9月  12 20:16 tmp