0. environment 1. install the dependent library 2. prepare Disk 3. build ring4. install swift4.1apt-getinstall install 4.2 source code installation 5. change the configuration file 6. start Service 0. operating System: Ubuntu12.04LTS, swift version: 1.4.8. Four machines, IP address
0. Environment
1. Install the dependent Library
2. Prepare a disk
3. Build a ring
4. Install swift
- 4.1 install apt-get install
- 4.2 source code Installation
5. Change the configuration file
6. Start the service 0. Environment Operating System: Ubuntu 12.04 LTS, swift version: 1.4.8. The IP addresses of the four machines are 192.168.1.11, 192.168.1.12, 192.168.1.13, and 192.168.1.14. Due to the distributed nature of swift, each node serves as a storage node and uses 192.168.1.11 as the proxy server. The disk partition is as follows: 1. Install all nodes in the dependent database:
Python-netifaces python-setuptoolspython-eventletpython-pastedeploypython-xattrxfsprogs
The above software packages can be directly installed using apt-get install. A special package: python-webob. The version of this package in the ubuntu software source is 1.1.1 (ubuntu12.04). However, this version has a bug that causes the swift client to fail to get the content-length normally using the HEAD. For example, to obtain the file size, the result is always 13. Solution: Download the deb installation package 1.0.8 on the ubuntu Software Package website and install it manually. I have downloaded the installation package. See the attachment. 2. Prepare a disk and select a disk partition for storage. In this example, sda5.
Mkfs. xfs-I size = 1024/dev/sda5
Add in/etc/fstab
/Dev/sda5/srv/node/sda5 xfs noatime, nodiratime, nobarrier, logbufs = 8 0 0
Mount Disk Partitions
Sudo mount/srv/node/sda5
3. Build a ring
Swift-ring-builder account. builder create 18 3 1
18: used to specify the number of partitions. The number of partitions is a power of 2. For example, if the number is 18, the number of partitions is 18 to the power of 2. 3: Number of file replicas 1: minimum interval for moving a partition, in the unit of hours.
Swift-ring-builder account. builder add z1-192.168.1.11: 6002/sda5 100 swift-ring-builder account. builder add z2-192.168.1.12: 6002/sda5 100swift-ring-builder account. builder add z3-192.168.1.13: 6002/sda5 100swift-ring-builder account. builder add z4-192.168.1.14: 6002/sda5 100
100 indicates the weight of the device. You can set the corresponding value based on the disk capacity, for example, 100 of 2 TB, then 50 of 1 TB. Swift-ring-builder account. builder can detect the configuration. After confirming the configuration is correct, use swift-ring-builder account. builder rebalance to rebalance. The account.ring.gz file is generated in the current directory. Build the ring of the container and object in the same way. The container Service port is 6001, and the object service port is 6000. Note: Once the ring is put into use, the ring must be changed and cannot be rebuilt. Otherwise, a lot of data may be 404. finally, the generated account.ring.gz,container.ring.gz,object.ring.gz will be distributed to the/etc/swift directory of each node.