Ubuntu12.04OpenStackSwift single-node deployment Manual

Source: Internet
Author: User
Tags rsyslog openstack swift
The deployment environment VMwareWorkstation9 (recommended and earlier versions are also supported, as long as Ubuntu12.04 can be installed) Ubuntu12.04Server32bitOpenStackSwiftv1.8 (Grizzly) indicates that this document is based on official revisions only for Ubuntu12.04, for more information, see the official documentation. This document is deployed in the development environment, and Swift is configured to run with the root permission. We recommend that you create a new user in the production environment.

Deployment Environment

VMware Workstation 9 (recommended or earlier)
Ubuntu 12.04 Server 32 bit
OpenStack Swift v1.8 (Grizzly)

Description
This document is officially modified only for Ubuntu 12.04. For more information, see the official documentation.
This deployment is the development environment, and Swift is configured to run with the root permission. in the production environment, we recommend that you create a new user, swift.
Ubuntu 12.04 is selected because its default kernel is 3.5, which reduces the trouble of deployment.
Install Ubuntu Server with minimal installation because no other components are selected.

The following installation commands are all run as root
Ubuntu changes to native (not required ):
Sudo vi/etc/apt/sources. list
% S/cn.archive.ubuntu.com/mirrors.ustc.edu.cn/g
Sudo apt-get update
Sudo apt-get upgrade

Install dependency
Apt-get update
Apt-get install curl gcc memcached rsync sqlite3 xfsprogs git python-setuptools
Apt-get install python-coverage python-dev python-nose python-simplejson python-xattr python-eventlet
Python-greenlet python-pastedeploy python-netifaces python-pip python-dnspython python-mock
Use the loopback device for storage. If you need to use a partition for storage, refer to the official documentation.
Mkdir/srv
Truncate-s 1 GB/srv/swift-disk
Mkfs. xfs/srv/swift-disk
Modify/etc/fstab and add the following lines:
/Srv/swift-disk/mnt/sdb1 xfs loop, noatime, nodiratime, nobarrier, logbufs = 8 0 0

