Installing Swift
Swift provides a scalable and highly available distributed object storage service, which is suitable for storing unstructured data in large scale. Install Swift on the controller and storage nodes.
Installing and Configuring Swift on the Controller Node
- Create a Swift service credential.
- Create a swift user.
openstack user create --domain default --password-prompt swift
- Add the swift user to the service project and grant the admin role permission to the swift user.
openstack role add --project service --user swift admin
- Create a swift service entity.
openstack service create --name swift --description "OpenStack Object Storage" object-store
The password cannot contain the characters including #@$ and can contain the special characters including &=-_.+!*()
- Create a swift user.
- Create Swift API endpoints.
openstack endpoint create --region RegionOne object-store public http://controller:8080/v1/AUTH_%\(project_id\)s openstack endpoint create --region RegionOne object-store internal http://controller:8080/v1/AUTH_%\(project_id\)s openstack endpoint create --region RegionOne object-store admin http://controller:8080/v1
- Install the software package.
yum install openstack-swift-proxy python3-swiftclient python3-keystoneclient python3-keystonemiddleware memcached
- Configure the proxy-server. The Swift RPM package contains a proxy-server.conf file which is basically ready to use. You only need to change the value of SWIFT_PASSWORD in the file.
- Open the file.
vi /etc/swift/proxy-server.conf
- Press i to enter the insert mode and modify variables.
[filter:authtoken] password = SWIFT_PASSWORD
SWIFT_PASSWORD indicates the password of the Swift user.
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Open the file.
Installing Swift on the Storage Node
- Install and configure the program package supported by the storage.
- Select two idle storage devices and format them to XFS. vdb and vdc are used as examples. Change them as required.
mkfs.xfs -f /dev/vdb mkfs.xfs -f /dev/vdc
- Create a mount point directory structure.
mkdir -p /srv/node/vdb mkdir -p /srv/node/vdc
- Find the UUID of the new partition.
blkid
- Add the following to the /etc/fstab file:
UUID="<UUID-from-output-above>" /srv/node/vdb xfs noatime 0 2 UUID="<UUID-from-output-above>" /srv/node/vdc xfs noatime 0 2
- Mount the devices.
mount /srv/node/vdb mount /srv/node/vdc
- Optional: Create or edit the /etc/rsyncd.conf file to include the following content.
If you do not need the disaster recovery function, skip this step.
- Open the file.
vi /etc/rsyncd.conf
- Modify the file so that the file contains the following content:
[DEFAULT] uid = swift gid = swift log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid address = MANAGEMENT_INTERFACE_IP_ADDRESS [account] max connections = 2 path = /srv/node/ read only = False lock file = /var/lock/account.lock [container] max connections = 2 path = /srv/node/ read only = False lock file = /var/lock/container.lock [object] max connections = 2 path = /srv/node/ read only = False lock file = /var/lock/object.lock
Replace MANAGEMENT_INTERFACE_IP_ADDRESS with the management network IP address of the current node.
- Open the file.
- Start the rsyncd service and configure it to start upon system startup.
systemctl enable rsyncd.service systemctl start rsyncd.service
- Install the software package.
yum install openstack-swift-account openstack-swift-container openstack-swift-object
- Modify account-server.conf, container-server.conf, and object-server.conf in the /etc/swift directory and replace bind_ip to the management network IP address of the current node.
- Ensure the proper ownership of the mount point directory structure.
chown -R swift:swift /srv/node
- Create a recon directory and ensure that it has the correct ownership.
mkdir -p /var/cache/swift chown -R root:swift /var/cache/swift chmod -R 775 /var/cache/swift
Configuring Rings on the Controller Node
- Create an account ring.
- Switch to the /etc/swift directory.
cd /etc/swift
- Create a basic account.builder file.
swift-ring-builder account.builder create 10 1 1
- Add each storage node to the ring.
swift-ring-builder account.builder add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6202 --device DEVICE_NAME --weight DEVICE_WEIGHT
- Replace STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS with the management network IP address of the storage node.
- Replace DEVICE_NAME with the storage device name, for example, sda.
- DEVICE_WEIGHT is the device search weight, that is, the number of virtual nodes corresponding to the node where the device resides in the hash ring. Generally, the value is 100.
- Verify the ring content.
swift-ring-builder account.builder
- Rebalance the ring.
swift-ring-builder account.builder rebalance
- Switch to the /etc/swift directory.
- Create a container ring.
- Switch to the /etc/swift directory.
cd /etc/swift
- Create a basic container.builder file.
swift-ring-builder container.builder create 10 1 1
- Add each storage node to the ring.
swift-ring-builder container.builder add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6201 --device DEVICE_NAME --weight DEVICE_WEIGHT
- Replace STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS with the management network IP address of the storage node.
- Replace DEVICE_NAME with the storage device name, for example, sda.
- DEVICE_WEIGHT is the device search weight, that is, the number of virtual nodes corresponding to the node where the device resides in the hash ring. Generally, the value is 100.
- Verify the ring content.
swift-ring-builder container.builder
- Rebalance the ring.
swift-ring-builder container.builder rebalance
- Switch to the /etc/swift directory.
- Create an object ring.
- Switch to the /etc/swift directory.
cd /etc/swift
- Create a basic object.builder file.
swift-ring-builder object.builder create 10 1 1
- Add each storage node to the ring.
swift-ring-builder object.builder add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6200 --device DEVICE_NAME --weight DEVICE_WEIGHT
- Replace STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS with the management network IP address of the storage node.
- Replace DEVICE_NAME with the storage device name, for example, sda.
- DEVICE_WEIGHT is the device search weight, that is, the number of virtual nodes corresponding to the node where the device resides in the hash ring. Generally, the value is 100.
- Verify the ring content.
swift-ring-builder object.builder
- Rebalance the ring.
swift-ring-builder object.builder rebalance
- Switch to the /etc/swift directory.
- Install Swift.
- Open the /etc/swift/swift.conf file.
vi /etc/swift/swift.conf
- Press i to enter the insert mode and add the following content to replace test-hash with a unique value:
[swift-hash] swift_hash_path_suffix = test-hash swift_hash_path_prefix = test-hash [storage-policy:0] name = Policy-0 default = yes
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Copy the swift.conf file to the /etc/swift directory on each storage node and any additional nodes running the proxy service.
- Ensure correct ownership of the configuration directory on all nodes.
chown -R root:swift /etc/swift
- On the controller node and any additional nodes running the proxy service, start the object storage proxy service and its dependencies, and configure them to start upon system startup.
systemctl enable openstack-swift-proxy.service memcached.service systemctl start openstack-swift-proxy.service memcached.service
- Open the /etc/swift/swift.conf file.
Starting the Services
On the storage node, start the object storage services and configure them to start upon system startup.
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
Parent topic: Deployment and Verification