热门标签 | 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


推荐阅读
  • Jupyter Notebook多语言环境搭建指南
    本文详细介绍了如何在Linux环境下为Jupyter Notebook配置Python、Python3、R及Go四种编程语言的环境,包括必要的软件安装和配置步骤。 ... [详细]
  • 本文详细介绍了如何正确设置Shadowsocks公共代理,包括调整超时设置、检查系统限制、防止滥用及遵守DMCA法规等关键步骤。 ... [详细]
  • 本文介绍了SELinux的两种主要工作模式——强制模式和宽容模式,并提供了如何在CentOS 7中正确启用和配置SELinux的方法,以及在遇到登录问题时的解决策略。 ... [详细]
  • Requests库的基本使用方法
    本文介绍了Python中Requests库的基础用法,包括如何安装、GET和POST请求的实现、如何处理Cookies和Headers,以及如何解析JSON响应。相比urllib库,Requests库提供了更为简洁高效的接口来处理HTTP请求。 ... [详细]
  • 调试利器SSH隧道
    在开发微信公众号或小程序的时候,由于微信平台规则的限制,部分接口需要通过线上域名才能正常访问。但我们一般都会在本地开发,因为这能快速的看到 ... [详细]
  • 从理想主义者的内心深处萌发的技术信仰,推动了云原生技术在全球范围内的快速发展。本文将带你深入了解阿里巴巴在开源领域的贡献与成就。 ... [详细]
  • 本文详细介绍了如何搭建一个高可用的MongoDB集群,包括环境准备、用户配置、目录创建、MongoDB安装、配置文件设置、集群组件部署等步骤。特别关注分片、读写分离及负载均衡的实现。 ... [详细]
  • 高级缩放示例.就像谷歌地图一样.它仅缩放图块,但不缩放整个图像.因此,缩放的瓷砖占据了恒定的记忆,并且不会为大型缩放图像调整大小的图像.对于简化的缩放示例lookhere.在Win ... [详细]
  • Bootstrap Paginator 分页插件详解与应用
    本文深入探讨了Bootstrap Paginator这款流行的JavaScript分页插件,提供了详细的使用指南和示例代码,旨在帮助开发者更好地理解和利用该工具进行高效的数据展示。 ... [详细]
  • 汇编语言:编程世界的始祖,连C语言都敬畏三分!
    当C语言还在萌芽阶段时,它首次接触到了汇编语言,并对其简洁性感到震惊。尽管汇编语言的指令极其简单,但它却是所有现代编程语言的基础,其重要性不言而喻。 ... [详细]
  • 本文介绍了Linux操作系统的核心组成部分——内核及其版本分类,以及市面上常见的几种Linux发行版,旨在为初学者提供一个清晰的学习路径。 ... [详细]
  • HTML前端开发:UINavigationController与页面间数据传递详解
    本文详细介绍了如何在HTML前端开发中利用UINavigationController进行页面管理和数据传递,适合初学者和有一定基础的开发者学习。 ... [详细]
  • 【小白学习C++ 教程】二十三、如何安装和使用 C++ 标准库
    【小白学习C++ 教程】二十三、如何安装和使用 C++ 标准库 ... [详细]
  • 本文分享了作者在不同版本的Ubuntu系统上尝试编译VLC for Android的经历,包括遇到的技术难题及解决方案,旨在帮助开发者避免常见的编译问题。 ... [详细]
  • Markdown 编辑技巧详解
    本文介绍如何使用 Typora 编辑器高效编写 Markdown 文档,包括代码块的插入方法等实用技巧。Typora 官方网站:https://www.typora.io/ 学习资源:https://www.markdown.xyz/ ... [详细]
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社区 版权所有