热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

OpenStackswift安装配置过程整理

说明:1swift搭建主要参考与官网SAIO的参考。http://swift.openstack.org/development_saio.html若初次接触请注意认证方式!后面遇到的时候会具体提到。一切已官网的参考为主要依据。2预备知识。openstack及其相关请参看其他参考,不再赘述。linu

说明:

1 swift 搭建主要参考与官网SAIO的参考。

http://swift.openstack.org/development_saio.html

若初次接触请注意认证方式!后面遇到的时候会具体提到。一切已官网的参考为主要依据。

2 预备知识。

openstack及其相关 请参看其他参考,不再赘述。

linux 初学者请注意一下几个命令的用法。后续操作中会用到,请预先学习:

cp ls df fdisk tar rm ls wget mkdir apt-get(初学者只要知道这几个命令是做什么用的即可)

 

安装过程:(已官网的顺序为例,不同的地方我会强调出来)

 

我会上传脚本~(配置的,安装的 一起只要简单的几步。但我还是希望大家能看完手工配置一遍。脚本在最后有说明怎么用。言归正传。开始了)

 

一、系统及swift版本

Ubuntu Server ISO: http://mirror.lupaworld.com/ubuntu-releases//oneiric/ubuntu-11.10-desktop-amd64.iso

(说明:为了方便初学者:系统安装时默认用户名为swift,免去初学者之后操作忘记切换用户  其实本人觉得无所谓~ 要是没有用swift 也别改了~ 后面我会强调注意的地方)

 

    swift 版本下载: https://launchpad.net/swift/+download

