完成 Red Hat Enterprise Linux 和 CentOS 的安装

注意

默认配置文件因发行版而异。您可能需要添加这些部分和选项,而不是修改现有的部分和选项。此外,配置片段中的省略号 (...) 表示您应该保留的潜在默认配置选项。

本节适用于 Red Hat Enterprise Linux 9 和 CentOS Stream 9。

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

    # curl -o /etc/swift/swift.conf \
      https://opendev.org/openstack/swift/raw/branch/2025.2/etc/swift.conf-sample
    
  2. 编辑 /etc/swift/swift.conf 文件并完成以下操作

    • [swift-hash] 部分,配置您的环境的哈希路径前缀和后缀。

      [swift-hash]
      ...
      swift_hash_path_suffix = HASH_PATH_SUFFIX
      swift_hash_path_prefix = HASH_PATH_PREFIX
      

      将 HASH_PATH_PREFIX 和 HASH_PATH_SUFFIX 替换为唯一值。

      警告

      请妥善保管这些值,不要更改或丢失它们。

    • [storage-policy:0] 部分,配置默认存储策略

      [storage-policy:0]
      ...
      name = Policy-0
      default = yes
      
  3. swift.conf 文件复制到每个存储节点以及运行代理服务的任何其他节点的 /etc/swift 目录。

  1. 在所有节点上,确保配置目录的正确所有权

    # chown -R root:swift /etc/swift
    
  2. 在控制器节点和任何其他运行代理服务的节点上,启动对象存储代理服务及其依赖项,并配置它们在系统启动时启动

    # systemctl enable openstack-swift-proxy.service memcached.service
    # systemctl start openstack-swift-proxy.service memcached.service
    
  3. 在存储节点上,启动对象存储服务并配置它们在系统启动时启动

    # systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service \
      openstack-swift-account-reaper.service openstack-swift-account-replicator.service
    # systemctl start 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 start 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
    # systemctl start openstack-swift-object.service openstack-swift-object-auditor.service \
      openstack-swift-object-replicator.service openstack-swift-object-updater.service