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


推荐阅读
  • PyCharm下载与安装指南
    本文详细介绍如何从官方渠道下载并安装PyCharm集成开发环境(IDE),涵盖Windows、macOS和Linux系统,同时提供详细的安装步骤及配置建议。 ... [详细]
  • 本文详细介绍如何使用Python进行配置文件的读写操作,涵盖常见的配置文件格式(如INI、JSON、TOML和YAML),并提供具体的代码示例。 ... [详细]
  • 技术分享:从动态网站提取站点密钥的解决方案
    本文探讨了如何从动态网站中提取站点密钥,特别是针对验证码(reCAPTCHA)的处理方法。通过结合Selenium和requests库,提供了详细的代码示例和优化建议。 ... [详细]
  • 探讨如何高效使用FastJSON进行JSON数据解析,特别是从复杂嵌套结构中提取特定字段值的方法。 ... [详细]
  • 在Linux系统中配置并启动ActiveMQ
    本文详细介绍了如何在Linux环境中安装和配置ActiveMQ,包括端口开放及防火墙设置。通过本文,您可以掌握完整的ActiveMQ部署流程,确保其在网络环境中正常运行。 ... [详细]
  • 资源推荐 | TensorFlow官方中文教程助力英语非母语者学习
    来源:机器之心。本文详细介绍了TensorFlow官方提供的中文版教程和指南,帮助开发者更好地理解和应用这一强大的开源机器学习平台。 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 1.如何在运行状态查看源代码?查看函数的源代码,我们通常会使用IDE来完成。比如在PyCharm中,你可以Ctrl+鼠标点击进入函数的源代码。那如果没有IDE呢?当我们想使用一个函 ... [详细]
  • CentOS7源码编译安装MySQL5.6
    2019独角兽企业重金招聘Python工程师标准一、先在cmake官网下个最新的cmake源码包cmake官网:https:www.cmake.org如此时最新 ... [详细]
  • 本文详细介绍了 Dockerfile 的编写方法及其在网络配置中的应用,涵盖基础指令、镜像构建与发布流程,并深入探讨了 Docker 的默认网络、容器互联及自定义网络的实现。 ... [详细]
  • 在哈佛大学商学院举行的Cyberposium大会上,专家们深入探讨了开源软件的崛起及其对企业市场的影响。会议指出,开源软件不仅为企业提供了新的增长机会,还促进了软件质量的提升和创新。 ... [详细]
  • 在Ubuntu 16.04 LTS上配置Qt Creator开发环境
    本文详细介绍了如何在Ubuntu 16.04 LTS系统中安装和配置Qt Creator,涵盖了从下载到安装的全过程,并提供了常见问题的解决方案。 ... [详细]
  • 本文详细介绍了如何在 Linux 平台上安装和配置 PostgreSQL 数据库。通过访问官方资源并遵循特定的操作步骤,用户可以在不同发行版(如 Ubuntu 和 Red Hat)上顺利完成 PostgreSQL 的安装。 ... [详细]
  • 使用Vultr云服务器和Namesilo域名搭建个人网站
    本文详细介绍了如何通过Vultr云服务器和Namesilo域名搭建一个功能齐全的个人网站,包括购买、配置服务器以及绑定域名的具体步骤。文章还提供了详细的命令行操作指南,帮助读者顺利完成建站过程。 ... [详细]
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社区 版权所有