本人选用的是1.4.4的tar包( swift-1.4.4.tar.gz

地址: http://launchpad.net/swift/essex/1.4.4/+download/swift-1.4.4.tar.gz

请根据自己的需求选择选择对应的版本下载

 

二、SAIO的安装

2.1、安装依赖包

Installing dependencies and the core code

As root on guest (you’ll have to log in as you, then sudo su -):

 

apt-get install python-software-properties

add-apt-repository ppa:swift-core/release

apt-get update

apt-get install curl gcc git-core memcached python-configobj python-coverage python-dev python-nose python-setuptools python-simplejson python-xattr sqlite3 xfsprogs python-webob python-eventlet python-greenlet python-pastedeploy python-netifaces

Install anything else you want, like screen, ssh, vim, etc.

 

以上上官网上的顺序。说明:

1 主要是配置环境及下载代码。 建议选用64bit的ubuntu 否则 第二步可能出现问题

2 初学者主要别忘了每条命令前加 sudo 即:sudo apt-get install python-software-properties

3 由于网络问题或其他可能导致运行上面下载安装失败 请多次重复下载。

4  第四步 不建议安装官网说明那么下载。大多数下载会失败。建议分开下载。如:

sudo apt-get install curl gcc git-core memcached python-configobj

sudo apt-get install  python-coverage python-dev python-nose python-setuptools  

sudo apt-get install python-simplejson python-xattr sqlite3 xfsprogs python-webob python-eventlet  

sudo apt-get install spython-greenlet python-pastedeploy python-netifaces

本人这块遇到 python-setuptools python-webob 这两个下载经常失败 (可以手工下载tar包)请在 https://launchpad.net/ubuntu/ 网站搜索对应组件下载

5 对于第五步说明: 本人只下载了 vim ssh (ssh 建议下载vim 为个人习惯问题)

sudo apt-get install ssh

 

2.2 设置存储(loopback 模式

官网中提供两种模式的存储 本人使用loopback 模式。

Using a loopback device for storage

If you want to use a loopback device instead of another partition, follow these instructions.

1.  mkdir /srv

2.  dd if=/dev/zero of=/srv/swift-disk bs=1024 count=0 seek=1000000

(modify seek to make a larger or smaller partition)

3.  mkfs.xfs -i size=1024 /srv/swift-disk

4.  Edit /etc/fstab and add

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

5.  mkdir /mnt/sdb1

6.  mount /mnt/sdb1

7.  mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4

8.  chown : /mnt/sdb1/*

9.  for x in {1..4}; do ln -s /mnt/sdb1/$x /srv/$x; done

10. 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

11. chown -R : /etc/swift /srv/[1-4]/ /var/run/swift Make sure to include the trailing slash after /srv/[1-4]/

12. Add to /etc/rc.local (before the exit 0):

mkdir /var/run/swift chown : /var/run/swift

说明 这一段没有什么好说的 初学者可以不动脑子按照这操作就可以了~(本人后续会写一个配置的脚本放在后面,就不用这么麻烦的输入了~

 

2.3 设置参数及config

说明 配置参数这几步初学者完全按照SAIO的参数配即可(但是默认的认证时tempauth。)我会把默认的参数和有认证的参数分别上传上来。官网tempauth这种认证方式不用修改任何参数。完全复制粘贴就可以了~ 注意放在对应的文件夹下。

Setting up rsync

1.  Create /etc/rsyncd.conf:

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

2.  Edit the following line in /etc/default/rsync:

3.  service rsync restart

Optional: Setting up rsyslog for individual logging

1.  Create /etc/rsyslog.d/10-swift.conf:

# 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.* ~

2.  Edit /etc/rsyslog.conf and make the following change:

3.  mkdir -p /var/log/swift/hourly

4.  chown -R syslog.adm /var/log/swift

5.  service rsyslog restart

Getting the code and setting up test environment

Sample configuration files are provided with all defaults in line-by-line comments.

Do these commands as you on guest.

1.  mkdir ~/bin

2.  Check out the swift repo with git clone https://github.com/openstack/swift.git

3.  Build a development installation of swift, for example: cd ~/swift; sudo python setup.py develop

4.  Edit ~/.bashrc and add to the end:

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

5.  . ~/.bashrc

Configuring each node

Sample configuration files are provided with all defaults in line-by-line comments.

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

[DEFAULT] bind_port = 8080 user = log_facility = LOG_LOCAL1 [pipeline:main] pipeline = healthcheck cache tempauth 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

2.  Create /etc/swift/swift.conf:

[swift-hash] # random unique string that can never change (DO NOT LOSE)swift_hash_path_suffix changeme

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

[DEFAULT] devices = /srv/1/node mount_check = false bind_port = 6012 user = log_facility = LOG_LOCAL2 [pipeline:main] pipeline = account-server [app:account-server] use = egg:swift#account [account-replicator] vm_test_mode = yes [account-auditor] [account-reaper]

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

[DEFAULT] devices = /srv/2/node mount_check = false bind_port = 6022 user = log_facility = LOG_LOCAL3 [pipeline:main] pipeline = account-server [app:account-server] use = egg:swift#account [account-replicator] vm_test_mode = yes [account-auditor] [account-reaper]

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

[DEFAULT] devices = /srv/3/node mount_check = false bind_port = 6032 user = log_facility = LOG_LOCAL4 [pipeline:main] pipeline = account-server [app:account-server] use = egg:swift#account [account-replicator] vm_test_mode = yes [account-auditor] [account-reaper]

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

[DEFAULT] devices = /srv/4/node mount_check = false bind_port = 6042 user = log_facility = LOG_LOCAL5 [pipeline:main] pipeline = account-server [app:account-server] use = egg:swift#account [account-replicator] vm_test_mode = yes [account-auditor] [account-reaper]

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

[DEFAULT] devices = /srv/1/node mount_check = false bind_port = 6011 user = log_facility = LOG_LOCAL2 [pipeline:main] pipeline = container-server [app:container-server] use = egg:swift#container [container-replicator] vm_test_mode = yes [container-updater] [container-auditor] [container-sync]

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

[DEFAULT] devices = /srv/2/node mount_check = false bind_port = 6021 user = log_facility = LOG_LOCAL3 [pipeline:main] pipeline = container-server [app:container-server] use = egg:swift#container [container-replicator] vm_test_mode = yes [container-updater] [container-auditor] [container-sync]

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

[DEFAULT] devices = /srv/3/node mount_check = false bind_port = 6031 user = log_facility = LOG_LOCAL4 [pipeline:main] pipeline = container-server [app:container-server] use = egg:swift#container [container-replicator] vm_test_mode = yes [container-updater] [container-auditor] [container-sync]

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

[DEFAULT] devices = /srv/4/node mount_check = false bind_port = 6041 user = log_facility = LOG_LOCAL5 [pipeline:main] pipeline = container-server [app:container-server] use = egg:swift#container [container-replicator] vm_test_mode = yes [container-updater] [container-auditor] [container-sync]

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

[DEFAULT] devices = /srv/1/node mount_check = false bind_port = 6010 user = log_facility = LOG_LOCAL2 [pipeline:main] pipeline = object-server [app:object-server] use = egg:swift#object [object-replicator] vm_test_mode = yes [object-updater] [object-auditor]

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

[DEFAULT] devices = /srv/2/node mount_check = false bind_port = 6020 user = log_facility = LOG_LOCAL3 [pipeline:main] pipeline = object-server [app:object-server] use = egg:swift#object [object-replicator] vm_test_mode = yes [object-updater] [object-auditor]

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

[DEFAULT] devices = /srv/3/node mount_check = false bind_port = 6030 user = log_facility = LOG_LOCAL4 [pipeline:main] pipeline = object-server [app:object-server] use = egg:swift#object [object-replicator] vm_test_mode = yes [object-updater] [object-auditor]

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

[DEFAULT] devices = /srv/4/node mount_check = false bind_port = 6040 user = log_facility = LOG_LOCAL5 [pipeline:main] pipeline = object-server [app:object-server] use = egg:swift#object [object-replicator] vm_test_mode = yes [object-updater] [object-auditor]

 

2.4、安装swift

你的swift放在哪里了? 找到它解压安装  这里用到了 tar 命令 没问题吧?

tar xvjf  swift-1.4.4.tar.gz

   cd ~/ swift-1.4.4 ; sudo python setup.py develop

 

2.5 创建运行swift运行的脚本

 和官网的一致。完全安官网的来即可。同样我上传了已经写好的脚本可以加载使用 即可。

Create ~/bin/resetswift.

If you are using a loopback device substitute /dev/sdb1 with /srv/swift-disk.

If you did not set up rsyslog for individual logging, remove the find /var/log/swift... line:

#!/bin/bash swift-init all stop find /var/log/swift -type f -exec rm -f {} \; 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 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 sudo service rsyslog restart sudo service memcached restart

Create ~/bin/remakerings:

#!/bin/bash cd /etc/swift rm -f *.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

Create ~/bin/startmain:

#!/bin/bash swift-init main start

Create ~/bin/startrest:

#!/bin/bash swift-init rest start


推荐阅读
  • 嵌入式开发环境搭建与文件传输指南
    本文详细介绍了如何为嵌入式应用开发搭建必要的软硬件环境,并提供了通过串口和网线两种方式将文件传输到开发板的具体步骤。适合Linux开发初学者参考。 ... [详细]
  • Coursera ML 机器学习
    2019独角兽企业重金招聘Python工程师标准线性回归算法计算过程CostFunction梯度下降算法多变量回归![选择特征](https:static.oschina.n ... [详细]
  • 本题来自WC2014,题目编号为BZOJ3435、洛谷P3920和UOJ55。该问题描述了一棵不断生长的带权树及其节点上小精灵之间的友谊关系,要求实时计算每次新增节点后树上所有可能的朋友对数。 ... [详细]
  • Python 工具推荐 | PyHubWeekly 第二十一期:提升命令行体验的五大工具
    本期 PyHubWeekly 为大家精选了 GitHub 上五个优秀的 Python 工具,涵盖金融数据可视化、终端美化、国际化支持、图像增强和远程 Shell 环境配置。欢迎关注并参与项目。 ... [详细]
  • cJinja:C++编写的轻量级HTML模板引擎
    本文介绍了cJinja,这是一个用C++编写的轻量级HTML模板解析库。它利用ejson来处理模板中的数据替换(即上下文),其语法与Django Jinja非常相似,功能强大且易于学习。 ... [详细]
  • Symfony是一个功能强大的PHP框架,以其依赖注入(DI)特性著称。许多流行的PHP框架如Drupal和Laravel的核心组件都基于Symfony构建。本文将详细介绍Symfony的安装方法及其基本使用。 ... [详细]
  • 本文详细介绍了 Python 中的条件语句和循环结构。主要内容包括:1. 分支语句(if...elif...else);2. 循环语句(for, while 及嵌套循环);3. 控制循环的语句(break, continue, else)。通过具体示例,帮助读者更好地理解和应用这些语句。 ... [详细]
  • 本文详细介绍了钩子(hook)的概念、原理及其在编程中的实际应用。通过对比回调函数和注册函数,解释了钩子的工作机制,并提供了具体的Python示例代码,帮助读者更好地理解和掌握这一重要编程工具。 ... [详细]
  • 2012年7月30日,语言岛团队宣布其智能记单词软件V0.3.4.554版本正式开源。该版本不仅支持跨平台使用,还引入了多项创新功能,旨在帮助用户更高效地记忆单词。 ... [详细]
  • 在编译BSP包过程中,遇到了一个与 'gets' 函数相关的编译错误。该问题通常发生在较新的编译环境中,由于 'gets' 函数已被弃用并视为安全漏洞。本文将详细介绍如何通过修改源代码和配置文件来解决这一问题。 ... [详细]
  • 推荐几款高效测量图片像素的工具
    本文介绍了几款适用于Web前端开发的工具,这些工具可以帮助用户在图片上绘制线条并精确测量其像素长度。对于需要进行图像处理或设计工作的开发者来说非常实用。 ... [详细]
  • 配置PHPStudy环境并使用DVWA进行Web安全测试
    本文详细介绍了如何在PHPStudy环境下配置DVWA( Damn Vulnerable Web Application ),并利用该平台进行SQL注入和XSS攻击的练习。通过此过程,读者可以熟悉常见的Web漏洞及其利用方法。 ... [详细]
  • 本文详细介绍了Java中实现异步调用的多种方式,包括线程创建、Future接口、CompletableFuture类以及Spring框架的@Async注解。通过代码示例和深入解析,帮助读者理解并掌握这些技术。 ... [详细]
  • 本文详细介绍了如何在Ubuntu的Enlightenment (E17) 桌面环境中管理和优化桌面图标及根菜单。通过本文,您将了解这些功能的作用及其配置方法。 ... [详细]
  • docker镜像重启_docker怎么启动镜像dock ... [详细]
author-avatar
加勒比海盗530
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有