diff --git a/doc/saio/bin/remakerings b/doc/saio/bin/remakerings new file mode 100755 index 0000000000..1c84681470 --- /dev/null +++ b/doc/saio/bin/remakerings @@ -0,0 +1,24 @@ +#!/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 diff --git a/doc/saio/bin/resetswift b/doc/saio/bin/resetswift new file mode 100755 index 0000000000..0c47690159 --- /dev/null +++ b/doc/saio/bin/resetswift @@ -0,0 +1,17 @@ +#!/bin/bash + +swift-init all stop +# Remove the following line if you did not set up rsyslog for individual logging: +sudo find /var/log/swift -type f -exec rm -f {} \; +sudo umount /mnt/sdb1 +# If you are using a loopback device substitute "/dev/sdb1" with "/srv/swift-disk" +sudo mkfs.xfs -f /dev/sdb1 +sudo mount /mnt/sdb1 +sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4 +sudo chown ${USER}:${USER} /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 {} \; +# On Fedora use "systemctl restart " +sudo service rsyslog restart +sudo service memcached restart diff --git a/doc/saio/bin/startmain b/doc/saio/bin/startmain new file mode 100755 index 0000000000..0098b58702 --- /dev/null +++ b/doc/saio/bin/startmain @@ -0,0 +1,3 @@ +#!/bin/bash + +swift-init main start \ No newline at end of file diff --git a/doc/saio/bin/startrest b/doc/saio/bin/startrest new file mode 100755 index 0000000000..0c229cab94 --- /dev/null +++ b/doc/saio/bin/startrest @@ -0,0 +1,3 @@ +#!/bin/bash + +swift-init rest start \ No newline at end of file diff --git a/doc/saio/rsyncd.conf b/doc/saio/rsyncd.conf new file mode 100644 index 0000000000..1ff40af607 --- /dev/null +++ b/doc/saio/rsyncd.conf @@ -0,0 +1,77 @@ +uid = +gid = +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/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 diff --git a/doc/saio/rsyslog.d/10-swift.conf b/doc/saio/rsyslog.d/10-swift.conf new file mode 100644 index 0000000000..e0a5624340 --- /dev/null +++ b/doc/saio/rsyslog.d/10-swift.conf @@ -0,0 +1,30 @@ +# Uncomment the following to have a log containing all logs together +#local1,local2,local3,local4,local5.* /var/log/swift/all.log + +# 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 + +local1.*;local1.!notice /var/log/swift/proxy.log +local1.notice /var/log/swift/proxy.error +local1.* ~ + +local2.*;local2.!notice /var/log/swift/storage1.log +local2.notice /var/log/swift/storage1.error +local2.* ~ + +local3.*;local3.!notice /var/log/swift/storage2.log +local3.notice /var/log/swift/storage2.error +local3.* ~ + +local4.*;local4.!notice /var/log/swift/storage3.log +local4.notice /var/log/swift/storage3.error +local4.* ~ + +local5.*;local5.!notice /var/log/swift/storage4.log +local5.notice /var/log/swift/storage4.error +local5.* ~ + +local6.*;local6.!notice /var/log/swift/expirer.log +local6.notice /var/log/swift/expirer.error +local6.* ~ diff --git a/doc/saio/swift/account-server/1.conf b/doc/saio/swift/account-server/1.conf new file mode 100644 index 0000000000..116787f8cf --- /dev/null +++ b/doc/saio/swift/account-server/1.conf @@ -0,0 +1,26 @@ +[DEFAULT] +devices = /srv/1/node +mount_check = false +disable_fallocate = true +bind_port = 6012 +workers = 1 +user = +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] diff --git a/doc/saio/swift/account-server/2.conf b/doc/saio/swift/account-server/2.conf new file mode 100644 index 0000000000..7ba4c1f92f --- /dev/null +++ b/doc/saio/swift/account-server/2.conf @@ -0,0 +1,26 @@ +[DEFAULT] +devices = /srv/2/node +mount_check = false +disable_fallocate = true +bind_port = 6022 +workers = 1 +user = +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] diff --git a/doc/saio/swift/account-server/3.conf b/doc/saio/swift/account-server/3.conf new file mode 100644 index 0000000000..882397d95d --- /dev/null +++ b/doc/saio/swift/account-server/3.conf @@ -0,0 +1,26 @@ +[DEFAULT] +devices = /srv/3/node +mount_check = false +disable_fallocate = true +bind_port = 6032 +workers = 1 +user = +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] diff --git a/doc/saio/swift/account-server/4.conf b/doc/saio/swift/account-server/4.conf new file mode 100644 index 0000000000..6e1d1ae437 --- /dev/null +++ b/doc/saio/swift/account-server/4.conf @@ -0,0 +1,26 @@ +[DEFAULT] +devices = /srv/4/node +mount_check = false +disable_fallocate = true +bind_port = 6042 +workers = 1 +user = +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] diff --git a/doc/saio/swift/container-server/1.conf b/doc/saio/swift/container-server/1.conf new file mode 100644 index 0000000000..1e30ea98a1 --- /dev/null +++ b/doc/saio/swift/container-server/1.conf @@ -0,0 +1,28 @@ +[DEFAULT] +devices = /srv/1/node +mount_check = false +disable_fallocate = true +bind_port = 6011 +workers = 1 +user = +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] diff --git a/doc/saio/swift/container-server/2.conf b/doc/saio/swift/container-server/2.conf new file mode 100644 index 0000000000..842a6fad34 --- /dev/null +++ b/doc/saio/swift/container-server/2.conf @@ -0,0 +1,28 @@ +[DEFAULT] +devices = /srv/2/node +mount_check = false +disable_fallocate = true +bind_port = 6021 +workers = 1 +user = +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] diff --git a/doc/saio/swift/container-server/3.conf b/doc/saio/swift/container-server/3.conf new file mode 100644 index 0000000000..a609ccbee8 --- /dev/null +++ b/doc/saio/swift/container-server/3.conf @@ -0,0 +1,28 @@ +[DEFAULT] +devices = /srv/3/node +mount_check = false +disable_fallocate = true +bind_port = 6031 +workers = 1 +user = +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] diff --git a/doc/saio/swift/container-server/4.conf b/doc/saio/swift/container-server/4.conf new file mode 100644 index 0000000000..528e8ab479 --- /dev/null +++ b/doc/saio/swift/container-server/4.conf @@ -0,0 +1,28 @@ +[DEFAULT] +devices = /srv/4/node +mount_check = false +disable_fallocate = true +bind_port = 6041 +workers = 1 +user = +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] diff --git a/doc/saio/swift/object-expirer.conf b/doc/saio/swift/object-expirer.conf new file mode 100644 index 0000000000..5610f69afd --- /dev/null +++ b/doc/saio/swift/object-expirer.conf @@ -0,0 +1,59 @@ +[DEFAULT] +# swift_dir = /etc/swift +user = +# You can specify default log routing here if you want: +log_name = object-expirer +log_facility = LOG_LOCAL6 +log_level = INFO +#log_address = /dev/log +# +# comma separated list of functions to call to setup custom log handlers. +# functions get passed: conf, name, log_to_console, log_route, fmt, logger, +# adapted_logger +# log_custom_handlers = +# +# If set, log_udp_host will override log_address +# log_udp_host = +# log_udp_port = 514 +# +# You can enable StatsD logging here: +# log_statsd_host = localhost +# log_statsd_port = 8125 +# log_statsd_default_sample_rate = 1.0 +# log_statsd_sample_rate_factor = 1.0 +# log_statsd_metric_prefix = + +[object-expirer] +interval = 300 +# auto_create_account_prefix = . +# report_interval = 300 +# concurrency is the level of concurrency o use to do the work, this value +# must be set to at least 1 +# concurrency = 1 +# processes is how many parts to divide the work into, one part per process +# that will be doing the work +# processes set 0 means that a single process will be doing all the work +# processes can also be specified on the command line and will override the +# config value +# processes = 0 +# process is which of the parts a particular process will work on +# process can also be specified on the command line and will overide the config +# value +# process is "zero based", if you want to use 3 processes, you should run +# processes with process set to 0, 1, and 2 +# process = 0 + +[pipeline:main] +pipeline = catch_errors cache proxy-server + +[app:proxy-server] +use = egg:swift#proxy +# See proxy-server.conf-sample for options + +[filter:cache] +use = egg:swift#memcache +# See proxy-server.conf-sample for options + +[filter:catch_errors] +use = egg:swift#catch_errors +# See proxy-server.conf-sample for options diff --git a/doc/saio/swift/object-server/1.conf b/doc/saio/swift/object-server/1.conf new file mode 100644 index 0000000000..4d7b46e5cc --- /dev/null +++ b/doc/saio/swift/object-server/1.conf @@ -0,0 +1,26 @@ +[DEFAULT] +devices = /srv/1/node +mount_check = false +disable_fallocate = true +bind_port = 6010 +workers = 1 +user = +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] diff --git a/doc/saio/swift/object-server/2.conf b/doc/saio/swift/object-server/2.conf new file mode 100644 index 0000000000..0caea5e028 --- /dev/null +++ b/doc/saio/swift/object-server/2.conf @@ -0,0 +1,26 @@ +[DEFAULT] +devices = /srv/2/node +mount_check = false +disable_fallocate = true +bind_port = 6020 +workers = 1 +user = +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] diff --git a/doc/saio/swift/object-server/3.conf b/doc/saio/swift/object-server/3.conf new file mode 100644 index 0000000000..c200867d76 --- /dev/null +++ b/doc/saio/swift/object-server/3.conf @@ -0,0 +1,26 @@ +[DEFAULT] +devices = /srv/3/node +mount_check = false +disable_fallocate = true +bind_port = 6030 +workers = 1 +user = +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] diff --git a/doc/saio/swift/object-server/4.conf b/doc/saio/swift/object-server/4.conf new file mode 100644 index 0000000000..6c2d513d75 --- /dev/null +++ b/doc/saio/swift/object-server/4.conf @@ -0,0 +1,26 @@ +[DEFAULT] +devices = /srv/4/node +mount_check = false +disable_fallocate = true +bind_port = 6040 +workers = 1 +user = +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] diff --git a/doc/saio/swift/proxy-server.conf b/doc/saio/swift/proxy-server.conf new file mode 100644 index 0000000000..9b3c64920d --- /dev/null +++ b/doc/saio/swift/proxy-server.conf @@ -0,0 +1,59 @@ +[DEFAULT] +bind_port = 8080 +workers = 1 +user = +log_facility = LOG_LOCAL1 +eventlet_debug = true + +[pipeline:main] +# Yes, proxy-logging appears twice. This is so that +# middleware-originated requests get logged too. +pipeline = catch_errors healthcheck proxy-logging bulk ratelimit crossdomain slo cache tempurl tempauth staticweb account-quotas container-quotas proxy-logging proxy-server + +[filter:catch_errors] +use = egg:swift#catch_errors + +[filter:healthcheck] +use = egg:swift#healthcheck + +[filter:proxy-logging] +use = egg:swift#proxy_logging + +[filter:bulk] +use = egg:swift#bulk + +[filter:ratelimit] +use = egg:swift#ratelimit + +[filter:crossdomain] +use = egg:swift#crossdomain + +[filter:slo] +use = egg:swift#slo + +[filter:tempurl] +use = egg:swift#tempurl + +[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:staticweb] +use = egg:swift#staticweb + +[filter:account-quotas] +use = egg:swift#account_quotas + +[filter:container-quotas] +use = egg:swift#container_quotas + +[filter:cache] +use = egg:swift#memcache + +[app:proxy-server] +use = egg:swift#proxy +allow_account_management = true +account_autocreate = true diff --git a/doc/saio/swift/swift.conf b/doc/saio/swift/swift.conf new file mode 100644 index 0000000000..23e7279e98 --- /dev/null +++ b/doc/saio/swift/swift.conf @@ -0,0 +1,4 @@ +[swift-hash] +# random unique strings that can never change (DO NOT LOSE) +swift_hash_path_prefix = changeme +swift_hash_path_suffix = changeme diff --git a/doc/source/development_saio.rst b/doc/source/development_saio.rst index c60f6cfc4b..cdc0199ec1 100644 --- a/doc/source/development_saio.rst +++ b/doc/source/development_saio.rst @@ -6,49 +6,58 @@ SAIO - Swift All In One Instructions for setting up a development VM --------------------------------------------- -This section documents setting up a virtual machine for doing Swift development. -The virtual machine will emulate running a four node Swift cluster. +This section documents setting up a virtual machine for doing Swift +development. The virtual machine will emulate running a four node Swift +cluster. -* Get an Ubuntu 12.04 LTS (Precise Pangolin) server image or try something Fedora/CentOS. +* Get an Ubuntu 12.04 LTS (Precise Pangolin) server image or try something + Fedora/CentOS. * Create guest virtual machine from the image. -Additional information about setting up a Swift development snapshot on other distributions is -available on the wiki at http://wiki.openstack.org/SAIOInstructions. +Additional information about setting up a Swift development snapshot on other +distributions is available on the wiki at +http://wiki.openstack.org/SAIOInstructions. ---------------------------- What's in a ---------------------------- -Much of the configuration described in this guide requires escalated root -privileges; however, we assume that administrator logs in an unprivileged -user. Swift processes also run under a separate user and group, set by -configuration option, and refered as :. -The default user is `swift`, which may not exist on your system. +Much of the configuration described in this guide requires escalated +administrator (``root``) privileges; however, we assume that administrator logs +in as an unprivileged user and can use ``sudo`` to run privileged commands. -.. note:: - - The instructions in the first first half of this guide are expected to be - performed as the root user. +Swift processes also run under a separate user and group, set by configuration +option, and refered as ``:``. The default user +is ``swift``, which may not exist on your system. These instructions are +intended to allow a developer to use his/her username for +``:``. ----------------------- Installing dependencies ----------------------- -* On apt based systems, +* On ``apt`` based systems:: - #. `apt-get update` - #. `apt-get install curl gcc memcached rsync sqlite3 xfsprogs git-core libffi-dev 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` + sudo apt-get update + sudo apt-get install curl gcc memcached rsync sqlite3 xfsprogs \ + git-core libffi-dev python-setuptools + sudo 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 -* On yum based systems, +* On ``yum`` based systems:: - #. `yum install curl gcc memcached rsync sqlite xfsprogs git-core libffi-devel xinetd python-setuptools` - #. `yum install python-coverage python-devel python-nose python-simplejson - python-xattr python-eventlet python-greenlet python-pastedeploy - python-netifaces python-pip python-dnspython python-mock` + sudo yum update + sudo yum install curl gcc memcached rsync sqlite xfsprogs git-core \ + libffi-devel xinetd python-setuptools \ + python-coverage python-devel python-nose \ + python-simplejson pyxattr python-eventlet \ + python-greenlet python-paste-deploy \ + python-netifaces python-pip python-dns \ + python-mock This installs necessary system dependencies; and *most* of the python dependencies. Later in the process setuptools/distribute or pip will @@ -63,27 +72,32 @@ Using a partition for storage ============================= If you are going to use a separate partition for Swift data, be sure to add -another device when creating the VM, and follow these instructions. +another device when creating the VM, and follow these instructions: - #. `fdisk /dev/sdb` (set up a single partition) - #. `mkfs.xfs /dev/sdb1` - #. Edit `/etc/fstab` and add - `/dev/sdb1 /mnt/sdb1 xfs 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 : /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 : /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`):: + #. Set up a single partition:: - 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 - #. Next, skip to :ref:`rsync-section`. + sudo fdisk /dev/sdb + sudo mkfs.xfs /dev/sdb1 + + #. Edit ``/etc/fstab`` and add:: + + /dev/sdb1 /mnt/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0 + + #. Create the mount point and the individualized links:: + + sudo mkdir /mnt/sdb1 + sudo mount /mnt/sdb1 + sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4 + sudo chown ${USER}:${USER} /mnt/sdb1/* + sudo mkdir /srv + for x in {1..4}; do sudo ln -s /mnt/sdb1/$x /srv/$x; done + sudo mkdir -p /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 \ + /srv/4/node/sdb4 /var/run/swift + sudo chown -R ${USER}:${USER} /var/run/swift + # **Make sure to include the trailing slash after /srv/$x/** + for x in {1..4}; do sudo chown -R ${USER}:${USER} /srv/$x/; done + + #. Next, skip to :ref:`common-dev-section`. .. _loopback-section: @@ -91,160 +105,160 @@ another device when creating the VM, and follow these instructions. Using a loopback device for storage =================================== -If you want to use a loopback device instead of another partition, follow these instructions. +If you want to use a loopback device instead of another partition, follow +these instructions: - #. `mkdir /srv` - #. `truncate -s 1GB /srv/swift-disk` - (modify size to make a larger or smaller partition) - #. `mkfs.xfs /srv/swift-disk` - #. Edit `/etc/fstab` and add - `/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 : /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` - #. `chown -R : /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`):: + #. Create the file for the loopback device:: + + sudo mkdir /srv + sudo truncate -s 1GB /srv/swift-disk + sudo mkfs.xfs /srv/swift-disk + + Modify size specified in the ``truncate`` command to make a larger or + smaller partition as needed. + + #. Edit `/etc/fstab` and add:: + + /srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0 + + #. Create the mount point and the individualized links:: + + sudo mkdir /mnt/sdb1 + sudo mount /mnt/sdb1 + sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4 + sudo chown ${USER}:${USER} /mnt/sdb1/* + for x in {1..4}; do sudo ln -s /mnt/sdb1/$x /srv/$x; done + sudo mkdir -p /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/swift + sudo chown -R ${USER}:${USER} /var/run/swift + # **Make sure to include the trailing slash after /srv/$x/** + for x in {1..4}; do sudo chown -R ${USER}:${USER} /srv/$x/; done + + +.. _common-dev-section: + +Common Post-Device Setup +======================== + +Add the following lines to ``/etc/rc.local`` (before the ``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 - Note that on some systems you might have to create `/etc/rc.local`. +Note that on some systems you might have to create ``/etc/rc.local``. - On Fedora 19 or later, you need to place these in `/etc/rc.d/rc.local`. +On Fedora 19 or later, you need to place these in ``/etc/rc.d/rc.local``. -.. _rsync-section: +---------------- +Getting the code +---------------- + + #. Check out the python-swiftclient repo:: + + cd $HOME; git clone https://github.com/openstack/python-swiftclient.git + + #. Build a development installation of python-swiftclient:: + + cd $HOME/python-swiftclient; sudo python setup.py develop; cd - + + #. Check out the swift repo:: + + git clone https://github.com/openstack/swift.git + + #. Build a development installation of swift:: + + cd $HOME/swift; sudo python setup.py develop; cd - + + Fedora 19 or later users might have to perform the following if development + installation of swift fails:: + + sudo pip install -U xattr + + #. Install swift's test dependencies:: + + sudo pip install -r swift/test-requirements.txt ---------------- Setting up rsync ---------------- - #. Create /etc/rsyncd.conf:: + #. Create ``/etc/rsyncd.conf``:: - uid = - gid = - log file = /var/log/rsyncd.log - pid file = /var/run/rsyncd.pid - address = 127.0.0.1 + sudo cp $HOME/swift/doc/saio/rsyncd.conf /etc/ + sudo sed -i "s//${USER}/" /etc/rsyncd.conf - [account6012] - max connections = 25 - path = /srv/1/node/ - read only = false - lock file = /var/lock/account6012.lock + Here is the default ``rsyncd.conf`` file contents maintained in the repo + that is copied and fixed up above: - [account6022] - max connections = 25 - path = /srv/2/node/ - read only = false - lock file = /var/lock/account6022.lock + .. literalinclude:: /../saio/rsyncd.conf - [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 - - #. On Ubuntu, edit the following line in `/etc/default/rsync`:: + #. On Ubuntu, edit the following line in ``/etc/default/rsync``:: RSYNC_ENABLE=true - On Fedora, edit the following line in `/etc/xinetd.d/rsync`:: + On Fedora, edit the following line in ``/etc/xinetd.d/rsync``:: disable = no - #. On platforms with SELinux in `Enforcing` mode, either set to `Permissive`:: + One might have to create the above files to perform the edits. - setenforce Permissive + #. On platforms with SELinux in ``Enforcing`` mode, either set to ``Permissive``:: + + sudo setenforce Permissive Or just allow rsync full access:: - setsebool -P rsync_full_access 1 + sudo setsebool -P rsync_full_access 1 - #. On Ubuntu, run `service rsync restart` + #. Start the rsync daemon - On Fedora, run:: + * On Ubuntu, run:: - systemctl enable rsyncd.service - systemctl start rsyncd.service + sudo service rsync restart - On other xinetd based systems run `service xinetd restart`. + * On Fedora, run:: + + sudo systemctl restart xinetd.service + sudo systemctl enable rsyncd.service + sudo systemctl start rsyncd.service + + * On other xinetd based systems simply run:: + + sudo service xinetd restart #. Verify rsync is accepting connections for all servers:: rsync rsync://pub@localhost/ + You should see the following output from the above command:: + + account6012 + account6022 + account6032 + account6042 + container6011 + container6021 + container6031 + container6041 + object6010 + object6020 + object6030 + object6040 + ------------------ Starting memcached ------------------ -On non-Ubuntu distros you need to ensure memcached is running: +On non-Ubuntu distros you need to ensure memcached is running:: - * `service memcached start` - * `chkconfig memcached on` + sudo service memcached start + sudo chkconfig memcached on -or: +or:: - * `systemctl enable memcached.service` - * `systemctl start memcached.service` + sudo systemctl enable memcached.service + sudo systemctl start memcached.service The tempauth middleware stores tokens in memcached. If memcached is not running, tokens cannot be validated, and accessing Swift becomes impossible. @@ -253,624 +267,252 @@ running, tokens cannot be validated, and accessing Swift becomes impossible. Optional: Setting up rsyslog for individual logging --------------------------------------------------- - #. Create /etc/rsyslog.d/10-swift.conf:: + #. Install the swift rsyslogd configuration:: - # Uncomment the following to have a log containing all logs together - #local1,local2,local3,local4,local5.* /var/log/swift/all.log + sudo cp $HOME/swift/doc/saio/rsyslog.d/10-swift.conf /etc/rsyslog.d/ - # 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 + Be sure to review that conf file to determine if you want all the logs + in one file vs. all the logs separated out, and if you want hourly logs + for stats processing. For convenience, we provide its default contents + below: - local1.*;local1.!notice /var/log/swift/proxy.log - local1.notice /var/log/swift/proxy.error - local1.* ~ + .. literalinclude:: /../saio/rsyslog.d/10-swift.conf - local2.*;local2.!notice /var/log/swift/storage1.log - local2.notice /var/log/swift/storage1.error - local2.* ~ + #. Edit ``/etc/rsyslog.conf`` and make the following change (usually in the + "GLOBAL DIRECTIVES" section):: - local3.*;local3.!notice /var/log/swift/storage2.log - local3.notice /var/log/swift/storage2.error - local3.* ~ + $PrivDropToGroup adm - local4.*;local4.!notice /var/log/swift/storage3.log - local4.notice /var/log/swift/storage3.error - local4.* ~ + #. If using hourly logs (see above) perform:: - local5.*;local5.!notice /var/log/swift/storage4.log - local5.notice /var/log/swift/storage4.error - local5.* ~ + sudo mkdir -p /var/log/swift/hourly - #. Edit /etc/rsyslog.conf and make the following change:: + Otherwise perform:: - $PrivDropToGroup adm + sudo mkdir -p /var/log/swift - #. `mkdir -p /var/log/swift/hourly` + #. Setup the logging directory and start syslog: - #. On Ubuntu: + * On Ubuntu:: - #. `chown -R syslog.adm /var/log/swift` - #. `chmod -R g+w /var/log/swift` - #. `service rsyslog restart` + sudo chown -R syslog.adm /var/log/swift + sudo chmod -R g+w /var/log/swift + sudo service rsyslog restart - #. On Fedora: - #. `chown -R root:adm /var/log/swift` - #. `chmod -R g+w /var/log/swift` - #. `systemctl restart rsyslog.service` + * On Fedora:: - -.. note:: - - Starting here, from this point on, all instructions are expected to be - performed as the unprivledged user you selected as . - - ----------------- -Getting the code ----------------- - - #. Check out the python-swiftclient repo - `git clone https://github.com/openstack/python-swiftclient.git` - #. Build a development installation of python-swiftclient - `cd ~/python-swiftclient; sudo python setup.py develop; cd -` - #. Check out the swift repo - `git clone https://github.com/openstack/swift.git` - #. Build a development installation of swift - `cd ~/swift; sudo python setup.py develop; cd -` - #. Install swift's test dependencies - `sudo pip install -r swift/test-requirements.txt` - -Fedora 19 or later users might have to perform the following if development -installation of swift fails:: - - sudo pip install -U xattr dnspython + sudo chown -R root:adm /var/log/swift + sudo chmod -R g+w /var/log/swift + sudo systemctl restart rsyslog.service --------------------- Configuring each node --------------------- -Sample configuration files are provided with all defaults in line-by-line comments. +After performing the following steps, be sure to verify that Swift has access +to resulting configuration files (sample configuration files are provided with +all defaults in line-by-line comments). - #. Create `/etc/swift/proxy-server.conf`:: + #. Optionally remove an existing swift directory:: - [DEFAULT] - bind_port = 8080 - workers = 1 - user = - log_facility = LOG_LOCAL1 - eventlet_debug = true + sudo rm -rf /etc/swift - [pipeline:main] - # Yes, proxy-logging appears twice. This is so that - # middleware-originated requests get logged too. - pipeline = catch_errors healthcheck proxy-logging bulk ratelimit crossdomain slo cache tempurl tempauth staticweb account-quotas container-quotas proxy-logging proxy-server + #. Populate the ``/etc/swift`` directory itself:: - [filter:catch_errors] - use = egg:swift#catch_errors + cd $HOME/swift/doc; sudo cp -r saio/swift /etc/swift; cd - + sudo chown -R ${USER}:${USER} /etc/swift - [filter:healthcheck] - use = egg:swift#healthcheck + #. Update ```` references in the Swift config files:: - [filter:proxy-logging] - use = egg:swift#proxy_logging + find /etc/swift/ -name \*.conf | xargs sudo sed -i "s//${USER}/" - [filter:bulk] - use = egg:swift#bulk +The contents of the configuration files provided by executing the above +commands are as follows: - [filter:ratelimit] - use = egg:swift#ratelimit + #. ``/etc/swift/swift.conf`` - [filter:crossdomain] - use = egg:swift#crossdomain + .. literalinclude:: /../saio/swift/swift.conf - [filter:slo] - use = egg:swift#slo + #. ``/etc/swift/proxy-server.conf`` - [filter:tempurl] - use = egg:swift#tempurl + .. literalinclude:: /../saio/swift/proxy-server.conf - [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 + #. ``/etc/swift/object-expirer.conf`` - [filter:staticweb] - use = egg:swift#staticweb + .. literalinclude:: /../saio/swift/object-expirer.conf - [filter:account-quotas] - use = egg:swift#account_quotas + #. ``/etc/swift/account-server/1.conf`` - [filter:container-quotas] - use = egg:swift#container_quotas + .. literalinclude:: /../saio/swift/account-server/1.conf - [filter:cache] - use = egg:swift#memcache + #. ``/etc/swift/container-server/1.conf`` - [app:proxy-server] - use = egg:swift#proxy - allow_account_management = true - account_autocreate = true + .. literalinclude:: /../saio/swift/container-server/1.conf - #. Create `/etc/swift/swift.conf`:: + #. ``/etc/swift/object-server/1.conf`` - [swift-hash] - # random unique strings that can never change (DO NOT LOSE) - swift_hash_path_prefix = changeme - swift_hash_path_suffix = changeme + .. literalinclude:: /../saio/swift/object-server/1.conf - #. Create `/etc/swift/account-server/1.conf`:: + #. ``/etc/swift/account-server/2.conf`` - [DEFAULT] - devices = /srv/1/node - mount_check = false - disable_fallocate = true - bind_port = 6012 - workers = 1 - user = - log_facility = LOG_LOCAL2 - recon_cache_path = /var/cache/swift - eventlet_debug = true + .. literalinclude:: /../saio/swift/account-server/2.conf - [pipeline:main] - pipeline = recon account-server + #. ``/etc/swift/container-server/2.conf`` - [app:account-server] - use = egg:swift#account + .. literalinclude:: /../saio/swift/container-server/2.conf - [filter:recon] - use = egg:swift#recon + #. ``/etc/swift/object-server/2.conf`` - [account-replicator] - vm_test_mode = yes + .. literalinclude:: /../saio/swift/object-server/2.conf - [account-auditor] + #. ``/etc/swift/account-server/3.conf`` - [account-reaper] + .. literalinclude:: /../saio/swift/account-server/3.conf - #. Create `/etc/swift/account-server/2.conf`:: + #. ``/etc/swift/container-server/3.conf`` - [DEFAULT] - devices = /srv/2/node - mount_check = false - disable_fallocate = true - bind_port = 6022 - workers = 1 - user = - log_facility = LOG_LOCAL3 - recon_cache_path = /var/cache/swift2 - eventlet_debug = true + .. literalinclude:: /../saio/swift/container-server/3.conf - [pipeline:main] - pipeline = recon account-server + #. ``/etc/swift/object-server/3.conf`` - [app:account-server] - use = egg:swift#account + .. literalinclude:: /../saio/swift/object-server/3.conf - [filter:recon] - use = egg:swift#recon + #. ``/etc/swift/account-server/4.conf`` - [account-replicator] - vm_test_mode = yes + .. literalinclude:: /../saio/swift/account-server/4.conf - [account-auditor] + #. ``/etc/swift/container-server/4.conf`` - [account-reaper] + .. literalinclude:: /../saio/swift/container-server/4.conf - #. Create `/etc/swift/account-server/3.conf`:: + #. ``/etc/swift/object-server/4.conf`` - [DEFAULT] - devices = /srv/3/node - mount_check = false - disable_fallocate = true - bind_port = 6032 - workers = 1 - user = - 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 - workers = 1 - user = - 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 - workers = 1 - user = - 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 - workers = 1 - user = - 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 - workers = 1 - user = - 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 - workers = 1 - user = - 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 - workers = 1 - user = - 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 - workers = 1 - user = - 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 - workers = 1 - user = - 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 - workers = 1 - user = - 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] - - #. Update :: - - find /etc/swift/ -name \*.conf | xargs sed -i "s//${USER}/" + .. literalinclude:: /../saio/swift/object-server/4.conf ------------------------------------ Setting up scripts for running Swift ------------------------------------ - #. `mkdir ~/bin` + #. Copy the SAIO scripts resetting the environment:: - #. Create `~/bin/resetswift`. + cd $HOME/swift/doc; cp -r saio/bin $HOME/bin; cd - + chmod +x $HOME/bin/* - If you are using a loopback device substitute `/dev/sdb1` with - `/srv/swift-disk` in the `mkfs` step. + #. Edit the ``$HOME/bin/resetswift`` script - If you did not set up rsyslog for individual logging, remove the `find - /var/log/swift...` line. + If you are using a loopback device substitute ``/dev/sdb1`` with + ``/srv/swift-disk`` in the ``mkfs`` step:: - On Fedora, replace `service `` restart` with `systemctl restart ``.service`:: + sed -i "s/dev\/sdb1/srv\/swift-disk/" $HOME/bin/resetswift - #!/bin/bash + If you did not set up rsyslog for individual logging, remove the ``find + /var/log/swift...`` line:: - swift-init all stop - find /var/log/swift -type f -exec rm -f {} \; - sudo umount /mnt/sdb1 - sudo mkfs.xfs -f /dev/sdb1 - sudo mount /mnt/sdb1 - sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4 - sudo chown : /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 + sed -i "/find \/var\/log\/swift/d" $HOME/bin/resetswift - #. Create `~/bin/remakerings`:: + On Fedora, replace ``service restart`` with ``systemctl restart + .service``:: - #!/bin/bash + sed -i "s/service \(.*\) restart/systemctl restart \1.service/" $HOME/bin/resetswift - cd /etc/swift + #. Install the sample configuration file for running tests:: - rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz + cp $HOME/swift/test/sample.conf /etc/swift/test.conf - 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 + #. Add an environment variable for running tests below:: - #. Create `~/bin/startmain`:: + echo "export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf" >> $HOME/.bashrc - #!/bin/bash + #. Be sure that your ``PATH`` includes the ``bin`` directory:: - swift-init main start + echo "export PATH=${PATH}:$HOME/bin" >> $HOME/.bashrc - #. Create `~/bin/startrest`:: + #. Source the above environment variables into your current environment:: - #!/bin/bash + . $HOME/.bashrc - swift-init rest start + #. Construct the initial rings using the provided script:: - #. `chmod +x ~/bin/*` - #. Edit `~/.bashrc` and add to the end:: + remakerings - export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf - export PATH=${PATH}:~/bin + You can expect the ouptut from this command to produce the following:: - #. `. ~/.bashrc` + Device d0r1z1-127.0.0.1:6010R127.0.0.1:6010/sdb1_"" with 1.0 weight got id 0 + Device d1r1z2-127.0.0.1:6020R127.0.0.1:6020/sdb2_"" with 1.0 weight got id 1 + Device d2r1z3-127.0.0.1:6030R127.0.0.1:6030/sdb3_"" with 1.0 weight got id 2 + Device d3r1z4-127.0.0.1:6040R127.0.0.1:6040/sdb4_"" with 1.0 weight got id 3 + Reassigned 1024 (100.00%) partitions. Balance is now 0.00. + Device d0r1z1-127.0.0.1:6011R127.0.0.1:6011/sdb1_"" with 1.0 weight got id 0 + Device d1r1z2-127.0.0.1:6021R127.0.0.1:6021/sdb2_"" with 1.0 weight got id 1 + Device d2r1z3-127.0.0.1:6031R127.0.0.1:6031/sdb3_"" with 1.0 weight got id 2 + Device d3r1z4-127.0.0.1:6041R127.0.0.1:6041/sdb4_"" with 1.0 weight got id 3 + Reassigned 1024 (100.00%) partitions. Balance is now 0.00. + Device d0r1z1-127.0.0.1:6012R127.0.0.1:6012/sdb1_"" with 1.0 weight got id 0 + Device d1r1z2-127.0.0.1:6022R127.0.0.1:6022/sdb2_"" with 1.0 weight got id 1 + Device d2r1z3-127.0.0.1:6032R127.0.0.1:6032/sdb3_"" with 1.0 weight got id 2 + Device d3r1z4-127.0.0.1:6042R127.0.0.1:6042/sdb4_"" with 1.0 weight got id 3 + Reassigned 1024 (100.00%) partitions. Balance is now 0.00. - #. `remakerings` - #. `cp ~/swift/test/sample.conf /etc/swift/test.conf` - #. `~/swift/.unittests` - #. `startmain` (The ``Unable to increase file descriptor limit. Running as non-root?`` warnings are expected and ok.) - #. 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`` - #. Check that you can GET account: ``curl -v -H 'X-Auth-Token: ' `` - #. Check that `swift` works: `swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat` - #. `~/swift/.functests` (Note: functional tests will first delete - everything in the configured accounts.) - #. `~/swift/.probetests` (Note: probe tests will reset your - environment as they call `resetswift` for each test.) + #. Verify the unit tests run:: + + $HOME/swift/.unittests + + Note that the unit tests do not require any swift daemons running. + + #. Start the "main" Swift daemon processes (proxy, account, container, and + object):: + + startmain + + (The "``Unable to increase file descriptor limit. Running as non-root?``" + warnings are expected and ok.) + + #. 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 + + #. Check that you can ``GET`` account:: + + curl -v -H 'X-Auth-Token: ' + + #. Check that ``swift`` command provided by the python-swiftclient package works:: + + swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat + + #. Verify the functional tests run:: + + $HOME/swift/.functests + + (Note: functional tests will first delete everything in the configured + accounts.) + + #. Verify the probe tests run:: + + $HOME/swift/.probetests + + (Note: probe tests will reset your environment as they call ``resetswift`` + for each test.) ---------------- 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: +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: -#. 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 +#. 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). #. Make sure all of the server processes are running. For the base functionality, the Proxy, Account, Container, and Object servers should be running. #. If one of the servers are not running, and no errors are logged to syslog, 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 + ``swift-object-server /etc/swift/object-server/1.conf`` will start the object server. If there are problems not showing up in syslog, then you will likely see the traceback on startup. #. 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 + 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. + Open the file ``SWIFT_TEST_CONFIG_FILE`` points to, and change the + value of ``fake_syslog`` to ``True``.