<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SAIO - Swift All In One — Swift v1.0.2 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '1.0.2', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="top" title="Swift v1.0.2 documentation" href="index.html" /> <link rel="next" title="Partitioned Consistent Hash Ring" href="ring.html" /> <link rel="prev" title="Development Guidelines" href="development_guidelines.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li> <li class="right" > <a href="ring.html" title="Partitioned Consistent Hash Ring" accesskey="N">next</a> |</li> <li class="right" > <a href="development_guidelines.html" title="Development Guidelines" accesskey="P">previous</a> |</li> <li><a href="index.html">Swift v1.0.2 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="saio-swift-all-in-one"> <h1>SAIO - Swift All In One<a class="headerlink" href="#saio-swift-all-in-one" title="Permalink to this headline">¶</a></h1> <div class="section" id="instructions-for-seting-up-a-dev-vm"> <h2>Instructions for seting up a dev VM<a class="headerlink" href="#instructions-for-seting-up-a-dev-vm" title="Permalink to this headline">¶</a></h2> <p>This documents setting up a virtual machine for doing Swift development. The virtual machine will emulate running a four node Swift cluster. It assumes you’re using <em>VMware Fusion 3</em> on <em>Mac OS X Snow Leopard</em>, but should give a good idea what to do on other environments.</p> <ul> <li><p class="first">Get the <em>Ubuntu 10.04 LTS (Lucid Lynx)</em> server image from: <a class="reference external" href="http://cdimage.ubuntu.com/releases/10.04/release/ubuntu-10.04-dvd-amd64.iso">http://cdimage.ubuntu.com/releases/10.04/release/ubuntu-10.04-dvd-amd64.iso</a></p> </li> <li><p class="first">Create guest virtual machine:</p> <ol class="arabic simple"> <li><cite>Continue without disc</cite></li> <li><cite>Use operating system installation disc image file</cite>, pick the .iso from above.</li> <li>Select <cite>Linux</cite> and <cite>Ubuntu 64-bit</cite>.</li> <li>Fill in the <em>Linux Easy Install</em> details.</li> <li><cite>Customize Settings</cite>, name the image whatever you want (<cite>SAIO</cite> for instance.)</li> <li>When the <cite>Settings</cite> window comes up, select <cite>Hard Disk</cite>, create an extra disk (the defaults are fine).</li> <li>Start the virtual machine up and wait for the easy install to finish.</li> </ol> </li> <li><p class="first">As root on guest (you’ll have to log in as you, then <cite>sudo su -</cite>):</p> <ol class="arabic"> <li><p class="first"><cite>apt-get install python-software-properties</cite></p> </li> <li><p class="first"><cite>add-apt-repository ppa:swift-core/ppa</cite></p> </li> <li><p class="first"><cite>apt-get update</cite></p> </li> <li><p class="first"><cite>apt-get install curl gcc bzr memcached python-configobj python-coverage python-dev python-nose python-setuptools python-simplejson python-xattr sqlite3 xfsprogs python-webob python-eventlet python-greenlet</cite></p> </li> <li><p class="first">Install anything else you want, like screen, ssh, vim, etc.</p> </li> <li><p class="first"><cite>fdisk /dev/sdb</cite> (set up a single partition)</p> </li> <li><p class="first"><cite>mkfs.xfs -i size=1024 /dev/sdb1</cite></p> </li> <li><p class="first"><cite>mkdir /mnt/sdb1</cite></p> </li> <li><p class="first">Edit <cite>/etc/fstab</cite> and add <cite>/dev/sdb1 /mnt/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0</cite></p> </li> <li><p class="first"><cite>mount /mnt/sdb1</cite></p> </li> <li><p class="first"><cite>mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4 /mnt/sdb1/test</cite></p> </li> <li><p class="first"><cite>chown <your-user-name>:<your-group-name> /mnt/sdb1/*</cite></p> </li> <li><p class="first"><cite>mkdir /srv</cite></p> </li> <li><p class="first"><cite>for x in {1..4}; do ln -s /mnt/sdb1/$x /srv/$x; done</cite></p> </li> <li><p class="first"><cite>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</cite></p> </li> <li><p class="first"><cite>chown -R <your-user-name>:<your-group-name> /etc/swift /srv/[1-4]/ /var/run/swift</cite> – <strong>Make sure to include the trailing slash after /srv/[1-4]/</strong></p> </li> <li><p class="first">Add to <cite>/etc/rc.local</cite> (before the <cite>exit 0</cite>):</p> <div class="highlight-python"><pre>mkdir /var/run/swift chown <your-user-name>:<your-user-name> /var/run/swift</pre> </div> </li> <li><p class="first">Create /etc/rsyncd.conf:</p> <div class="highlight-python"><pre>uid = <Your user name> gid = <Your group name> log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid [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</pre> </div> </li> <li><p class="first">Edit the following line in /etc/default/rsync:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">RSYNC_ENABLE</span><span class="o">=</span><span class="n">true</span> </pre></div> </div> </li> <li><p class="first"><cite>service rsync restart</cite></p> </li> </ol> </li> <li><p class="first">As you on guest:</p> <ol class="arabic"> <li><p class="first"><cite>mkdir ~/bin</cite></p> </li> <li><p class="first">Create <cite>~/.bazaar/bazaar.conf</cite>:</p> <div class="highlight-python"><pre>[DEFAULT] email = Your Name <your-email-address></pre> </div> </li> <li><p class="first">If you are using launchpad to get the code or make changes, run <cite>bzr launchpad-login <launchpad_id></cite></p> </li> <li><p class="first">Create the swift repo with <cite>bzr init-repo swift</cite></p> </li> <li><p class="first">Check out your bzr branch of swift, for example: <cite>cd ~/swift; bzr branch lp:swift trunk</cite></p> </li> <li><p class="first"><cite>cd ~/swift/trunk; sudo python setup.py develop</cite></p> </li> <li><p class="first">Edit <cite>~/.bashrc</cite> and add to the end:</p> <div class="highlight-python"><pre>export PATH_TO_TEST_XFS=/mnt/sdb1/test export SWIFT_TEST_CONFIG_FILE=/etc/swift/func_test.conf export PATH=${PATH}:~/bin</pre> </div> </li> <li><p class="first"><cite>. ~/.bashrc</cite></p> </li> <li><p class="first">Create <cite>/etc/swift/auth-server.conf</cite>:</p> <div class="highlight-python"><pre>[auth-server] default_cluster_url = http://127.0.0.1:8080/v1 user = <your-user-name></pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/proxy-server.conf</cite>:</p> <div class="highlight-python"><pre>[proxy-server] bind_port = 8080 user = <your-user-name></pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/account-server/1.conf</cite>:</p> <div class="highlight-python"><pre>[account-server] devices = /srv/1/node mount_check = false bind_port = 6012 user = <your-user-name> [account-replicator] vm_test_mode = yes [account-auditor] [account-reaper]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/account-server/2.conf</cite>:</p> <div class="highlight-python"><pre>[account-server] devices = /srv/2/node mount_check = false bind_port = 6022 user = <your-user-name> [account-replicator] vm_test_mode = yes [account-auditor] [account-reaper]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/account-server/3.conf</cite>:</p> <div class="highlight-python"><pre>[account-server] devices = /srv/3/node mount_check = false bind_port = 6032 user = <your-user-name> [account-replicator] vm_test_mode = yes [account-auditor] [account-reaper]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/account-server/4.conf</cite>:</p> <div class="highlight-python"><pre>[account-server] devices = /srv/4/node mount_check = false bind_port = 6042 user = <your-user-name> [account-replicator] vm_test_mode = yes [account-auditor] [account-reaper]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/container-server/1.conf</cite>:</p> <div class="highlight-python"><pre>[container-server] devices = /srv/1/node mount_check = false bind_port = 6011 user = <your-user-name> [container-replicator] vm_test_mode = yes [container-updater] [container-auditor]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/container-server/2.conf</cite>:</p> <div class="highlight-python"><pre>[container-server] devices = /srv/2/node mount_check = false bind_port = 6021 user = <your-user-name> [container-replicator] vm_test_mode = yes [container-updater] [container-auditor]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/container-server/3.conf</cite>:</p> <div class="highlight-python"><pre>[container-server] devices = /srv/3/node mount_check = false bind_port = 6031 user = <your-user-name> [container-replicator] vm_test_mode = yes [container-updater] [container-auditor]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/container-server/4.conf</cite>:</p> <div class="highlight-python"><pre>[container-server] devices = /srv/4/node mount_check = false bind_port = 6041 user = <your-user-name> [container-replicator] vm_test_mode = yes [container-updater] [container-auditor]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/object-server/1.conf</cite>:</p> <div class="highlight-python"><pre>[object-server] devices = /srv/1/node mount_check = false bind_port = 6010 user = <your-user-name> [object-replicator] vm_test_mode = yes [object-updater] [object-auditor]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/object-server/2.conf</cite>:</p> <div class="highlight-python"><pre>[object-server] devices = /srv/2/node mount_check = false bind_port = 6020 user = <your-user-name> [object-replicator] vm_test_mode = yes [object-updater] [object-auditor]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/object-server/3.conf</cite>:</p> <div class="highlight-python"><pre>[object-server] devices = /srv/3/node mount_check = false bind_port = 6030 user = <your-user-name> [object-replicator] vm_test_mode = yes [object-updater] [object-auditor]</pre> </div> </li> <li><p class="first">Create <cite>/etc/swift/object-server/4.conf</cite>:</p> <div class="highlight-python"><pre>[object-server] devices = /srv/4/node mount_check = false bind_port = 6040 user = <your-user-name> [object-replicator] vm_test_mode = yes [object-updater] [object-auditor]</pre> </div> </li> <li><p class="first">Create <cite>~/bin/resetswift</cite>:</p> <div class="highlight-python"><pre>#!/bin/bash swift-init all stop sleep 5 sudo umount /mnt/sdb1 sudo mkfs.xfs -f -i size=1024 /dev/sdb1 sudo mount /mnt/sdb1 sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4 /mnt/sdb1/test sudo chown <your-user-name>:<your-group-name> /mnt/sdb1/* mkdir -p /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog sudo service rsyslog restart sudo service memcached restart</pre> </div> </li> <li><p class="first">Create <cite>~/bin/remakerings</cite>:</p> <div class="highlight-python"><pre>#!/bin/bash cd /etc/swift rm *.builder *.ring.gz backups/*.builder backups/*.ring.gz swift-ring-builder object.builder create 18 3 1 swift-ring-builder object.builder add z1-127.0.0.1:6010/sdb1 1 swift-ring-builder object.builder add z2-127.0.0.1:6020/sdb2 1 swift-ring-builder object.builder add z3-127.0.0.1:6030/sdb3 1 swift-ring-builder object.builder add z4-127.0.0.1:6040/sdb4 1 swift-ring-builder object.builder rebalance swift-ring-builder container.builder create 18 3 1 swift-ring-builder container.builder add z1-127.0.0.1:6011/sdb1 1 swift-ring-builder container.builder add z2-127.0.0.1:6021/sdb2 1 swift-ring-builder container.builder add z3-127.0.0.1:6031/sdb3 1 swift-ring-builder container.builder add z4-127.0.0.1:6041/sdb4 1 swift-ring-builder container.builder rebalance swift-ring-builder account.builder create 18 3 1 swift-ring-builder account.builder add z1-127.0.0.1:6012/sdb1 1 swift-ring-builder account.builder add z2-127.0.0.1:6022/sdb2 1 swift-ring-builder account.builder add z3-127.0.0.1:6032/sdb3 1 swift-ring-builder account.builder add z4-127.0.0.1:6042/sdb4 1 swift-ring-builder account.builder rebalance</pre> </div> </li> <li><p class="first">Create <cite>~/bin/startmain</cite>:</p> <div class="highlight-python"><pre>#!/bin/bash swift-init auth-server start swift-init proxy-server start swift-init account-server start swift-init container-server start swift-init object-server start</pre> </div> </li> <li><p class="first">Create <cite>~/bin/startrest</cite>:</p> <div class="highlight-python"><pre>#!/bin/bash swift-auth-recreate-accounts swift-init object-updater start swift-init container-updater start swift-init object-replicator start swift-init container-replicator start swift-init account-replicator start swift-init object-auditor start swift-init container-auditor start swift-init account-auditor start swift-init account-reaper start</pre> </div> </li> <li><p class="first"><cite>chmod +x ~/bin/*</cite></p> </li> <li><p class="first"><cite>remakerings</cite></p> </li> <li><p class="first"><cite>cd ~/swift/trunk; ./.unittests</cite></p> </li> <li><p class="first"><cite>startmain</cite> (The <tt class="docutils literal"><span class="pre">Unable</span> <span class="pre">to</span> <span class="pre">increase</span> <span class="pre">file</span> <span class="pre">descriptor</span> <span class="pre">limit.</span> <span class="pre">Running</span> <span class="pre">as</span> <span class="pre">non-root?</span></tt> warnings are expected and ok.)</p> </li> <li><p class="first"><cite>swift-auth-create-account test tester testing</cite></p> </li> <li><p class="first">Get an <cite>X-Storage-Url</cite> and <cite>X-Auth-Token</cite>: <tt class="docutils literal"><span class="pre">curl</span> <span class="pre">-v</span> <span class="pre">-H</span> <span class="pre">'X-Storage-User:</span> <span class="pre">test:tester'</span> <span class="pre">-H</span> <span class="pre">'X-Storage-Pass:</span> <span class="pre">testing'</span> <span class="pre">http://127.0.0.1:11000/v1.0</span></tt></p> </li> <li><p class="first">Check that you can GET account: <tt class="docutils literal"><span class="pre">curl</span> <span class="pre">-v</span> <span class="pre">-H</span> <span class="pre">'X-Auth-Token:</span> <span class="pre"><token-from-x-auth-token-above>'</span> <span class="pre"><url-from-x-storage-url-above></span></tt></p> </li> <li><p class="first">Check that <cite>st</cite> works: <cite>st -A http://127.0.0.1:11000/v1.0 -U test:tester -K testing stat</cite></p> </li> <li><p class="first">Create <cite>/etc/swift/func_test.conf</cite>:</p> <div class="highlight-python"><pre>auth_host = 127.0.0.1 auth_port = 11000 auth_ssl = no account = test username = tester password = testing collate = C</pre> </div> </li> <li><p class="first"><cite>cd ~/swift/trunk; ./.functests</cite></p> </li> <li><p class="first"><cite>cd ~/swift/trunk; ./.probetests</cite> (Note for future reference: probe tests will reset your environment)</p> </li> </ol> </li> </ul> <p>If you plan to work on documentation (and who doesn’t?!):</p> <blockquote> <ol class="arabic simple"> <li><cite>sudo apt-get install python-sphinx</cite></li> <li><cite>python setup.py build_sphinx</cite></li> </ol> </blockquote> </div> <div class="section" id="debugging-issues"> <h2>Debugging Issues<a class="headerlink" href="#debugging-issues" title="Permalink to this headline">¶</a></h2> <p>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:</p> <ol class="arabic simple"> <li>Everything is logged in /var/log/syslog, so that is a good first place to look for errors (most likely python tracebacks).</li> <li>Make sure all of the server processes are running. For the base functionality, the Proxy, Account, Container, Object and Auth servers should be running</li> <li>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: <cite>swift-object-server /etc/swift/object-server/1.conf</cite> will start the object server. If there are problems not showing up in syslog, then you will likely see the traceback on startup.</li> </ol> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference external" href="#">SAIO - Swift All In One</a><ul> <li><a class="reference external" href="#instructions-for-seting-up-a-dev-vm">Instructions for seting up a dev VM</a></li> <li><a class="reference external" href="#debugging-issues">Debugging Issues</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="development_guidelines.html" title="previous chapter">Development Guidelines</a></p> <h4>Next topic</h4> <p class="topless"><a href="ring.html" title="next chapter">Partitioned Consistent Hash Ring</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/development_saio.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="modindex.html" title="Global Module Index" >modules</a> |</li> <li class="right" > <a href="ring.html" title="Partitioned Consistent Hash Ring" >next</a> |</li> <li class="right" > <a href="development_guidelines.html" title="Development Guidelines" >previous</a> |</li> <li><a href="index.html">Swift v1.0.2 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2010, OpenStack, LLC.. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.6. </div> </body> </html>