2010-07-12 17:03:45 -05:00
|
|
|
=======================
|
|
|
|
SAIO - Swift All In One
|
|
|
|
=======================
|
|
|
|
|
2018-09-12 17:12:36 -06:00
|
|
|
.. note::
|
|
|
|
This guide assumes an existing Linux server. A physical machine or VM will
|
|
|
|
work. We recommend configuring it with at least 2GB of memory and 40GB of
|
|
|
|
storage space. We recommend using a VM in order to isolate Swift and its
|
|
|
|
dependencies from other projects you may be working on.
|
|
|
|
|
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
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
This section documents setting up a virtual machine for doing Swift
|
|
|
|
development. The virtual machine will emulate running a four node Swift
|
2015-06-26 10:57:35 +10:00
|
|
|
cluster. To begin:
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2017-08-14 09:11:35 +10:00
|
|
|
* Get a linux system server image, this guide will cover:
|
2017-11-17 13:30:08 +01:00
|
|
|
|
2017-09-12 02:21:41 +09:00
|
|
|
* Ubuntu 14.04, 16.04 LTS
|
2017-11-17 13:30:08 +01:00
|
|
|
* Fedora/CentOS
|
2017-08-14 09:11:35 +10:00
|
|
|
* OpenSuse
|
2010-08-20 20:02:58 -06:00
|
|
|
|
2017-11-17 13:30:08 +01:00
|
|
|
- Create guest virtual machine from the image.
|
2010-10-20 10:32:03 -05:00
|
|
|
|
2013-06-13 18:28:00 -06:00
|
|
|
----------------------------
|
|
|
|
What's in a <your-user-name>
|
|
|
|
----------------------------
|
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
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.
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
Swift processes also run under a separate user and group, set by configuration
|
2014-02-07 16:06:12 +08:00
|
|
|
option, and referenced as ``<your-user-name>:<your-group-name>``. The default user
|
2013-10-02 23:52:30 -04:00
|
|
|
is ``swift``, which may not exist on your system. These instructions are
|
|
|
|
intended to allow a developer to use his/her username for
|
|
|
|
``<your-user-name>:<your-group-name>``.
|
2013-06-13 18:28:00 -06:00
|
|
|
|
|
|
|
-----------------------
|
|
|
|
Installing dependencies
|
|
|
|
-----------------------
|
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
* On ``apt`` based systems::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install curl gcc memcached rsync sqlite3 xfsprogs \
|
2016-01-12 16:42:06 -08:00
|
|
|
git-core libffi-dev python-setuptools \
|
2016-07-07 18:35:48 +01:00
|
|
|
liberasurecode-dev libssl-dev
|
2013-10-02 23:52:30 -04:00
|
|
|
sudo apt-get install python-coverage python-dev python-nose \
|
2015-10-30 11:02:54 -07:00
|
|
|
python-xattr python-eventlet \
|
2013-10-02 23:52:30 -04:00
|
|
|
python-greenlet python-pastedeploy \
|
|
|
|
python-netifaces python-pip python-dnspython \
|
|
|
|
python-mock
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
* On ``yum`` based systems::
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
sudo yum update
|
|
|
|
sudo yum install curl gcc memcached rsync sqlite xfsprogs git-core \
|
2016-01-12 16:42:06 -08:00
|
|
|
libffi-devel xinetd liberasurecode-devel \
|
2016-07-07 18:35:48 +01:00
|
|
|
openssl-devel python-setuptools \
|
2013-10-02 23:52:30 -04:00
|
|
|
python-coverage python-devel python-nose \
|
2015-10-30 11:02:54 -07:00
|
|
|
pyxattr python-eventlet \
|
2013-10-02 23:52:30 -04:00
|
|
|
python-greenlet python-paste-deploy \
|
|
|
|
python-netifaces python-pip python-dns \
|
|
|
|
python-mock
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2017-08-14 09:11:35 +10:00
|
|
|
* On ``OpenSuse``::
|
|
|
|
|
|
|
|
sudo zypper install curl gcc memcached rsync sqlite3 xfsprogs git-core \
|
|
|
|
libffi-devel liberasurecode-devel python2-setuptools \
|
|
|
|
libopenssl-devel
|
|
|
|
sudo zypper install python2-coverage python-devel python2-nose \
|
|
|
|
python-xattr python-eventlet python2-greenlet \
|
|
|
|
python2-netifaces python2-pip python2-dnspython \
|
|
|
|
python2-mock
|
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. note::
|
|
|
|
This installs necessary system dependencies and *most* of the python
|
|
|
|
dependencies. Later in the process setuptools/distribute or pip will install
|
|
|
|
and/or upgrade packages.
|
2012-02-22 08:19:37 -07:00
|
|
|
|
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
|
2013-10-02 23:52:30 -04:00
|
|
|
another device when creating the VM, and follow these instructions:
|
2013-09-26 15:47:36 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Set up a single partition::
|
2013-09-26 15:47:36 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo fdisk /dev/sdb
|
|
|
|
sudo mkfs.xfs /dev/sdb1
|
2013-09-26 15:47:36 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Edit ``/etc/fstab`` and add::
|
2013-09-26 15:47:36 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
/dev/sdb1 /mnt/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Create the mount point and the individualized links::
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
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/1/node/sdb5 \
|
|
|
|
/srv/2/node/sdb2 /srv/2/node/sdb6 \
|
|
|
|
/srv/3/node/sdb3 /srv/3/node/sdb7 \
|
|
|
|
/srv/4/node/sdb4 /srv/4/node/sdb8 \
|
|
|
|
/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
|
2012-02-22 08:19:37 -07:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. note::
|
|
|
|
For OpenSuse users, a user's primary group is ``users``, so you have 2 options:
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
* Change ``${USER}:${USER}`` to ``${USER}:users`` in all references of this guide; or
|
|
|
|
* Create a group for your username and add yourself to it::
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo groupadd ${USER} && sudo gpasswd -a ${USER} ${USER}
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. note::
|
|
|
|
We create the mount points and mount the storage disk under
|
|
|
|
/mnt/sdb1. This disk will contain one directory per simulated swift node,
|
|
|
|
each owned by the current swift user.
|
2015-07-27 14:19:09 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
We then create symlinks to these directories under /srv.
|
|
|
|
If the disk sdb is unmounted, files will not be written under
|
|
|
|
/srv/\*, because the symbolic link destination /mnt/sdb1/* will not
|
|
|
|
exist. This prevents disk sync operations from writing to the root
|
|
|
|
partition in the event a drive is unmounted.
|
2015-07-27 14:19:09 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Next, skip to :ref:`common-dev-section`.
|
2011-02-04 14:20:09 -06:00
|
|
|
|
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
.. _loopback-section:
|
2011-02-07 14:45:38 -06:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
Using a loopback device for storage
|
|
|
|
===================================
|
2011-02-14 16:56:40 -06:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
If you want to use a loopback device instead of another partition, follow
|
|
|
|
these instructions:
|
2011-02-04 14:20:09 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Create the file for the loopback device::
|
2011-02-04 14:20:09 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo mkdir /srv
|
|
|
|
sudo truncate -s 1GB /srv/swift-disk
|
|
|
|
sudo mkfs.xfs /srv/swift-disk
|
2011-02-04 14:20:09 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
Modify size specified in the ``truncate`` command to make a larger or
|
|
|
|
smaller partition as needed.
|
2011-02-04 14:20:09 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Edit `/etc/fstab` and add::
|
2011-02-04 14:20:09 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
/srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0
|
2012-02-28 12:20:49 -03:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Create the mount point and the individualized links::
|
2011-02-14 16:56:40 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
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/1/node/sdb5 \
|
|
|
|
/srv/2/node/sdb2 /srv/2/node/sdb6 \
|
|
|
|
/srv/3/node/sdb3 /srv/3/node/sdb7 \
|
|
|
|
/srv/4/node/sdb4 /srv/4/node/sdb8 \
|
|
|
|
/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
|
2013-09-26 15:47:36 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. note::
|
|
|
|
For OpenSuse users, a user's primary group is ``users``, so you have 2 options:
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
* Change ``${USER}:${USER}`` to ``${USER}:users`` in all references of this guide; or
|
|
|
|
* Create a group for your username and add yourself to it::
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo groupadd ${USER} && sudo gpasswd -a ${USER} ${USER}
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. note::
|
|
|
|
We create the mount points and mount the loopback file under
|
|
|
|
/mnt/sdb1. This file will contain one directory per simulated swift node,
|
|
|
|
each owned by the current swift user.
|
2015-07-27 14:19:09 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
We then create symlinks to these directories under /srv.
|
|
|
|
If the loopback file is unmounted, files will not be written under
|
|
|
|
/srv/\*, because the symbolic link destination /mnt/sdb1/* will not
|
|
|
|
exist. This prevents disk sync operations from writing to the root
|
|
|
|
partition in the event a drive is unmounted.
|
2013-09-26 15:47:36 -04:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
.. _common-dev-section:
|
2010-10-20 14:29:21 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
Common Post-Device Setup
|
|
|
|
========================
|
2013-09-26 15:47:36 -04:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
Add the following lines to ``/etc/rc.local`` (before the ``exit 0``)::
|
2013-10-02 11:39:35 -07:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4
|
|
|
|
chown <your-user-name>:<your-group-name> /var/cache/swift*
|
|
|
|
mkdir -p /var/run/swift
|
|
|
|
chown <your-user-name>:<your-group-name> /var/run/swift
|
2013-10-02 11:39:35 -07:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
Note that on some systems you might have to create ``/etc/rc.local``.
|
2013-10-02 11:39:35 -07:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
On Fedora 19 or later, you need to place these in ``/etc/rc.d/rc.local``.
|
2013-10-02 11:39:35 -07:00
|
|
|
|
2017-08-14 09:11:35 +10:00
|
|
|
On OpenSuse you need to place these in ``/etc/init.d/boot.local``.
|
|
|
|
|
Add checksum to object extended attributes
Currently, our integrity checking for objects is pretty weak when it
comes to object metadata. If the extended attributes on a .data or
.meta file get corrupted in such a way that we can still unpickle it,
we don't have anything that detects that.
This could be especially bad with encrypted etags; if the encrypted
etag (X-Object-Sysmeta-Crypto-Etag or whatever it is) gets some bits
flipped, then we'll cheerfully decrypt the cipherjunk into plainjunk,
then send it to the client. Net effect is that the client sees a GET
response with an ETag that doesn't match the MD5 of the object *and*
Swift has no way of detecting and quarantining this object.
Note that, with an unencrypted object, if the ETag metadatum gets
mangled, then the object will be quarantined by the object server or
auditor, whichever notices first.
As part of this commit, I also ripped out some mocking of
getxattr/setxattr in tests. It appears to be there to allow unit tests
to run on systems where /tmp doesn't support xattrs. However, since
the mock is keyed off of inode number and inode numbers get re-used,
there's lots of leakage between different test runs. On a real FS,
unlinking a file and then creating a new one of the same name will
also reset the xattrs; this isn't the case with the mock.
The mock was pretty old; Ubuntu 12.04 and up all support xattrs in
/tmp, and recent Red Hat / CentOS releases do too. The xattr mock was
added in 2011; maybe it was to support Ubuntu Lucid Lynx?
Bonus: now you can pause a test with the debugger, inspect its files
in /tmp, and actually see the xattrs along with the data.
Since this patch now uses a real filesystem for testing filesystem
operations, tests are skipped if the underlying filesystem does not
support setting xattrs (eg tmpfs or more than 4k of xattrs on ext4).
References to "/tmp" have been replaced with calls to
tempfile.gettempdir(). This will allow setting the TMPDIR envvar in
test setup and getting an XFS filesystem instead of ext4 or tmpfs.
THIS PATCH SIGNIFICANTLY CHANGES TESTING ENVIRONMENTS
With this patch, every test environment will require TMPDIR to be
using a filesystem that supports at least 4k of extended attributes.
Neither ext4 nor tempfs support this. XFS is recommended.
So why all the SkipTests? Why not simply raise an error? We still need
the tests to run on the base image for OpenStack's CI system. Since
we were previously mocking out xattr, there wasn't a problem, but we
also weren't actually testing anything. This patch adds functionality
to validate xattr data, so we need to drop the mock.
`test.unit.skip_if_no_xattrs()` is also imported into `test.functional`
so that functional tests can import it from the functional test
namespace.
The related OpenStack CI infrastructure changes are made in
https://review.openstack.org/#/c/394600/.
Co-Authored-By: John Dickinson <me@not.mn>
Change-Id: I98a37c0d451f4960b7a12f648e4405c6c6716808
2016-06-30 16:52:58 -07:00
|
|
|
Creating an XFS tmp dir
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
Tests require having an XFS directory available in ``/tmp`` or in the
|
|
|
|
``TMPDIR`` environment variable. To set up ``/tmp`` with an XFS filesystem,
|
|
|
|
do the following::
|
|
|
|
|
|
|
|
cd ~
|
|
|
|
truncate -s 1GB xfs_file # create 1GB fil for XFS in your home directory
|
|
|
|
mkfs.xfs xfs_file
|
|
|
|
sudo mount -o loop,noatime,nodiratime xfs_file /tmp
|
|
|
|
sudo chmod -R 1777 /tmp
|
|
|
|
|
|
|
|
To persist this, edit and add the following to ``/etc/fstab``::
|
|
|
|
|
2018-01-06 20:48:10 +00:00
|
|
|
/home/<your-user-name>/xfs_file /tmp xfs rw,noatime,nodiratime,attr2,inode64,noquota 0 0
|
Add checksum to object extended attributes
Currently, our integrity checking for objects is pretty weak when it
comes to object metadata. If the extended attributes on a .data or
.meta file get corrupted in such a way that we can still unpickle it,
we don't have anything that detects that.
This could be especially bad with encrypted etags; if the encrypted
etag (X-Object-Sysmeta-Crypto-Etag or whatever it is) gets some bits
flipped, then we'll cheerfully decrypt the cipherjunk into plainjunk,
then send it to the client. Net effect is that the client sees a GET
response with an ETag that doesn't match the MD5 of the object *and*
Swift has no way of detecting and quarantining this object.
Note that, with an unencrypted object, if the ETag metadatum gets
mangled, then the object will be quarantined by the object server or
auditor, whichever notices first.
As part of this commit, I also ripped out some mocking of
getxattr/setxattr in tests. It appears to be there to allow unit tests
to run on systems where /tmp doesn't support xattrs. However, since
the mock is keyed off of inode number and inode numbers get re-used,
there's lots of leakage between different test runs. On a real FS,
unlinking a file and then creating a new one of the same name will
also reset the xattrs; this isn't the case with the mock.
The mock was pretty old; Ubuntu 12.04 and up all support xattrs in
/tmp, and recent Red Hat / CentOS releases do too. The xattr mock was
added in 2011; maybe it was to support Ubuntu Lucid Lynx?
Bonus: now you can pause a test with the debugger, inspect its files
in /tmp, and actually see the xattrs along with the data.
Since this patch now uses a real filesystem for testing filesystem
operations, tests are skipped if the underlying filesystem does not
support setting xattrs (eg tmpfs or more than 4k of xattrs on ext4).
References to "/tmp" have been replaced with calls to
tempfile.gettempdir(). This will allow setting the TMPDIR envvar in
test setup and getting an XFS filesystem instead of ext4 or tmpfs.
THIS PATCH SIGNIFICANTLY CHANGES TESTING ENVIRONMENTS
With this patch, every test environment will require TMPDIR to be
using a filesystem that supports at least 4k of extended attributes.
Neither ext4 nor tempfs support this. XFS is recommended.
So why all the SkipTests? Why not simply raise an error? We still need
the tests to run on the base image for OpenStack's CI system. Since
we were previously mocking out xattr, there wasn't a problem, but we
also weren't actually testing anything. This patch adds functionality
to validate xattr data, so we need to drop the mock.
`test.unit.skip_if_no_xattrs()` is also imported into `test.functional`
so that functional tests can import it from the functional test
namespace.
The related OpenStack CI infrastructure changes are made in
https://review.openstack.org/#/c/394600/.
Co-Authored-By: John Dickinson <me@not.mn>
Change-Id: I98a37c0d451f4960b7a12f648e4405c6c6716808
2016-06-30 16:52:58 -07:00
|
|
|
|
2013-06-13 18:28:00 -06:00
|
|
|
----------------
|
|
|
|
Getting the code
|
|
|
|
----------------
|
2010-10-20 14:29:21 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Check out the python-swiftclient repo::
|
2012-02-28 12:20:49 -03:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
cd $HOME; git clone https://github.com/openstack/python-swiftclient.git
|
2010-10-20 14:29:21 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Build a development installation of python-swiftclient::
|
2012-02-28 12:20:49 -03:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
cd $HOME/python-swiftclient; sudo python setup.py develop; cd -
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
Ubuntu 12.04 users need to install python-swiftclient's dependencies before the installation of
|
|
|
|
python-swiftclient. This is due to a bug in an older version of setup tools::
|
2014-06-30 12:55:37 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
cd $HOME/python-swiftclient; sudo pip install -r requirements.txt; sudo python setup.py develop; cd -
|
2014-06-30 12:55:37 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Check out the swift repo::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
git clone https://github.com/openstack/swift.git
|
2012-02-28 12:20:49 -03:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Build a development installation of swift::
|
2013-09-24 16:46:45 -07:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
cd $HOME/swift; sudo pip install --no-binary cryptography -r requirements.txt; sudo python setup.py develop; cd -
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. note::
|
|
|
|
Due to a difference in how ``libssl.so`` is named in OpenSuse vs. other Linux distros the
|
|
|
|
wheel/binary won't work; thus we use ``--no-binary cryptography`` to build ``cryptography``
|
|
|
|
locally.
|
2013-09-24 16:46:45 -07:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
Fedora 19 or later users might have to perform the following if development
|
|
|
|
installation of swift fails::
|
2013-09-24 16:46:45 -07:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo pip install -U xattr
|
2013-09-24 16:46:45 -07:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Install swift's test dependencies::
|
2013-09-24 16:46:45 -07:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
cd $HOME/swift; sudo pip install -r test-requirements.txt
|
2013-09-24 16:46:45 -07:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
----------------
|
|
|
|
Setting up rsync
|
|
|
|
----------------
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Create ``/etc/rsyncd.conf``::
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo cp $HOME/swift/doc/saio/rsyncd.conf /etc/
|
|
|
|
sudo sed -i "s/<your-user-name>/${USER}/" /etc/rsyncd.conf
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
Here is the default ``rsyncd.conf`` file contents maintained in the repo
|
|
|
|
that is copied and fixed up above:
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/rsyncd.conf
|
|
|
|
:language: ini
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. On Ubuntu, edit the following line in ``/etc/default/rsync``::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
RSYNC_ENABLE=true
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
On Fedora, edit the following line in ``/etc/xinetd.d/rsync``::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
disable = no
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
One might have to create the above files to perform the edits.
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
On OpenSuse, nothing needs to happen here.
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. On platforms with SELinux in ``Enforcing`` mode, either set to ``Permissive``::
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo setenforce Permissive
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
Or just allow rsync full access::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo setsebool -P rsync_full_access 1
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Start the rsync daemon
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
* On Ubuntu 14.04, run::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo service rsync restart
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
* On Ubuntu 16.04, run::
|
2017-03-08 14:56:00 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo systemctl enable rsync
|
|
|
|
sudo systemctl start rsync
|
2017-03-08 14:56:00 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
* On Fedora, run::
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo systemctl restart xinetd.service
|
|
|
|
sudo systemctl enable rsyncd.service
|
|
|
|
sudo systemctl start rsyncd.service
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
* On OpenSuse, run::
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo systemctl enable rsyncd.service
|
|
|
|
sudo systemctl start rsyncd.service
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
* On other xinetd based systems simply run::
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo service xinetd restart
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Verify rsync is accepting connections for all servers::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
rsync rsync://pub@localhost/
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
You should see the following output from the above command::
|
2013-10-02 23:52:30 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
account6012
|
|
|
|
account6022
|
|
|
|
account6032
|
|
|
|
account6042
|
|
|
|
container6011
|
|
|
|
container6021
|
|
|
|
container6031
|
|
|
|
container6041
|
|
|
|
object6010
|
|
|
|
object6020
|
|
|
|
object6030
|
|
|
|
object6040
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
------------------
|
|
|
|
Starting memcached
|
|
|
|
------------------
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
On non-Ubuntu distros you need to ensure memcached is running::
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
sudo service memcached start
|
|
|
|
sudo chkconfig memcached on
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
or::
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
sudo systemctl enable memcached.service
|
|
|
|
sudo systemctl start memcached.service
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
The tempauth middleware stores tokens in memcached. If memcached is not
|
|
|
|
running, tokens cannot be validated, and accessing Swift becomes impossible.
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
---------------------------------------------------
|
|
|
|
Optional: Setting up rsyslog for individual logging
|
|
|
|
---------------------------------------------------
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Install the swift rsyslogd configuration::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo cp $HOME/swift/doc/saio/rsyslog.d/10-swift.conf /etc/rsyslog.d/
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
Note: OpenSuse may have the systemd logger installed, so if you want this
|
|
|
|
to work, you need to install rsyslog::
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo zypper install rsyslog
|
|
|
|
sudo systemctl start rsyslog.service
|
|
|
|
sudo systemctl enable rsyslog.service
|
2017-08-14 09:11:35 +10:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
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:
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/rsyslog.d/10-swift.conf
|
|
|
|
:language: ini
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Edit ``/etc/rsyslog.conf`` and make the following change (usually in the
|
|
|
|
"GLOBAL DIRECTIVES" section)::
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
$PrivDropToGroup adm
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. If using hourly logs (see above) perform::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo mkdir -p /var/log/swift/hourly
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
Otherwise perform::
|
2011-02-25 17:31:58 -08:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo mkdir -p /var/log/swift
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Setup the logging directory and start syslog:
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
* On Ubuntu::
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo chown -R syslog.adm /var/log/swift
|
|
|
|
sudo chmod -R g+w /var/log/swift
|
|
|
|
sudo service rsyslog restart
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
* On Fedora and OpenSuse::
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo chown -R root:adm /var/log/swift
|
|
|
|
sudo chmod -R g+w /var/log/swift
|
|
|
|
sudo systemctl restart rsyslog.service
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
---------------------
|
|
|
|
Configuring each node
|
|
|
|
---------------------
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
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).
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Optionally remove an existing swift directory::
|
2011-02-25 17:31:58 -08:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sudo rm -rf /etc/swift
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Populate the ``/etc/swift`` directory itself::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
cd $HOME/swift/doc; sudo cp -r saio/swift /etc/swift; cd -
|
|
|
|
sudo chown -R ${USER}:${USER} /etc/swift
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Update ``<your-user-name>`` references in the Swift config files::
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
find /etc/swift/ -name \*.conf | xargs sudo sed -i "s/<your-user-name>/${USER}/"
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
The contents of the configuration files provided by executing the above
|
|
|
|
commands are as follows:
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/swift.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/swift.conf
|
|
|
|
:language: ini
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/proxy-server.conf``
|
2011-02-25 17:31:58 -08:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/proxy-server.conf
|
|
|
|
:language: ini
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/object-expirer.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/object-expirer.conf
|
|
|
|
:language: ini
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/container-reconciler.conf``
|
2014-04-07 14:22:27 -07:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/container-reconciler.conf
|
|
|
|
:language: ini
|
2014-04-07 14:22:27 -07:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/container-sync-realms.conf``
|
2015-07-28 09:41:12 +03:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/container-sync-realms.conf
|
|
|
|
:language: ini
|
2015-07-28 09:41:12 +03:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/account-server/1.conf``
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/account-server/1.conf
|
|
|
|
:language: ini
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/container-server/1.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/container-server/1.conf
|
|
|
|
:language: ini
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/object-server/1.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/object-server/1.conf
|
|
|
|
:language: ini
|
2011-02-25 17:31:58 -08:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/account-server/2.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/account-server/2.conf
|
|
|
|
:language: ini
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/container-server/2.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/container-server/2.conf
|
|
|
|
:language: ini
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/object-server/2.conf``
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/object-server/2.conf
|
|
|
|
:language: ini
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/account-server/3.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/account-server/3.conf
|
|
|
|
:language: ini
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/container-server/3.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/container-server/3.conf
|
|
|
|
:language: ini
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/object-server/3.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/object-server/3.conf
|
|
|
|
:language: ini
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/account-server/4.conf``
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/account-server/4.conf
|
|
|
|
:language: ini
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/container-server/4.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/container-server/4.conf
|
|
|
|
:language: ini
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. ``/etc/swift/object-server/4.conf``
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/swift/object-server/4.conf
|
|
|
|
:language: ini
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2014-05-06 10:54:05 -04:00
|
|
|
.. _setup_scripts:
|
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
------------------------------------
|
|
|
|
Setting up scripts for running Swift
|
|
|
|
------------------------------------
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Copy the SAIO scripts for resetting the environment::
|
|
|
|
|
|
|
|
mkdir -p $HOME/bin
|
|
|
|
cd $HOME/swift/doc; cp saio/bin/* $HOME/bin; cd -
|
|
|
|
chmod +x $HOME/bin/*
|
|
|
|
|
|
|
|
#. Edit the ``$HOME/bin/resetswift`` script
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
The template ``resetswift`` script looks like the following:
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/bin/resetswift
|
|
|
|
:language: bash
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
If you are using a loopback device add an environment var to
|
|
|
|
substitute ``/dev/sdb1`` with ``/srv/swift-disk``::
|
2014-11-03 14:20:08 -08:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
echo "export SAIO_BLOCK_DEVICE=/srv/swift-disk" >> $HOME/.bashrc
|
2014-11-03 14:20:08 -08:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
If you did not set up rsyslog for individual logging, remove the ``find
|
|
|
|
/var/log/swift...`` line::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
sed -i "/find \/var\/log\/swift/d" $HOME/bin/resetswift
|
2010-07-12 17:03:45 -05:00
|
|
|
|
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Install the sample configuration file for running tests::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
cp $HOME/swift/test/sample.conf /etc/swift/test.conf
|
2014-04-10 14:36:43 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
The template ``test.conf`` looks like the following:
|
2010-08-20 02:19:50 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../../test/sample.conf
|
|
|
|
:language: ini
|
2012-07-13 17:13:53 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Add an environment variable for running tests below::
|
2014-04-10 14:36:43 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
echo "export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf" >> $HOME/.bashrc
|
2014-04-10 14:36:43 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Be sure that your ``PATH`` includes the ``bin`` directory::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
echo "export PATH=${PATH}:$HOME/bin" >> $HOME/.bashrc
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Source the above environment variables into your current environment::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
. $HOME/.bashrc
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Construct the initial rings using the provided script::
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
remakerings
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
The ``remakerings`` script looks like the following:
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/bin/remakerings
|
|
|
|
:language: bash
|
2013-09-26 15:47:36 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
You can expect the output from this command to produce the following. Note
|
|
|
|
that 3 object rings are created in order to test storage policies and EC in
|
|
|
|
the SAIO environment. The EC ring is the only one with all 8 devices.
|
|
|
|
There are also two replication rings, one for 3x replication and another
|
|
|
|
for 2x replication, but those rings only use 4 devices:
|
2014-04-10 14:36:43 -04:00
|
|
|
|
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. code-block:: console
|
2011-05-26 02:17:42 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
Device d0r1z1-127.0.0.1:6010R127.0.0.1:6010/sdb1_"" with 1.0 weight got id 0
|
|
|
|
Device d1r1z2-127.0.0.2:6020R127.0.0.2:6020/sdb2_"" with 1.0 weight got id 1
|
|
|
|
Device d2r1z3-127.0.0.3:6030R127.0.0.3:6030/sdb3_"" with 1.0 weight got id 2
|
|
|
|
Device d3r1z4-127.0.0.4:6040R127.0.0.4:6040/sdb4_"" with 1.0 weight got id 3
|
|
|
|
Reassigned 3072 (300.00%) partitions. Balance is now 0.00. Dispersion is now 0.00
|
|
|
|
Device d0r1z1-127.0.0.1:6010R127.0.0.1:6010/sdb1_"" with 1.0 weight got id 0
|
|
|
|
Device d1r1z2-127.0.0.2:6020R127.0.0.2:6020/sdb2_"" with 1.0 weight got id 1
|
|
|
|
Device d2r1z3-127.0.0.3:6030R127.0.0.3:6030/sdb3_"" with 1.0 weight got id 2
|
|
|
|
Device d3r1z4-127.0.0.4:6040R127.0.0.4:6040/sdb4_"" with 1.0 weight got id 3
|
|
|
|
Reassigned 2048 (200.00%) partitions. Balance is now 0.00. Dispersion is now 0.00
|
|
|
|
Device d0r1z1-127.0.0.1:6010R127.0.0.1:6010/sdb1_"" with 1.0 weight got id 0
|
|
|
|
Device d1r1z1-127.0.0.1:6010R127.0.0.1:6010/sdb5_"" with 1.0 weight got id 1
|
|
|
|
Device d2r1z2-127.0.0.2:6020R127.0.0.2:6020/sdb2_"" with 1.0 weight got id 2
|
|
|
|
Device d3r1z2-127.0.0.2:6020R127.0.0.2:6020/sdb6_"" with 1.0 weight got id 3
|
|
|
|
Device d4r1z3-127.0.0.3:6030R127.0.0.3:6030/sdb3_"" with 1.0 weight got id 4
|
|
|
|
Device d5r1z3-127.0.0.3:6030R127.0.0.3:6030/sdb7_"" with 1.0 weight got id 5
|
|
|
|
Device d6r1z4-127.0.0.4:6040R127.0.0.4:6040/sdb4_"" with 1.0 weight got id 6
|
|
|
|
Device d7r1z4-127.0.0.4:6040R127.0.0.4:6040/sdb8_"" with 1.0 weight got id 7
|
|
|
|
Reassigned 6144 (600.00%) partitions. Balance is now 0.00. Dispersion 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.2:6021R127.0.0.2:6021/sdb2_"" with 1.0 weight got id 1
|
|
|
|
Device d2r1z3-127.0.0.3:6031R127.0.0.3:6031/sdb3_"" with 1.0 weight got id 2
|
|
|
|
Device d3r1z4-127.0.0.4:6041R127.0.0.4:6041/sdb4_"" with 1.0 weight got id 3
|
|
|
|
Reassigned 3072 (300.00%) partitions. Balance is now 0.00. Dispersion 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.2:6022R127.0.0.2:6022/sdb2_"" with 1.0 weight got id 1
|
|
|
|
Device d2r1z3-127.0.0.3:6032R127.0.0.3:6032/sdb3_"" with 1.0 weight got id 2
|
|
|
|
Device d3r1z4-127.0.0.4:6042R127.0.0.4:6042/sdb4_"" with 1.0 weight got id 3
|
|
|
|
Reassigned 3072 (300.00%) partitions. Balance is now 0.00. Dispersion is now 0.00
|
2017-06-19 09:39:33 +10:00
|
|
|
|
2011-05-26 02:17:42 +00:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Read more about Storage Policies and your SAIO :doc:`policies_saio`
|
2014-04-07 14:22:27 -07:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Verify the unit tests run::
|
2012-02-28 12:20:49 -03:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
$HOME/swift/.unittests
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
Note that the unit tests do not require any swift daemons running.
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Start the "main" Swift daemon processes (proxy, account, container, and
|
|
|
|
object)::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
startmain
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
(The "``Unable to increase file descriptor limit. Running as non-root?``"
|
|
|
|
warnings are expected and ok.)
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
The ``startmain`` script looks like the following:
|
2014-04-10 14:36:43 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
.. literalinclude:: /../saio/bin/startmain
|
|
|
|
:language: bash
|
2014-04-10 14:36:43 -04:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Get an ``X-Storage-Url`` and ``X-Auth-Token``::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Check that you can ``GET`` account::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
curl -v -H 'X-Auth-Token: <token-from-x-auth-token-above>' <url-from-x-storage-url-above>
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Check that ``swift`` command provided by the python-swiftclient package works::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Verify the functional tests run::
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
$HOME/swift/.functests
|
2010-07-12 17:03:45 -05:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
(Note: functional tests will first delete everything in the configured
|
|
|
|
accounts.)
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
#. Verify the probe tests run::
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
$HOME/swift/.probetests
|
2013-06-13 18:28:00 -06:00
|
|
|
|
2019-03-04 17:37:09 -08:00
|
|
|
(Note: probe tests will reset your environment as they call ``resetswift``
|
|
|
|
for each test.)
|
2010-07-13 22:24:47 -05:00
|
|
|
|
|
|
|
----------------
|
|
|
|
Debugging Issues
|
|
|
|
----------------
|
|
|
|
|
2013-10-02 23:52:30 -04:00
|
|
|
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:
|
2010-07-13 22:24:47 -05:00
|
|
|
|
2013-10-02 23:52:30 -04: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
|
2013-02-18 10:54:27 -07:00
|
|
|
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:
|
2013-10-02 23:52:30 -04:00
|
|
|
``swift-object-server /etc/swift/object-server/1.conf`` will start the
|
2012-02-28 12:20:49 -03:00
|
|
|
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
|
2013-10-02 23:52:30 -04:00
|
|
|
useful for environments where ``/dev/log`` is unavailable, or which
|
2012-04-30 16:38:15 -04:00
|
|
|
cannot rate limit (unit tests generate a lot of logs very quickly).
|
2013-10-02 23:52:30 -04:00
|
|
|
Open the file ``SWIFT_TEST_CONFIG_FILE`` points to, and change the
|
|
|
|
value of ``fake_syslog`` to ``True``.
|
2016-01-25 10:03:18 -06:00
|
|
|
#. If you encounter a ``401 Unauthorized`` when following Step 12 where
|
|
|
|
you check that you can ``GET`` account, use ``sudo service memcached status``
|
|
|
|
and check if memcache is running. If memcache is not running, start it using
|
|
|
|
``sudo service memcached start``. Once memcache is running, rerun ``GET`` account.
|
2016-05-17 10:48:25 +10:00
|
|
|
|
|
|
|
------------
|
|
|
|
Known Issues
|
|
|
|
------------
|
|
|
|
|
|
|
|
Listed here are some "gotcha's" that you may run into when using or testing your SAIO:
|
|
|
|
|
|
|
|
#. fallocate_reserve - in most cases a SAIO doesn't have a very large XFS partition
|
|
|
|
so having fallocate enabled and fallocate_reserve set can cause issues, specifically
|
|
|
|
when trying to run the functional tests. For this reason fallocate has been turned
|
|
|
|
off on the object-servers in the SAIO. If you want to play with the fallocate_reserve
|
|
|
|
settings then know that functional tests will fail unless you change the max_file_size
|
|
|
|
constraint to something more reasonable then the default (5G). Ideally you'd make
|
|
|
|
it 1/4 of your XFS file system size so the tests can pass.
|