14,控制节点配置Swift

文章目录

  • 14.1 创建账户ring
    • 14.1.1 创建基本 account.builder 文件
    • 14.1.2 添加每个节点到 ring
    • 14.1.3 验证ring
    • 14.1.4 平衡ring
  • 14.2 创建容器ring
    • 14.2.1 创建基本container.builder文件
    • 14.2.2 添加每个节点到ring
    • 14.2.3 验证 ring
    • 14.2.4 平衡ring
  • 14.3 创建对象ring
    • 14.3.1 创建基本object.builder文件
    • 14.3.2 添加每个节点到ring
    • 14.3.3 验证 ring
    • 14.3.4 平衡 ring
    • 14.3.5 复制环配置文件到每个存储节点和其他运行了代理服务的额外节点的 /etc/swift 目录
  • 14.5 从对象存储源仓库中获取 /etc/swift/swift.conf 文件
  • 14.6 配置swift
    • 14.6.1 复制swift.conf文件到每个存储节点和其他允许了代理服务的额外节点的 /etc/swift 目录
    • 14.6.2 确认配置文件目录所有权
  • 14.7 控制节点和其他运行了代理服务的节点启动并且配置自启动
  • 14.8 存储节点启动并且配置自启动
  • 14.9 验证
    • 14.9.1 显示服务状态
    • 14.9.2 创建test容器
    • 14.9.3 上传一个测试文件到test容器
    • 14.9.4 列出test容器里的所有文件
    • 14.9.5 从test容器里下载一个测试文件

14.1 创建账户ring

14.1.1 创建基本 account.builder 文件

cd /etc/swift
swift-ring-builder account.builder create 10 3 1

14.1.2 添加每个节点到 ring

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

14.1.3 验证ring

swift-ring-builder account.builder

14.1.4 平衡ring

swift-ring-builder account.builder rebalance

14.2 创建容器ring

14.2.1 创建基本container.builder文件

cd /etc/swift
swift-ring-builder container.builder create 10 3 1

14.2.2 添加每个节点到ring

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

14.2.3 验证 ring

swift-ring-builder container.builder

14.2.4 平衡ring

swift-ring-builder container.builder rebalance

14.3 创建对象ring

14.3.1 创建基本object.builder文件

cd /etc/swift
swift-ring-builder object.builder create 10 3 1

14.3.2 添加每个节点到ring

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

14.3.3 验证 ring

swift-ring-builder object.builder

14.3.4 平衡 ring

swift-ring-builder object.builder rebalance

14.3.5 复制环配置文件到每个存储节点和其他运行了代理服务的额外节点的 /etc/swift 目录

scp *.gz compute:/etc/swift/
scp *.gz cinder:/etc/swift/
scp *.gz swift:/etc/swift/

14.5 从对象存储源仓库中获取 /etc/swift/swift.conf 文件

curl -o /etc/swift/swift.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/swift.conf-sample?h=stable/rocky

14.6 配置swift

将其中的 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

14.6.1 复制swift.conf文件到每个存储节点和其他允许了代理服务的额外节点的 /etc/swift 目录

scp swift.conf compute:/etc/swift/
scp swift.conf cinder:/etc/swift/
scp swift.conf swift:/etc/swift/

14.6.2 确认配置文件目录所有权

chown -R root:swift /etc/swift

14.7 控制节点和其他运行了代理服务的节点启动并且配置自启动

systemctl start openstack-swift-proxy.service memcached.service
systemctl enable openstack-swift-proxy.service memcached.service

14.8 存储节点启动并且配置自启动

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

14.9 验证

14.9.1 显示服务状态

source /script/admin.sh 
swift stat

14.9.2 创建test容器

openstack container create test

14.9.3 上传一个测试文件到test容器

openstack object create test /script/admin.sh

14.9.4 列出test容器里的所有文件

openstack object list test

14.9.5 从test容器里下载一个测试文件

openstack object save test admin.sh

你可能感兴趣的:(Openstack)