2010-07-12 17:03:45 -05:00
=======================
SAIO - Swift All In One
=======================
2010-10-20 14:29:21 -05:00
---------------------------------------------
2010-10-20 10:32:03 -05:00
Instructions for setting up a development VM
2010-10-20 14:29:21 -05:00
---------------------------------------------
2010-07-12 17:03:45 -05:00
2012-02-22 08:19:37 -07:00
This section documents setting up a virtual machine for doing Swift development.
The virtual machine will emulate running a four node Swift cluster.
2010-07-12 17:03:45 -05:00
2013-02-09 00:21:51 +02:00
* Get either Ubuntu 12.04 LTS (Precise Pangolin) or Ubuntu 10.04 LTS (Lucid Lynx) server image.
2010-08-20 20:02:58 -06:00
2012-02-28 12:20:49 -03:00
* Create guest virtual machine from the Ubuntu image.
2010-10-20 10:32:03 -05:00
2012-02-28 12:20:49 -03:00
Additional information about setting up a Swift development snapshot on other distributions is
2010-11-01 15:04:51 -05:00
available on the wiki at http://wiki.openstack.org/SAIOInstructions.
2010-10-28 17:01:50 -05:00
2010-10-20 14:29:21 -05:00
-----------------------------------------
Installing dependencies and the core code
-----------------------------------------
2010-07-12 17:03:45 -05:00
* As root on guest (you'll have to log in as you, then `sudo su -` ):
2010-07-14 14:37:17 -05:00
#. `apt-get install python-software-properties`
2011-12-16 20:18:44 -08:00
#. `add-apt-repository ppa:swift-core/release`
2010-07-12 17:03:45 -05:00
#. `apt-get update`
2012-10-08 14:20:00 -07:00
#. `apt-get install curl gcc git-core memcached python-coverage python-dev
python-nose python-setuptools python-simplejson python-xattr sqlite3
xfsprogs python-eventlet python-greenlet python-pastedeploy
python-netifaces python-pip`
2012-09-05 12:37:09 -05:00
#. `pip install mock`
2010-07-12 17:03:45 -05:00
#. Install anything else you want, like screen, ssh, vim, etc.
2010-10-20 14:29:21 -05:00
2012-02-22 08:19:37 -07:00
* On Fedora, log in as root and do:
#. `yum install openstack-swift openstack-swift-proxy
openstack-swift-account openstack-swift-container openstack-swift-object`
2012-03-05 15:27:51 +00:00
#. `yum install xinetd rsync`
2012-02-22 08:19:37 -07:00
#. `yum install memcached`
2012-09-05 12:37:09 -05:00
#. `yum install python-netifaces python-nose python-mock`
2012-02-22 08:19:37 -07:00
This installs all necessary dependencies, and also creates user `swift`
and group `swift` . So, `swift:swift` ought to be used in every place where
this manual calls for `<your-user-name>:<your-group-name>` .
Ensure that you are installing the version of Swift that corresponds to
this document. If not, enable the correct update repositories.
2012-02-28 12:20:49 -03:00
Next, choose either :ref: `partition-section` or :ref: `loopback-section` .
2010-10-20 14:29:21 -05:00
.. _partition-section:
Using a partition for storage
=============================
2012-02-22 08:19:37 -07:00
If you are going to use a separate partition for Swift data, be sure to add
2012-02-28 12:20:49 -03:00
another device when creating the VM, and follow these instructions.
2010-10-20 10:32:03 -05:00
#. `fdisk /dev/sdb` (set up a single partition)
#. `mkfs.xfs -i size=1024 /dev/sdb1`
#. Edit `/etc/fstab` and add
2010-09-30 10:35:10 -05:00
`/dev/sdb1 /mnt/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0`
2010-10-20 10:32:03 -05:00
#. `mkdir /mnt/sdb1`
#. `mount /mnt/sdb1`
2011-01-19 16:05:22 -06:00
#. `mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4`
2010-10-20 10:32:03 -05:00
#. `chown <your-user-name>:<your-group-name> /mnt/sdb1/*`
#. `mkdir /srv`
#. `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 /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/swift`
#. `chown -R <your-user-name>:<your-group-name> /etc/swift /srv/[1-4]/ /var/run/swift` -- **Make sure to include the trailing slash after /srv/[1-4]/**
#. Add to `/etc/rc.local` (before the `exit 0` )::
2012-08-06 09:02:45 -04:00
mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4
2012-07-13 17:13:53 -05:00
chown <your-user-name>:<your-group-name> /var/cache/swift*
2012-08-06 09:02:45 -04:00
mkdir -p /var/run/swift
2010-10-20 10:32:03 -05:00
chown <your-user-name>:<your-group-name> /var/run/swift
2012-02-28 12:20:49 -03:00
#. Next, skip to :ref: `rsync-section` .
2010-09-30 10:35:10 -05:00
2010-10-20 14:29:21 -05:00
.. _loopback-section:
2010-10-20 10:32:03 -05:00
2010-10-20 14:29:21 -05:00
Using a loopback device for storage
===================================
2012-02-28 12:20:49 -03:00
If you want to use a loopback device instead of another partition, follow these instructions.
2010-10-20 10:32:03 -05:00
2011-03-31 18:12:45 -07:00
#. `mkdir /srv`
2012-12-20 20:10:07 -08:00
#. `truncate -s 1GB /srv/swift-disk`
(modify size to make a larger or smaller partition)
2010-10-20 10:32:03 -05:00
#. `mkfs.xfs -i size=1024 /srv/swift-disk`
#. Edit `/etc/fstab` and add
2010-09-30 12:41:49 -05:00
`/srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0`
2010-07-12 17:03:45 -05:00
#. `mkdir /mnt/sdb1`
#. `mount /mnt/sdb1`
2011-01-19 16:05:22 -06:00
#. `mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4`
2010-07-12 17:03:45 -05:00
#. `chown <your-user-name>:<your-group-name> /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 /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/swift`
2010-07-14 08:11:57 -07:00
#. `chown -R <your-user-name>:<your-group-name> /etc/swift /srv/[1-4]/ /var/run/swift` -- **Make sure to include the trailing slash after /srv/[1-4]/**
2010-07-12 17:03:45 -05:00
#. Add to `/etc/rc.local` (before the `exit 0` )::
2012-08-21 14:54:12 -07:00
mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4
2012-07-13 17:13:53 -05:00
chown <your-user-name>:<your-group-name> /var/cache/swift*
2012-08-21 14:54:12 -07:00
mkdir -p /var/run/swift
2010-09-30 12:41:49 -05:00
chown <your-user-name>:<your-group-name> /var/run/swift
2010-07-12 17:03:45 -05:00
2010-11-15 10:51:12 -06:00
.. _rsync-section:
2010-10-20 10:32:03 -05:00
----------------
2010-10-20 14:29:21 -05:00
Setting up rsync
2010-10-20 10:32:03 -05:00
----------------
2010-07-12 17:03:45 -05:00
#. Create /etc/rsyncd.conf::
uid = <Your user name>
gid = <Your group name>
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
2010-09-30 10:47:57 -05:00
address = 127.0.0.1
2010-07-12 17:03:45 -05:00
[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/object6020.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
2012-03-05 15:27:51 +00:00
#. On Ubuntu, edit the following line in /etc/default/rsync::
2010-07-12 17:03:45 -05:00
RSYNC_ENABLE=true
2012-02-22 08:19:37 -07:00
On Fedora, edit the following line in /etc/xinetd.d/rsync::
disable = no
2012-03-05 15:27:51 +00:00
#. On Ubuntu `service rsync restart`
2010-07-12 17:03:45 -05:00
2012-02-22 08:19:37 -07:00
------------------
Starting memcached
------------------
On Fedora, make sure that memcached runs, running this if necessary:
* `systemctl enable memcached.service`
* `systemctl start memcached.service`
If this is not done, tokens of tempauth expire immediately and accessing
Swift with curl becomes impossible.
2011-02-04 14:20:09 -06:00
---------------------------------------------------
Optional: Setting up rsyslog for individual logging
---------------------------------------------------
#. Create /etc/rsyslog.d/10-swift.conf::
2011-02-07 14:45:38 -06:00
# Uncomment the following to have a log containing all logs together
#local1,local2,local3,local4,local5.* /var/log/swift/all.log
2011-02-14 16:56:40 -06:00
# Uncomment the following to have hourly proxy logs for stats processing
#$template HourlyProxyLog,"/var/log/swift/hourly/%$YEAR%%$MONTH%%$DAY%%$HOUR%"
#local1.*;local1.!notice ?HourlyProxyLog
2011-02-07 14:45:38 -06:00
local1.*;local1.!notice /var/log/swift/proxy.log
local1.notice /var/log/swift/proxy.error
2011-02-04 14:20:09 -06:00
local1.* ~
2011-02-07 14:45:38 -06:00
local2.*;local2.!notice /var/log/swift/storage1.log
local2.notice /var/log/swift/storage1.error
2011-02-04 14:20:09 -06:00
local2.* ~
2011-02-07 14:45:38 -06:00
local3.*;local3.!notice /var/log/swift/storage2.log
local3.notice /var/log/swift/storage2.error
2011-02-04 14:20:09 -06:00
local3.* ~
2011-02-07 14:45:38 -06:00
local4.*;local4.!notice /var/log/swift/storage3.log
local4.notice /var/log/swift/storage3.error
2011-02-04 14:20:09 -06:00
local4.* ~
2011-02-07 14:45:38 -06:00
local5.*;local5.!notice /var/log/swift/storage4.log
local5.notice /var/log/swift/storage4.error
2011-02-04 14:20:09 -06:00
local5.* ~
2011-02-15 14:51:00 -06:00
#. Edit /etc/rsyslog.conf and make the following change::
2012-02-28 12:20:49 -03:00
2011-02-14 16:56:40 -06:00
$PrivDropToGroup adm
#. `mkdir -p /var/log/swift/hourly`
#. `chown -R syslog.adm /var/log/swift`
2012-08-21 14:54:12 -07:00
#. `chmod -R g+w /var/log/swift`
2011-02-15 14:51:00 -06:00
#. `service rsyslog restart`
2010-10-20 14:29:21 -05:00
------------------------------------------------
Getting the code and setting up test environment
------------------------------------------------
2012-02-28 12:20:49 -03:00
Sample configuration files are provided with all defaults in line-by-line comments.
2010-10-20 14:29:21 -05:00
2012-02-28 12:20:49 -03:00
Do these commands as you on guest.
2010-07-12 17:03:45 -05:00
#. `mkdir ~/bin`
2011-11-01 08:18:51 +01:00
#. Check out the swift repo with `git clone https://github.com/openstack/swift.git`
2012-02-28 12:20:49 -03:00
#. Build a development installation of swift, for example:
2012-01-03 15:39:42 +00:00
`cd ~/swift; sudo python setup.py develop`
2012-05-22 10:57:10 +02:00
#. Check out the python-swiftclient repo with `git clone https://github.com/openstack/python-swiftclient.git`
#. Build a development installation of python-swiftclient, for example:
`cd ~/python-swiftclient; sudo python setup.py develop`
2010-07-12 17:03:45 -05:00
#. Edit `~/.bashrc` and add to the end::
2012-04-30 16:38:15 -04:00
export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf
2010-07-12 17:03:45 -05:00
export PATH=${PATH}:~/bin
#. `. ~/.bashrc`
2012-02-28 12:20:49 -03:00
2010-10-20 14:29:21 -05:00
---------------------
Configuring each node
---------------------
Sample configuration files are provided with all defaults in line-by-line comments.
2012-02-28 12:20:49 -03:00
2010-07-12 17:03:45 -05:00
#. Create `/etc/swift/proxy-server.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
bind_port = 8080
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL1
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-05-24 21:15:51 -07:00
pipeline = healthcheck cache tempauth proxy-logging proxy-server
2012-02-28 12:20:49 -03:00
2010-08-24 14:38:36 +00:00
[app:proxy-server]
2010-08-20 02:19:50 +00:00
use = egg:swift#proxy
2010-11-29 15:19:29 -08:00
allow_account_management = true
2011-10-06 11:35:43 -04:00
account_autocreate = true
2010-08-20 02:19:50 +00:00
2011-05-26 02:24:12 +00:00
[filter:tempauth]
use = egg:swift#tempauth
2011-05-26 02:17:42 +00:00
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3
2010-12-01 17:08:49 -08:00
2010-08-20 02:19:50 +00:00
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:cache]
2010-08-24 14:40:36 +00:00
use = egg:swift#memcache
2010-08-20 02:19:50 +00:00
2012-05-24 21:15:51 -07:00
[filter:proxy-logging]
use = egg:swift#proxy_logging
2013-02-09 00:21:51 +02:00
#. Create `/etc/swift/swift.conf` ::
2010-10-14 15:58:44 -07:00
[swift-hash]
# random unique string that can never change (DO NOT LOSE)
swift_hash_path_suffix = changeme
2010-07-12 17:03:45 -05:00
#. Create `/etc/swift/account-server/1.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/1/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6012
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL2
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon account-server
2010-08-20 02:19:50 +00:00
[app:account-server]
use = egg:swift#account
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[account-replicator]
vm_test_mode = yes
[account-auditor]
[account-reaper]
#. Create `/etc/swift/account-server/2.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/2/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6022
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL3
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift2
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon account-server
2010-08-20 02:19:50 +00:00
[app:account-server]
use = egg:swift#account
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[account-replicator]
vm_test_mode = yes
[account-auditor]
[account-reaper]
#. Create `/etc/swift/account-server/3.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/3/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6032
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL4
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift3
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon account-server
2010-08-20 02:19:50 +00:00
[app:account-server]
use = egg:swift#account
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[account-replicator]
vm_test_mode = yes
[account-auditor]
[account-reaper]
#. Create `/etc/swift/account-server/4.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/4/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6042
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL5
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift4
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon account-server
2010-08-20 02:19:50 +00:00
[app:account-server]
use = egg:swift#account
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[account-replicator]
vm_test_mode = yes
[account-auditor]
[account-reaper]
#. Create `/etc/swift/container-server/1.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/1/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6011
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL2
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon container-server
2010-08-20 02:19:50 +00:00
[app:container-server]
use = egg:swift#container
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[container-replicator]
vm_test_mode = yes
[container-updater]
[container-auditor]
2011-02-25 17:31:58 -08:00
[container-sync]
2010-07-12 17:03:45 -05:00
#. Create `/etc/swift/container-server/2.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/2/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6021
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL3
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift2
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon container-server
2010-08-20 02:19:50 +00:00
[app:container-server]
use = egg:swift#container
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[container-replicator]
vm_test_mode = yes
[container-updater]
[container-auditor]
2011-02-25 17:31:58 -08:00
[container-sync]
2010-07-12 17:03:45 -05:00
#. Create `/etc/swift/container-server/3.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/3/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6031
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL4
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift3
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon container-server
2010-08-20 02:19:50 +00:00
[app:container-server]
use = egg:swift#container
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[container-replicator]
vm_test_mode = yes
[container-updater]
[container-auditor]
2011-02-25 17:31:58 -08:00
[container-sync]
2010-07-12 17:03:45 -05:00
#. Create `/etc/swift/container-server/4.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/4/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6041
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL5
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift4
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon container-server
2010-08-20 02:19:50 +00:00
[app:container-server]
use = egg:swift#container
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[container-replicator]
vm_test_mode = yes
[container-updater]
[container-auditor]
2011-02-25 17:31:58 -08:00
[container-sync]
2010-07-12 17:03:45 -05:00
#. Create `/etc/swift/object-server/1.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/1/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6010
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL2
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon object-server
2010-08-20 02:19:50 +00:00
[app:object-server]
use = egg:swift#object
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[object-replicator]
vm_test_mode = yes
[object-updater]
[object-auditor]
#. Create `/etc/swift/object-server/2.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/2/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6020
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL3
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift2
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon object-server
2010-08-20 02:19:50 +00:00
[app:object-server]
use = egg:swift#object
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[object-replicator]
vm_test_mode = yes
[object-updater]
[object-auditor]
#. Create `/etc/swift/object-server/3.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/3/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6030
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL4
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift3
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon object-server
2010-08-20 02:19:50 +00:00
[app:object-server]
use = egg:swift#object
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[object-replicator]
vm_test_mode = yes
[object-updater]
[object-auditor]
#. Create `/etc/swift/object-server/4.conf` ::
2010-08-20 02:19:50 +00:00
[DEFAULT]
2010-07-12 17:03:45 -05:00
devices = /srv/4/node
mount_check = false
2012-08-29 19:57:26 +00:00
disable_fallocate = true
2010-07-12 17:03:45 -05:00
bind_port = 6040
user = <your-user-name>
2011-02-04 14:20:09 -06:00
log_facility = LOG_LOCAL5
2012-07-13 17:13:53 -05:00
recon_cache_path = /var/cache/swift4
2012-12-06 15:09:53 -06:00
eventlet_debug = true
2010-07-12 17:03:45 -05:00
2010-08-20 02:19:50 +00:00
[pipeline:main]
2012-07-13 17:13:53 -05:00
pipeline = recon object-server
2010-08-20 02:19:50 +00:00
[app:object-server]
use = egg:swift#object
2012-07-13 17:13:53 -05:00
[filter:recon]
use = egg:swift#recon
2010-07-12 17:03:45 -05:00
[object-replicator]
vm_test_mode = yes
[object-updater]
[object-auditor]
2010-10-20 14:29:21 -05:00
------------------------------------
Setting up scripts for running Swift
------------------------------------
2010-07-12 17:03:45 -05:00
2012-02-28 12:20:49 -03:00
#. Create `~/bin/resetswift.`
2011-05-26 02:17:42 +00:00
If you are using a loopback device substitute `/dev/sdb1` with `/srv/swift-disk` .
If you did not set up rsyslog for individual logging, remove the `find /var/log/swift...` line::
2012-02-28 12:20:49 -03:00
2010-07-12 17:03:45 -05:00
#!/bin/bash
swift-init all stop
2011-03-15 15:28:29 +00:00
find /var/log/swift -type f -exec rm -f {} \;
2010-07-12 17:03:45 -05:00
sudo umount /mnt/sdb1
sudo mkfs.xfs -f -i size=1024 /dev/sdb1
sudo mount /mnt/sdb1
2011-01-19 16:05:22 -06:00
sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
2010-07-12 17:03:45 -05:00
sudo chown <your-user-name>:<your-group-name> /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
Upating proxy-server StatsD logging.
Removed many StatsD logging calls in proxy-server and added
swift-informant-style catch-all logging in the proxy-logger middleware.
Many errors previously rolled into the "proxy-server.<type>.errors"
counter will now appear broken down by response code and with timing
data at: "proxy-server.<type>.<verb>.<status>.timing". Also, bytes
transferred (sum of in + out) will be at:
"proxy-server.<type>.<verb>.<status>.xfer". The proxy-logging
middleware can get its StatsD config from standard vars in [DEFAULT] or
from access_log_statsd_* config vars in its config section.
Similarly to Swift Informant, request methods ("verbs") are filtered
using the new proxy-logging config var, "log_statsd_valid_http_methods"
which defaults to GET, HEAD, POST, PUT, DELETE, and COPY. Requests with
methods not in this list use "BAD_METHOD" for <verb> in the metric name.
To avoid user error, access_log_statsd_valid_http_methods is also
accepted.
Previously, proxy-server metrics used "Account", "Container", and
"Object" for the <type>, but these are now all lowercase.
Updated the admin guide's StatsD docs to reflect the above changes and
also include the "proxy-server.<type>.handoff_count" and
"proxy-server.<type>.handoff_all_count" metrics.
The proxy server now saves off the original req.method and proxy_logging
will use this if it can (both for request logging and as the "<verb>" in
the statsd timing metric). This fixes bug 1025433.
Removed some stale access_log_* related code in proxy/server.py. Also
removed the BaseApplication/Application distinction as it's no longer
necessary.
Fixed up the sample config files a bit (logging lines, mostly).
Fixed typo in SAIO development guide.
Got proxy_logging.py test coverage to 100%.
Fixed proxy_logging.py for PEP8 v1.3.2.
Enhanced test.unit.FakeLogger to track more calls to enable testing
StatsD metric calls.
Change-Id: I45d94cb76450be96d66fcfab56359bdfdc3a2576
2012-08-19 17:44:43 -07:00
find /var/cache/swift* -type f -name * .recon -exec rm -f {} \;
2010-07-12 17:03:45 -05:00
sudo service rsyslog restart
sudo service memcached restart
#. Create `~/bin/remakerings` ::
#!/bin/bash
cd /etc/swift
2010-09-01 21:42:24 -05:00
rm -f *.builder * .ring.gz backups/*.builder backups/* .ring.gz
2010-07-12 17:03:45 -05:00
swift-ring-builder object.builder create 18 3 1
swift-ring-builder object.builder add z1-127.0.0.1:6010/sdb1 1
swift-ring-builder object.builder add z2-127.0.0.1:6020/sdb2 1
swift-ring-builder object.builder add z3-127.0.0.1:6030/sdb3 1
swift-ring-builder object.builder add z4-127.0.0.1:6040/sdb4 1
swift-ring-builder object.builder rebalance
swift-ring-builder container.builder create 18 3 1
swift-ring-builder container.builder add z1-127.0.0.1:6011/sdb1 1
swift-ring-builder container.builder add z2-127.0.0.1:6021/sdb2 1
swift-ring-builder container.builder add z3-127.0.0.1:6031/sdb3 1
swift-ring-builder container.builder add z4-127.0.0.1:6041/sdb4 1
swift-ring-builder container.builder rebalance
swift-ring-builder account.builder create 18 3 1
swift-ring-builder account.builder add z1-127.0.0.1:6012/sdb1 1
swift-ring-builder account.builder add z2-127.0.0.1:6022/sdb2 1
swift-ring-builder account.builder add z3-127.0.0.1:6032/sdb3 1
swift-ring-builder account.builder add z4-127.0.0.1:6042/sdb4 1
swift-ring-builder account.builder rebalance
#. Create `~/bin/startmain` ::
#!/bin/bash
2010-11-17 17:52:31 -06:00
swift-init main start
2010-07-12 17:03:45 -05:00
#. Create `~/bin/startrest` ::
#!/bin/bash
2010-11-17 17:52:31 -06:00
swift-init rest start
2010-07-12 17:03:45 -05:00
#. `chmod +x ~/bin/*`
#. `remakerings`
2013-02-09 00:21:51 +02:00
#. `cp ~/swift/test/sample.conf /etc/swift/test.conf`
2011-11-01 08:18:51 +01:00
#. `cd ~/swift; ./.unittests`
2010-07-18 18:19:48 -05:00
#. `startmain` (The `` Unable to increase file descriptor limit. Running as non-root? `` warnings are expected and ok.)
2011-03-14 02:56:37 +00:00
#. Get an `X-Storage-Url` and `X-Auth-Token` : `` curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 ``
2010-07-13 22:24:47 -05:00
#. Check that you can GET account: `` curl -v -H 'X-Auth-Token: <token-from-x-auth-token-above>' <url-from-x-storage-url-above> ``
2011-06-14 11:04:06 -05:00
#. Check that `swift` works: `swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat`
2011-11-01 08:18:51 +01:00
#. `cd ~/swift; ./.functests` (Note: functional tests will first delete
2010-09-05 19:53:08 -07:00
everything in the configured accounts.)
2011-11-01 08:18:51 +01:00
#. `cd ~/swift; ./.probetests` (Note: probe tests will reset your
2010-09-05 19:21:08 -07:00
environment as they call `resetswift` for each test.)
2010-07-13 22:24:47 -05:00
----------------
Debugging Issues
----------------
If all doesn't go as planned, and tests fail, or you can't auth, or something doesn't work, here are some good starting places to look for issues:
2013-02-18 10:54:27 -07:00
#. Everything is logged using system facilities -- usually in /var/log/syslog,
but possibly in /var/log/messages on e.g. Fedora -- so that is a good first
place to look for errors (most likely python tracebacks).
2010-07-13 22:24:47 -05:00
#. Make sure all of the server processes are running. For the base
2011-03-14 02:56:37 +00:00
functionality, the Proxy, Account, Container, and Object servers
2012-02-22 08:19:37 -07:00
should be running.
2010-07-13 22:24:47 -05:00
#. If one of the servers are not running, and no errors are logged to syslog,
2012-02-28 12:20:49 -03:00
it may be useful to try to start the server manually, for example:
`swift-object-server /etc/swift/object-server/1.conf` will start the
object server. If there are problems not showing up in syslog,
2010-07-13 22:24:47 -05:00
then you will likely see the traceback on startup.
2012-04-30 16:38:15 -04:00
#. If you need to, you can turn off syslog for unit tests. This can be
useful for environments where /dev/log is unavailable, or which
cannot rate limit (unit tests generate a lot of logs very quickly).
Open the file SWIFT_TEST_CONFIG_FILE points to, and change the
value of fake_syslog to True.