当前位置:首页 > > 充电吧
[导读]由于课题需要,现开始进行对openstack的研究,现在网上对于swift安装有很多教程,有成功的,有失败的,现将我的心得告诉大家,方便大家的使用1.首先安装GIT     1.1有人推荐使用    

由于课题需要,现开始进行对openstack的研究,现在网上对于swift安装有很多教程,有成功的,有失败的,现将我的心得告诉大家,方便大家的使用

1.首先安装GIT

     1.1有人推荐使用

            sudo apt-get install git


            PS:在我的环境下没成功过...,


     1.2使用其他命令步骤安装


           sudo apt-get install git-core openssh-server openssh-client
           sudo apt-get install git-core git-gui git-doc 
           sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev git-core

      至此安装成功!!


2.swift的安装部署

       2.1安装部署依赖项


          sudo apt-get update
          sudo apt-get install curl gcc memcached rsync sqlite3 xfsprogs git 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

       2.2使用回环设备作为存储,若需要使用一个分区作为存储,参见官方文档


          sudo mkdir /srv
          sudo truncate -s 1GB /srv/swift-disk
          sudo  mkfs.xfs /srv/swift-disk

       2.3修改/etc/fstab添加如下行



          /srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0


       2.4继续运行下面命令



         sudo mkdir /mnt/sdb1
         mount /mnt/sdb1
         mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
         chown root:root /mnt/sdb1/*
         ln -s /mnt/sdb1/2 /srv/2         ln -s /mnt/sdb1/3 /srv/3         ln -s /mnt/sdb1/4 /srv/4
         ln -s /mnt/sdb1/1 /srv/1

sudo mkdir -p /etc/swift/object-server /etc/swift/container-server /etc/swift/account-server 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 root:root /etc/swift /srv/[1-4]/ /var/run/swift




         2.5编辑文件/etc/rc.local 在exit 0之前添加一下代码



        sudo mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4
        sudo chown:/var/cache/swift*
        sudo mkdir -p /var/run/swift
        sudo chown:/var/run/swift


        2.6设置Rsync,创建/etc/rsyncd.conf文件



       uid = root#这里不一定是root
       gid = root#这里不一定是root
       log file = /var/log/rsyncd.log
       pid file = /var/run/rsyncd.pid
       address = 127.0.0.1
       
       [account6012]
       max connections = 25
       path = /srv/1/node/
       read only = false
       lock file = /var/lock/account6012.lock
 
       [account6022]
       max connections = 25 
       path = /srv/2/node/
       read only = false
       lock file = /var/lock/account6022.lock

       [account6032]
       max connections = 25
       path = /srv/3/node/
       read only = false
      lock file = /var/lock/account6032.lock
     
      [account6042] 
      max connections = 25
      path = /srv/4/node/
      read only = false
      lock file = /var/lock/account6042.lock
    
      [container6011]
      max connections = 25 
      path = /srv/1/node/
      read only = false
      lock file = /var/lock/container6011.lock
     
      [container6021]
      max connections = 25
      path = /srv/2/node/
      read only = false
      lock file = /var/lock/container6021.lock
    
      [container6031] 
      max connections = 25
      path = /srv/3/node/  
      read only = false
      lock file = /var/lock/container6031.lock
    
      [container6041]
      max connections = 25
      path = /srv/4/node/ 
      read only = false
      lock file = /var/lock/container6041.lock
     
      [object6010]
      max connections = 25
      path = /srv/1/node/ 
      read only = false
      lock file = /var/lock/object6010.lock
 
      [object6020]
      max connections = 25
      path = /srv/2/node/
      read only = false
      lock file = /var/lock/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


      2.7编辑文件/etc/default/rsync文件设置参数RSYNC_ENABLE为true

      RSYNC_ENABLE=true


     2.8启动rsync服务


      service rsync restart

    2.9确认rsync启动  

      rsync rsync://pub@localhost/

   2.10开始用到git了,从git上下载swift代码    

     git clone https://github.com/openstack/swift.git

   2.10安装swift的开发版本   

     cd ~/swift
     git checkout -t origin/stable/grizzly # checkout稳定分支1.8,可忽略
     sudo python setup.py develop
     cd ..

   2.11获取python-swiftclient源代码,并进行安装



     git clone https://github.com/openstack/python-swiftclient.git
     cd ~/python-swiftclientsudo python setup.py developcd ..


   2.12配置各节点   

     创建文件/etc/swift/proxy-server.conf,

[DEFAULT]
bind_port = 8080
user = root
log_facility = LOG_LOCAL1
eventlet_debug = true

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

[app:proxy-server]
use = egg:swift#proxy
allow_account_management = true
account_autocreate = true

[filter:tempauth]
use = egg:swift#tempauth
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3

[filter:healthcheck]
use = egg:swift#healthcheck

[filter:cache]
use = egg:swift#memcache

[filter:proxy-logging]
use = egg:swift#proxy_logging



创建文件/etc/swift/swift.conf

[swift-hash]
# random unique strings that can never change (DO NOT LOSE)
swift_hash_path_prefix = rui
swift_hash_path_suffix = jie


Create /etc/swift/account-server/1.conf:

[DEFAULT]
devices = /srv/1/node
mount_check = false
disable_fallocate = true
bind_port = 6012
user = root
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

[filter:recon]
use = egg:swift#recon

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]


Create /etc/swift/account-server/2.conf:

[DEFAULT]
devices = /srv/2/node
mount_check = false
disable_fallocate = true
bind_port = 6022
user = root
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

[filter:recon]
use = egg:swift#recon

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]


Create /etc/swift/account-server/3.conf:

[DEFAULT]

devices = /srv/3/node

mount_check = false

disable_fallocate = true

bind_port = 6032

user = root

log_facility = LOG_LOCAL4

recon_cache_path = /var/cache/swift3

eventlet_debug = true

 

[pipeline:main]

pipeline = recon account-server

 

[app:account-server]

use = egg:swift#account

 

[filter:recon]

use = egg:swift#recon

 

[account-replicator]

vm_test_mode = yes

 

[account-auditor]

 

[account-reaper]


Create /etc/swift/account-server/4.conf:

[DEFAULT]
devices = /srv/4/node
mount_check = false
disable_fallocate = true
bind_port = 6042
user = root
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

[filter:recon]
use = egg:swift#recon

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]



Create /etc/swift/container-server/1.conf:

[DEFAULT]

devices = /srv/1/node

mount_check = false

disable_fallocate = true

bind_port = 6011

user = root

log_facility = LOG_LOCAL2

recon_cache_path = /var/cache/swift

eventlet_debug = true

 

[pipeline:main]

pipeline = recon container-server

 

[app:container-server]

use = egg:swift#container

 

[filter:recon]

use = egg:swift#recon

 

[container-replicator]

vm_test_mode = yes

 

[container-updater]

 

[container-auditor]

 

[container-sync]


Create /etc/swift/container-server/2.conf:

[DEFAULT]
devices = /srv/2/node
mount_check = false
disable_fallocate = true
bind_port = 6021
user = root
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

[filter:recon]
use = egg:swift#recon

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]


Create /etc/swift/container-server/3.conf:

[DEFAULT]
devices = /srv/3/node
mount_check = false
disable_fallocate = true
bind_port = 6031
user = root
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

[filter:recon]
use = egg:swift#recon

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]


Create /etc/swift/container-server/4.conf:

[DEFAULT]

devices = /srv/4/node

mount_check = false

disable_fallocate = true

bind_port = 6041

user = root

log_facility = LOG_LOCAL5

recon_cache_path = /var/cache/swift4

eventlet_debug = true

 

[pipeline:main]

pipeline = recon container-server

 

[app:container-server]

use = egg:swift#container

 

[filter:recon]

use = egg:swift#recon

 

[container-replicator]

vm_test_mode = yes

 

[container-updater]

 

[container-auditor]

 

[container-sync]





Create /etc/swift/object-server/1.conf:

[DEFAULT]
devices = /srv/1/node
mount_check = false
disable_fallocate = true
bind_port = 6010
user = root
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

[filter:recon]
use = egg:swift#recon

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]


Create /etc/swift/object-server/2.conf:

[DEFAULT]
devices = /srv/2/node
mount_check = false
disable_fallocate = true
bind_port = 6020
user = root
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

[filter:recon]
use = egg:swift#recon

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]


Create /etc/swift/object-server/3.conf:

[DEFAULT]
devices = /srv/3/node
mount_check = false
disable_fallocate = true
bind_port = 6030
user = root
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

[filter:recon]
use = egg:swift#recon

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]


Create /etc/swift/object-server/4.conf:

[DEFAULT]
devices = /srv/4/node
mount_check = false
disable_fallocate = true
bind_port = 6040
user = root
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

[filter:recon]
use = egg:swift#recon

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]


2.13创建脚本~/bin/remakerings



#!/bin/bash
cd /etc/swift
rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
swift-ring-builder object.builder create 10 3 1
swift-ring-builder object.builder add r1z1-127.0.0.1:6010/sdb1 1
swift-ring-builder object.builder add r1z2-127.0.0.1:6020/sdb2 1
swift-ring-builder object.builder add r1z3-127.0.0.1:6030/sdb3 1
swift-ring-builder object.builder add r1z4-127.0.0.1:6040/sdb4 1
swift-ring-builder object.builder rebalance
swift-ring-builder container.builder create 10 3 1
swift-ring-builder container.builder add r1z1-127.0.0.1:6011/sdb1 1
swift-ring-builder container.builder add r1z2-127.0.0.1:6021/sdb2 1
swift-ring-builder container.builder add r1z3-127.0.0.1:6031/sdb3 1
swift-ring-builder container.builder add r1z4-127.0.0.1:6041/sdb4 1
swift-ring-builder container.builder rebalance
swift-ring-builder account.builder create 10 3 1
swift-ring-builder account.builder add r1z1-127.0.0.1:6012/sdb1 1
swift-ring-builder account.builder add r1z2-127.0.0.1:6022/sdb2 1
swift-ring-builder account.builder add r1z3-127.0.0.1:6032/sdb3 1
swift-ring-builder account.builder add r1z4-127.0.0.1:6042/sdb4 1
swift-ring-builder account.builder rebalance



2.14创建~/bin/startmain

#!/bin/bash
swift-init main start



2.15编辑~/.bashrc,在最后添加如下两行

export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf
export PATH=${PATH}:~/bin


2.16开启Swift(在开启swift之前先运行一次remakering)



startmain
检查Swift工作
swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat
正确情况下,应该输出以下信息
Account: AUTH_test
Containers: 0
Objects: 0
Bytes: 0
Accept-Ranges: bytes




本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除。
换一批
延伸阅读

10月28日,IT大厦获悉,智能手机自黑暗时代就已存在,为许多人提供了肥沃的土壤提供。现在XDA团队决定创建自己的手机。

关键字: lineageos ubuntu touch os

Canonical昨天正式发布了ubuntu-20.10,其中包括一个优化的草莓蛋糕和服务器系统,以支持科学家、发明家、教育和企业。

关键字: 树莓派 gnome ubuntu

9月27日消息,苹果工程师在今年年初宣布,Swift将在今年实现开源,他们现在是fast系统的创始人,并引入了Linux支持。

关键字: swift Linux api

尽管Linux桌面之年仍是梦想,但对这种开源操作系统的认可和采用可能从未如此出色。 部分原因是由于像Canonical这样的公司,不仅为企业而且为消费者推广了Linux。 但是,客户可能不想在新的笔记本电脑或台式机上安装...

关键字: Linux ubuntu thinkpads thinkstation

我认为很多朋友都想学习Linux。 在许多情况下,我们将安装Linux VM或双系统。

关键字: win10 Linux ubuntu

由于缺乏直接的内核编译准则,著名的XDA开发人员Droidzone决定专门为开发人员创建自己的内核。 本指南包含一个交互式菜单和以下主题:-获取源代码

关键字: Linux shell ubuntu

不久前,我们为您带来了有关Linux-on-Android项目的新闻。 对于那些不知道的人,Android上的Linux允许用户在他们支持的设备上安装各种Linux发行版。 它使用chroot,类似于Android设备上...

关键字: Linux Android ubuntu

  2月22日消息,Ubuntu移动操作系统Ubuntu Touch今天开放下载,首批支持的机型有Galaxy Nexus、Nexus 4、Nexus 7和Nexus10。   按照Ub

关键字: ubuntu nexus 4

在下面的内容中,小编将对宏碁Swift 5 / Swift 3笔记本最新消息进行介绍,和小编一起来了解下吧。

关键字: swift 宏碁 笔记本

我们讨论了XDA的应用程序开发:DevCon 2013,Ubuntu Touch开发,NFC和Firefox OS演示。 所有这些演示对开发人员和发烧友都具有巨大的价值。 但是,您的口袋里有一个秘密:成就。 这些漏洞可用...

关键字: Android touch ubuntu xda
关闭