cd /etc/swift
swift-ring-builder account.builder create 10 3 1
swift-ring-builder account.builder add --region 1 --zone 1 --ip 192.168.204.13 --port 6002 --device sdb --weight 500
swift-ring-builder account.builder add --region 1 --zone 1 --ip 192.168.204.13 --port 6002 --device sdc --weight 500
注意:如果有多个object服务器需要修改zone
swift-ring-builder account.builder add --region 1 --zone 2 --ip 192.168.204.14 --port 6002 --device sdb --weight 500
swift-ring-builder account.builder add --region 1 --zone 2 --ip 192.168.204.14 --port 6002 --device sdc --weight 500
swift-ring-builder account.builder
swift-ring-builder account.builder rebalance
cd /etc/swift
swift-ring-builder container.builder create 10 3 1
swift-ring-builder container.builder add --region 1 --zone 1 --ip 192.168.204.14 --port 6001 --device sdb --weight 500
swift-ring-builder container.builder add --region 1 --zone 1 --ip 192.168.204.14 --port 6001 --device sdc --weight 500
swift-ring-builder container.builder
swift-ring-builder container.builder rebalance
cd /etc/swift
swift-ring-builder object.builder create 10 3 1
swift-ring-builder object.builder add --region 1 --zone 1 --ip 192.168.204.14 --port 6000 --device sdb --weight 500
swift-ring-builder object.builder add --region 1 --zone 1 --ip 192.168.204.14 --port 6000 --device sdc --weight 500
swift-ring-builder object.builder
swift-ring-builder object.builder rebalance
scp *.gz compute:/etc/swift/
scp *.gz cinder:/etc/swift/
scp *.gz swift:/etc/swift/
curl -o /etc/swift/swift.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/swift.conf-sample?h=stable/rocky
将其中的 HASH_PATH_PREFIX和 HASH_PATH_SUFFIX替换为唯一的值
[root@controller swift]# head -c 32 /dev/random | base64
HtWTh1cjweVnV6ZhU0Gf6OYdN4WTg/vSmeiLV8bObFI=
[root@controller swift]# openstack-config --set /etc/swift/swift.conf swift-hash swift_hash_path_suffix HtWTh1cjweVnV6ZhU0Gf6OYdN4WTg/vSmeiLV8bObFI=
[root@controller swift]# head -c 32 /dev/random | base64
TjGAWPzVfc1aJT6hQb1j+2BQgoztwGhtEQJV08SprsQ=
[root@controller swift]# openstack-config --set /etc/swift/swift.conf swift-hash swift_hash_path_prefix TjGAWPzVfc1aJT6hQb1j+2BQgoztwGhtEQJV08SprsQ=
[root@controller swift]# openstack-config --set /etc/swift/swift.conf storage-policy:0 name Policy-0
[root@controller swift]# openstack-config --set /etc/swift/swift.conf storage-policy:0 default yes
scp swift.conf compute:/etc/swift/
scp swift.conf cinder:/etc/swift/
scp swift.conf swift:/etc/swift/
chown -R root:swift /etc/swift
systemctl start openstack-swift-proxy.service memcached.service
systemctl enable openstack-swift-proxy.service memcached.service
systemctl start openstack-swift-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.service
systemctl start openstack-swift-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.service
systemctl start openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service
systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.service
systemctl enable openstack-swift-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.service
systemctl enable openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service
source /script/admin.sh
swift stat
openstack container create test
openstack object create test /script/admin.sh
openstack object list test
openstack object save test admin.sh