Summary of Swift multi-node installation and testing in Ubuntu

Source: Internet
Author: User

1. Prepare the environment
Version 1.1
Linux: Ubuntu Server 12.04.1 LTS;

Swift version: 1.0 (installed later );

Python version: 2.7.3 (later installation );

Python-swiftclient version: 1.3.0 (installed later ).

Summary of the installation and testing of a single Swift node in Ubuntu

1.2 node IP
Proxy Node IP: 172.17.10.14;

Storage Node 1 IP: 172.17.10.10 (with 2 2 TB Storage devices );

Storage Node 2 IP: 172.17.10.11 (with 1 2 TB Storage device );

Storage Node 3 IP: 172.17.10.13 (with 1 2 TB Storage device ).

1.3 Replace the image (optional)
If the "Network speed is slow" or "software installation fails", you can consider replacing it with a domestic image:

Vsroot @ ubuntu :~ $ Sudo sed-I's # us.archive.ubuntu.com # mirrors.163.com # G'/etc/apt/sources. list

Vsroot @ ubuntu :~ $ Sudo apt-get update

1.4 system time
Vsroot @ ubuntu :~ $ Date # Check whether the system time is correct. If the system time is correct, ignore the following two steps:

Vsroot @ ubuntu :~ $ Sudo date-s "15:05:57" # set the system time

Vsroot @ ubuntu :~ $ Sudo hwclock-w # hardware write time

1.5 disable Firewall
Make sure SELinux is disabled.

Vsroot @ ubuntu :~ $ Sudo ufw disable # disable Firewall

2. General OS Configuration
2.1 create a Swift user on each node
Vsroot @ ubuntu :~ $ Sudo useradd-mk/home/swift-s/bin/bash swift

Vsroot @ ubuntu :~ $ Sudo passwd swift # Set your swift password to swift

Edit/etc/sudoers and add the following content to the end of the file:

Vsroot @ ubuntu :~ $ Sudo vim/etc/sudoers

# User alias specification

Swift ALL = (ALL) NOPASSWD: ALL

Then, you can switch to the swift user for subsequent operations:

Vsroot @ ubuntu :~ $ Su swift

2.2 install the Swift library on each node
Swift @ ubuntu :~ $ Sudo apt-get installpython-software-properties

Swift @ ubuntu :~ $ Sudo add-apt-repository ppa: swift-core/release # ignore this step to report an error

Swift @ ubuntu :~ $ Sudo add-apt-repositorycloud-archive: grizzly # You can also select version H.

Swift @ ubuntu :~ $ Sudo apt-get update

Swift @ ubuntu :~ $ Sudo apt-get install swiftpython-swiftclient openssh-server

2.3 create a Swift working directory on each node
Swift @ ubuntu :~ $ Sudo mkdir-p/etc/swift

Swift @ ubuntu :~ $ Sudo chown-R swift: swift/etc/swift/

2.4 create a Swift configuration file
Create a Swift configuration file on any node:

Swift @ ubuntu :~ $ Cat>/etc/swift. conf <EOF

[Swift-hash]

# Random unique strings that can neverchange (do not lose)

Swift_hash_path_prefix = 'od-t x8-N 8-An </dev/random'

Swift_hash_path_suffix = 'od-t x8-N 8-An </dev/random'

EOF

Copy the Swift configuration file to all other nodes in sequence:

Swift @ ubuntu :~ $ Scp/etc/swift. conf 172.17.10.10:/etc/swift/

2.5 set IP environment variables on each node
On all Storage nodes, the actual IP address is set as follows:

Swift @ ubuntu :~ $ ExportSTORAGE_LOCAL_NET_IP = 172.17.10.10

Set the following parameters based on the actual IP address on all Proxy nodes:

Swift @ ubuntu :~ $ Export PROXY_LOCAL_NET_IP = 172.17.10.14

Considering that the export command only takes effect for the current session of the current user, you can also write the environment variable to/etc/profile:

Swift @ ubuntu :~ $ Sudo vim/etc/profile

Swift @ ubuntu :~ $ Source/etc/profile # the current session takes effect immediately

2.6 create a Swift service directory and modify the boot configuration file
Swift @ ubuntu :~ $ Sudo mkdir-p/var/run/swift

Swift @ ubuntu :~ $ Sudo chown swift: swift/var/run/swift

Swift @ ubuntu :~ $ Sudo vim/etc/rc. local

Sudo mkdir-p/var/run/swift

Sudo chown swift: swift/var/run/swift

Exit 0

3. Configure Proxy Node
3.1 install the swift-proxy Library
Swift @ ubuntu :~ $ Sudo apt-get installswift-proxy memcached

3.2 Create an SSL self-signed certificate
Swift @ ubuntu :~ $ Cd/etc/swift

Swift @ ubuntu:/etc/swift $ openssl req-new-x509-nodes-out cert. crt-keyout cert. key

Note: The CommonName of the certificate must be set to the IP address of the Proxy Node: 172.17.10.14.

3.3 configure memcached and restart the service
Swift @ ubuntu :~ $ Sudo perl-pi-e "s/-l127.0.0.1/-l $ PROXY_LOCAL_NET_IP/"/etc/memcached. conf

Swift @ ubuntu :~ $ Sudo service memcachedrestart

Check whether the memcached service has been started properly.

3.4 create a Proxy server configuration file
Swift @ ubuntu :~ $ Cat>/etc/swift/proxy-server.conf <EOF

[DEFAULT]