Mkdir/mnt/sdb1
Mount/mnt/sdb1
Mkdir/mnt/sdb1/1/mnt/sdb1/2/mnt/sdb1/3/mnt/sdb1/4
Chown root: root/mnt/sdb1 /*
For x in {1 .. 4}; do ln-s/mnt/sdb1/$ x/srv/$ x; done
Mkdir-p/etc/swift/object-server/etc/swift/container-server/etc/swift/account-server
Mkdir-p/srv/1/node/sdb1/srv/2/node/sdb2/srv/3/node/sdb3/srv/4/node/sdb4/var/run/ swift
Chown-R root: root/etc/swift/srv/[1-4] // var/run/swift
Edit the/etc/rc. local file and add the following four lines before exit 0:
Mkdir-p/var/cache/swift/var/cache/swift2/var/cache/swift3/var/cache/swift4
Chown : /Var/cache/swift *
Mkdir-p/var/run/swift
Chown : /Var/run/swift

Set Rsync
Create a file/etc/rsyncd. conf ,:
Uid = root
Gid = root
Log file =/var/log/rsyncd. log
Pid file =/var/run/rsyncd. pid
Address = 127.0.0.1

[Account6012]
Max connections = 25
Path =/srv/1/node/
Read only = false
Lock file =/var/lock/account6012.lock

[Account6022]
Max connections = 25
Path =/srv/2/node/
Read only = false
Lock file =/var/lock/account6022.lock

[Account6032]
Max connections = 25
Path =/srv/3/node/
Read only = false
Lock file =/var/lock/account6032.lock

[Account6042]
Max connections = 25
Path =/srv/4/node/
Read only = false
Lock file =/var/lock/account6042.lock

[Container6011]
Max connections = 25
Path =/srv/1/node/
Read only = false
Lock file =/var/lock/container6011.lock

[Container6021]
Max connections = 25
Path =/srv/2/node/
Read only = false
Lock file =/var/lock/container6021.lock

[Container6031]
Max connections = 25
Path =/srv/3/node/
Read only = false
Lock file =/var/lock/container6031.lock

[Container6041]
Max connections = 25
Path =/srv/4/node/
Read only = false
Lock file =/var/lock/container6041.lock

[Object6010]
Max connections = 25
Path =/srv/1/node/
Read only = false
Lock file =/var/lock/object6010.lock

[Object6020]
Max connections = 25
Path =/srv/2/node/
Read only = false
Lock file =/var/lock/object601_lock

[Object6030]
Max connections = 25
Path =/srv/3/node/
Read only = false
Lock file =/var/lock/object6030.lock

[Object6040]
Max connections = 25
Path =/srv/4/node/
Read only = false
Lock file =/var/lock/object6040.lock
Edit the/etc/default/rsync file and set the RSYNC_ENABLE parameter to true:
RSYNC_ENABLE = true
Start rsync
Service rsync restart
Confirm that rsync is started successfully.
Rsync: // pub @ localhost/
Set independent logs (not required, omitted, see the official documentation)
Get code and set the test environment
Get swift code from git and download it to local
Git clone https://github.com/openstack/swift.git
Install the Swift development version
Cd ~ /Swift
Git checkout-t origin/stable/grizzly # checkout stable branch 1.8
Python setup. py develop
Cd ..
Get the python-swiftclient code from git and download it to your local device.
Git clone https://github.com/openstack/python-swiftclient.git
Install the python-swiftclient development version
Cd ~ /Python-swiftclient
Python setup. py develop
Cd ..
Configure nodes
Create file/etc/swift/proxy-server.conf,
[DEFAULT]
Bind_port = 8080
User = root
Log_facility = LOG_LOCAL1
Eventlet_debug = true

[Pipeline: main]
Pipeline = healthcheck cache tempauth proxy-logging proxy-server

[App: proxy-server]
Use = egg: swift # proxy
Allow_account_management = true
Account_autocreate = true

[Filter: tempauth]
Use = egg: swift # tempauth
User_admin_admin = admin. admin. reseller_admin
User_test_tester = testing. admin
User_test2_tester2 = testing2. admin
User_test_tester3 = testing3

[Filter: healthcheck]
Use = egg: swift # healthcheck

[Filter: cache]
Use = egg: swift # memcache

[Filter: proxy-logging]
Use = egg: swift # proxy_logging
Create a file/etc/swift. conf,
[Swift-hash]
# Random unique strings that can never change (do not lose)
Swift_hash_path_prefix = rui
Swift_hash_path_suffix = jie
Create/etc/swift/account-server/1. conf:
[DEFAULT]
Devices =/srv/1/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6012
User = root
Log_facility = LOG_LOCAL2
Recon_cache_path =/var/cache/swift
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon account-server

[App: account-server]
Use = egg: swift # account

[Filter: recon]
Use = egg: swift # recon

[Account-replicator]
Vm_test_mode = yes

[Account-auditor]

[Account-reaper]
Create/etc/swift/account-server/2. conf:
[DEFAULT]
Devices =/srv/2/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6022
User = root
Log_facility = LOG_LOCAL3
Recon_cache_path =/var/cache/swift2
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon account-server

[App: account-server]
Use = egg: swift # account

[Filter: recon]
Use = egg: swift # recon

[Account-replicator]
Vm_test_mode = yes

[Account-auditor]

[Account-reaper]
Create/etc/swift/account-server/3. conf:
[DEFAULT]
Devices =/srv/3/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6032
User = root
Log_facility = LOG_LOCAL4
Recon_cache_path =/var/cache/swift3
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon account-server

[App: account-server]
Use = egg: swift # account

[Filter: recon]
Use = egg: swift # recon

[Account-replicator]
Vm_test_mode = yes

[Account-auditor]

[Account-reaper]
Create/etc/swift/account-server/4. conf:
[DEFAULT]
Devices =/srv/4/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6042
User = root
Log_facility = LOG_LOCAL5
Recon_cache_path =/var/cache/swift4
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon account-server

[App: account-server]
Use = egg: swift # account

[Filter: recon]
Use = egg: swift # recon

[Account-replicator]
Vm_test_mode = yes

[Account-auditor]

[Account-reaper]
Create/etc/swift/container-server/1. conf:
[DEFAULT]
Devices =/srv/1/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6011
User = root
Log_facility = LOG_LOCAL2
Recon_cache_path =/var/cache/swift
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon container-server

[App: container-server]
Use = egg: swift # container

[Filter: recon]
Use = egg: swift # recon

[Container-replicator]
Vm_test_mode = yes

[Container-updater]

[Container-auditor]

[Container-sync]
Create/etc/swift/container-server/2. conf:
[DEFAULT]
Devices =/srv/2/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6021
User = root
Log_facility = LOG_LOCAL3
Recon_cache_path =/var/cache/swift2
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon container-server

[App: container-server]
Use = egg: swift # container

[Filter: recon]
Use = egg: swift # recon

[Container-replicator]
Vm_test_mode = yes

[Container-updater]

[Container-auditor]

[Container-sync]
Create/etc/swift/container-server/3. conf:
[DEFAULT]
Devices =/srv/3/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6031
User = root
Log_facility = LOG_LOCAL4
Recon_cache_path =/var/cache/swift3
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon container-server

[App: container-server]
Use = egg: swift # container

[Filter: recon]
Use = egg: swift # recon

[Container-replicator]
Vm_test_mode = yes

[Container-updater]

[Container-auditor]

[Container-sync]
Create/etc/swift/container-server/4. conf:
[DEFAULT]
Devices =/srv/4/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6041
User = root
Log_facility = LOG_LOCAL5
Recon_cache_path =/var/cache/swift4
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon container-server

[App: container-server]
Use = egg: swift # container

[Filter: recon]
Use = egg: swift # recon

[Container-replicator]
Vm_test_mode = yes

[Container-updater]

[Container-auditor]

[Container-sync]
Create/etc/swift/object-server/1. conf:
[DEFAULT]
Devices =/srv/1/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6010
User = root
Log_facility = LOG_LOCAL2
Recon_cache_path =/var/cache/swift
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon object-server

[App: object-server]
Use = egg: swift # object

[Filter: recon]
Use = egg: swift # recon

[Object-replicator]
Vm_test_mode = yes

[Object-updater]

[Object-auditor]
Create/etc/swift/object-server/2. conf:
[DEFAULT]
Devices =/srv/2/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6020
User = root
Log_facility = LOG_LOCAL3
Recon_cache_path =/var/cache/swift2
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon object-server

[App: object-server]
Use = egg: swift # object

[Filter: recon]
Use = egg: swift # recon

[Object-replicator]
Vm_test_mode = yes

[Object-updater]

[Object-auditor]
Create/etc/swift/object-server/3. conf:
[DEFAULT]
Devices =/srv/3/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6030
User = root
Log_facility = LOG_LOCAL4
Recon_cache_path =/var/cache/swift3
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon object-server

[App: object-server]
Use = egg: swift # object

[Filter: recon]
Use = egg: swift # recon

[Object-replicator]
Vm_test_mode = yes

[Object-updater]

[Object-auditor]
Create/etc/swift/object-server/4. conf:
[DEFAULT]
Devices =/srv/4/node
Mount_check = false
Disable_fallocate = true
Bind_port = 6040
User = root
Log_facility = LOG_LOCAL5
Recon_cache_path =/var/cache/swift4
Eventlet_debug = true

[Pipeline: main]
Pipeline = recon object-server

[App: object-server]
Use = egg: swift # object

[Filter: recon]
Use = egg: swift # recon

[Object-replicator]
Vm_test_mode = yes

[Object-updater]

[Object-auditor]
Create Swift run script
Mkdir ~ /Bin

Create a script ~ /Bin/resetswift
Because no rsyslog is created as an independent log, the line find/var/log/swift... has been removed.
If you are using a separate partition storage, replace/srv/swift-disk with/dev/sdb1.

#! /Bin/bash
Swift-init all stop
Sudo umount/mnt/sdb1
Sudo mkfs. xfs-f/srv/swift-disk
Sudo mount/mnt/sdb1
Sudo mkdir/mnt/sdb1/1/mnt/sdb1/2/mnt/sdb1/3/mnt/sdb1/4
Sudo chown root: root/mnt/sdb1 /*
Mkdir-p/srv/1/node/sdb1/srv/2/node/sdb2/srv/3/node/sdb3/srv/4/node/sdb4
Sudo rm-f/var/log/debug/var/log/messages/var/log/rsyncd. log/var/log/syslog
Find/var/cache/swift *-type f-name *. recon-exec rm-f {}\;
Sudo service rsyslog restart
Sudo service memcached restart
Create a script ~ /Bin/remakerings
#! /Bin/bash
Cd/etc/swift
Rm-f *. builder * .ring.gz backups/*. builder backups/* .ring.gz
Swift-ring-builder object. builder create 10 3 1
Swift-ring-builder object. builder add r1z1-127.0.0.1: 6010/sdb1 1
Swift-ring-builder object. builder add r1z2-127.0.0.1: 6020/sdb2 1
Swift-ring-builder object. builder add r1z3-127.0.0.1: 6030/sdb3 1
Swift-ring-builder object. builder add r1z4-127.0.0.1: 6040/sdb4 1
Swift-ring-builder object. builder rebalance
Swift-ring-builder container. builder create 10 3 1
Swift-ring-builder container. builder add r1z1-127.0.0.1: 6011/sdb1 1
Swift-ring-builder container. builder add r1z2-127.0.0.1: 6021/sdb2 1
Swift-ring-builder container. builder add r1z3-127.0.0.1: 6031/sdb3 1
Swift-ring-builder container. builder add r1z4-127.0.0.1: 6041/sdb4 1
Swift-ring-builder container. builder rebalance
Swift-ring-builder account. builder create 10 3 1
Swift-ring-builder account. builder add r1z1-127.0.0.1: 6012/sdb1 1
Swift-ring-builder account. builder add r1z2-127.0.0.1: 6022/sdb2 1
Swift-ring-builder account. builder add r1z3-127.0.0.1: 6032/sdb3 1
Swift-ring-builder account. builder add r1z4-127.0.0.1: 6042/sdb4 1
Swift-ring-builder account. builder rebalance
Create ~ /Bin/startmain
#! /Bin/bash
Swift-init main start
Create ~ /Bin/startrest
#! /Bin/bash
Swift-init rest start
Chmod + x ~ /Bin /*

Edit ~ /. Bashrc. Add the following two lines at the end.
Export SWIFT_TEST_CONFIG_FILE =/etc/swift/test. conf
Export PATH =$ {PATH }:~ /Bin
.~ /. Bashrc
Remakerings
Cp ~ /Swift/test/sample. conf/etc/swift/test. conf
Enable Swift
Startmain
Check Swift work
Swift-A http: // 127.0.0.1: 8080/auth/v1.0-U test: tester-K testing stat
The following information should be output correctly
Account: AUTH_test
Containers: 0
Objects: 0
Bytes: 0
Accept-Ranges: bytes

Refer:
Http://www.linuxidc.com/Linux/2013-08/88168.htm
Http://docs.openstack.org/developer/swift/development_saio.html

For more information about the OpenStack Hands on lab series, seeHttp://www.linuxidc.com/Linux/2013-08/88170.htm

 

Related reading:

OpenStack monitoring-integrated Nagios Research Summary http://www.linuxidc.com/Linux/2013-02/79931.htm

CentOS 6.4 install OpenStack Nova http://www.linuxidc.com/Linux/2013-07/86981.htm

OpenStack HP push Cloud OS Cloud operating system http://www.linuxidc.com/Linux/2013-06/86361.htm

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

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.