Guest User

Untitled

a guest
Feb 20th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.61 KB | None | 0 0
  1. 2.2.7.1
  2. Swift Configuration
  3. There are two methods to configure the storage backend for use by Swift.
  4. 2.2.7.1.1
  5. Physical Device (Partition) as a storage
  6. A physical device is partitioned and used as storage. Assuming there is a secondary disk /dev/sdb :
  7. sudo fdisk /dev/sdb
  8. Press m for help; n for new partition; p to view the partition table; w to write changes to disk once you are done. You should now
  9. have a partiton /dev/sda1.
  10. 2.2.7.1.2
  11. Loopback Device (File) as storage
  12. We create a zero filled file for use as a loopback device for the Swift storage backend. Here we use the disk copy command to
  13. create a file named swift-disk and allocate a million 1KiB blocks (976.56 MiB) to it. So we have a loopback disk of approximately
  14. 1GiB. We can increase this size by modifying the seek value.
  15. sudo dd if=/dev/zero of=/srv/swift-disk bs=1024 count=0 seek=1000000
  16. We now create an xfs filesystem out of the partition or the loopback device we just created. For the loopback file, doing "file
  17. swift-disk" will give the details of the device. For the partition details, tune2fs utility can be used with "l" parameter.
  18. For the physical partition:
  19. sudo mkfs.xfs -i size=1024 /dev/sdb1
  20. sudo tune2fs -l /dev/sdb1 |grep -i inode
  21. For the loopback file:
  22. sudo mkfs.xfs -i size=1024 /srv/swift-disk
  23. file /srv/swift-disk
  24. swift-disk1: SGI XFS filesystem data (blksz 4096, inosz 1024, v2 dirs)
  25. The storage device we created has to be mounted automatically everytime the system starts. Lets create an arbitrary mountpoint
  26. /mnt/sdb1.
  27. sudo mkdir /mnt/sdb1
  28. Edit /etc/fstab and append the following line:
  29. For the physical partiton
  30. /dev/sdb1 /mnt/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
  31. If you have a loopback file
  32. /srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0
  33. Let’s now mount the storage device and create directories (which would act as storage nodes) and provide appropriate permissions
  34. and ownerships (user:group format) for them. I have set the ownership to swift:swift for all relevant files.
  35. sudo mount
  36. sudo mkdir
  37. sudo chown
  38. sudo ln -s
  39. sudo ln -s
  40. sudo ln -s
  41. sudo ln -s
  42. sudo mkdir
  43. server
  44. swift
  45. sudo chown
  46. /mnt/sdb1
  47. /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
  48. swift:swift /mnt/sdb1/*
  49. /mnt/sdb1/1 /srv/1
  50. /mnt/sdb1/2 /srv/2
  51. /mnt/sdb1/3 /srv/3
  52. /mnt/sdb1/4 /srv/4
  53. -p /etc/swift/object-server /etc/swift/container-server /etc/swift/account- ←
  54. /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/ ←
  55. -R swift:swift /etc/swift /srv/[1-4]/
  56. Append the following lines to /etc/rc.local just before the "exit 0":
  57. mkdir /var/run/swift
  58. chown swift:swift /var/run/swift
Add Comment
Please, Sign In to add comment