Cert_file =/etc/swift/cert. crt

Key_file =/etc/swift/cert. key

Bind_port = 8080

Workers = 8

User = swift

 

[Pipeline: main]

Pipeline = healthcheck proxy-logging cache tempauth proxy-logging proxy-server

 

[App: proxy-server]

Use = egg: swift # proxy

Allow_account_management = true

Account_autocreate = true

 

[Filter: proxy-logging]

Use = egg: swift # proxy_logging

 

[Filter: tempauth]

Use = egg: swift # tempauth

User_system_root = testpass. admin https: // $ PROXY_LOCAL_NET_IP: 8080/v1/AUTH_system

 

[Filter: healthcheck]

Use = egg: swift # healthcheck

 

[Filter: cache]

Use = egg: swift # memcache

Memcache_servers = $ PROXY_LOCAL_NET_IP: 11211

EOF

3.5 create account, container, and object rings
Swift @ ubuntu :~ $ Cd/etc/swift

Sudo swift-ring-builder account. builder create 18 3 1

Sudo swift-ring-builder container. builder create 18 3 1

Sudo swift-ring-builder object. builder create 18 3 1

18 indicates that the number of partition is the 18 power of 2. The number depends on the number of partition you want in a ring. 3 represents the number of copies of each object. The last parameter 1 indicates that a partition can be moved at least one hour later.

3.6 let the ring record the Storage devices of each Storage Node
Export ZONE = 1

Export STORAGE_LOCAL_NET_IP = 172.17.10.10

Export WEIGHT = 100

Export DEVICE = sdb1

Sudo swift-ring-builder account. builder addz $ ZONE-$ STORAGE_LOCAL_NET_IP: 6002/$ DEVICE $ WEIGHT

Sudo swift-ring-builder container. builderadd z $ ZONE-$ STORAGE_LOCAL_NET_IP: 6001/$ DEVICE $ WEIGHT

Sudo swift-ring-builder object. builder addz $ ZONE-$ STORAGE_LOCAL_NET_IP: 6000/$ DEVICE $ WEIGHT

Export ZONE = 1

Export STORAGE_LOCAL_NET_IP = 172.17.10.10

Export WEIGHT = 100

Export DEVICE = sdc1

Sudo swift-ring-builder account. builder addz $ ZONE-$ STORAGE_LOCAL_NET_IP: 6020/$ DEVICE $ WEIGHT

Sudo swift-ring-builder container. builderadd z $ ZONE-$ STORAGE_LOCAL_NET_IP: 6010/$ DEVICE $ WEIGHT

Sudo swift-ring-builder object. builder add z $ ZONE-$ STORAGE_LOCAL_NET_IP: 6030/$ DEVICE $ WEIGHT

Export ZONE = 2

Export STORAGE_LOCAL_NET_IP = 172.17.10.11

Export WEIGHT = 100

Export DEVICE = sdb1

Sudo swift-ring-builder account. builder addz $ ZONE-$ STORAGE_LOCAL_NET_IP: 6002/$ DEVICE $ WEIGHT

Sudo swift-ring-builder container. builderadd z $ ZONE-$ STORAGE_LOCAL_NET_IP: 6001/$ DEVICE $ WEIGHT

Sudo swift-ring-builder object. builder addz $ ZONE-$ STORAGE_LOCAL_NET_IP: 6000/$ DEVICE $ WEIGHT

Export ZONE = 3

Export STORAGE_LOCAL_NET_IP = 172.17.10.13

Export WEIGHT = 100

Export DEVICE = sdb1

Sudo swift-ring-builder account. builder addz $ ZONE-$ STORAGE_LOCAL_NET_IP: 6002/$ DEVICE $ WEIGHT

Sudo swift-ring-builder container. builderadd z $ ZONE-$ STORAGE_LOCAL_NET_IP: 6001/$ DEVICE $ WEIGHT

Sudo swift-ring-builder object. builder addz $ ZONE-$ STORAGE_LOCAL_NET_IP: 6000/$ DEVICE $ WEIGHT

Note: You need to set this parameter based on the actual Storage device of the Storage Node:

① The DEVICE must follow the/etc/rsyncd on the Storage Node. set path in conf. For example, if path is/srv/node/and the Directory sdb1 exists in/srv/node/, the DEVICE value is sdb1;

② The ZONE starts counting from 1 and increases by 1. When a Storage Node has multiple devices, it can be set to the same ZONE (recommended) or multiple zones;

③ If the size of each Mount partition is the same, WEIGHT (WEIGHT) may be set to 100.

3.7 confirm whether the ring content is correct and the (Rebalance) ring
Swift-ring-builder account. builder

Swift-ring-builder container. builder

Swift-ring-builder object. builder

Sudo swift-ring-builder account. builderrebalance

Sudo swift-ring-builder container. builderrebalance

Sudo swift-ring-builder object. builderrebalance

3.8 copy the ring to all other nodes
Swift @ ubuntu :~ $ Scp/etc/swift/* .ring.gz 172.17.10.10:/etc/swift/

Copy account.ring.gzw.container.ring.gzand object.ring.gz to the/etc/swift directory of all other proxynodes and Storage nodes.

Make sure that the configuration files of all nodes belong to swift users:

Swift @ ubuntu :~ $ Sudo chown-R swift: swift/etc/swift

3.9 enable Proxy service
Swift @ ubuntu :~ $ Sudo swift-init proxy start

Install Swift on multiple nodes using Swauth authentication in Ubuntu Server 11.10

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.