openstack学习(七):swift配置以及使用

记录,方便查阅。



只做部分解释

Install and configure the controller node

keystone user-create --name swift --pass swift
keystone user-role-add --user swift --tenant service --role admin
keystone service-create --name swift --type object-store --description "OpenStack Object Storage"

keystone endpoint-create --service-id $(keystone service-list | awk ‘/ object-store / {print $2}‘) --publicurl ‘http://controller:8080/v1/AUTH_%(tenant_id)s‘ --internalurl ‘http://controller:8080/v1/AUTH_%(tenant_id)s‘ --adminurl http://controller:8080 \
--region regionOne
yum install openstack-swift-proxy python-swiftclient python-keystone-auth-token python-keystonemiddleware memcached -y

从github获取配置文件

curl -o /etc/swift/proxy-server.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/proxy-server.conf-sample

/etc/swift/proxy-server.conf

[DEFAULT]
bind_port = 8080
user = swift
swift_dir = /etc/swift
[pipeline:main]
pipeline = authtoken cache healthcheck keystoneauth proxy-logging proxy-server
[app:proxy-server]
allow_account_management = true
account_autocreate = true

[filter:keystoneauth]
use = egg:swift#keystoneauth
operator_roles = admin,_member_  #用户管理,以及使用的用户
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = swift
admin_password = swift
delay_auth_decision = true

[filter:cache]
memcache_servers = 127.0.0.1:11211

Install and configure the storage nodes

包含2块块设备,添加2块硬盘,sdb、sdc

fdisk 分区sdb1、sdc1

yum install xfsprogs rsync
mkfs.xfs /dev/sdb1  #文件系统推荐xfs
mkfs.xfs /dev/sdc1

mkdir -p /srv/node/sdb1  #创建挂载点
mkdir -p /srv/node/sdc1

/etc/fstab  启动自动挂载点

/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
/dev/sdc1 /srv/node/sdc1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
mount -a  #读取配置文件并挂载
mount /srv/node/sdb1
mount /srv/node/sdc1

/etc/rsyncd.conf  同步服务

uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 192.168.23.12
[account]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/account.lock
[container]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/container.lock
[object]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/object.lock
yum install openstack-swift-account openstack-swift-container openstack-swift-object -y

获取account、container、object配置文件:

curl -o /etc/swift/account-server.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/account-server.conf-sample
curl -o /etc/swift/container-server.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/container-server.conf-sample
curl -o /etc/swift/object-server.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/object-server.conf-sample

/etc/swift/account-server.conf

[DEFAULT]
...
bind_ip = 192.168.23.11
bind_port = 6002
user = swift
swift_dir = /etc/swift
devices = /srv/node
[pipeline:main]
pipeline = healthcheck recon account-server
[filter:recon]
recon_cache_path = /var/cache/swift

/etc/swift/container-server.conf

[DEFAULT]
bind_ip = 192.168.23.11
bind_port = 6001
user = swift
swift_dir = /etc/swift
devices = /srv/node
[pipeline:main]
pipeline = healthcheck recon container-server
[filter:recon]
recon_cache_path = /var/cache/swift

/etc/swift/object-server.conf

[DEFAULT]
bind_ip = 192.168.23.11
bind_port = 6001
user = swift
swift_dir = /etc/swift
devices = /srv/node
[pipeline:main]
pipeline = healthcheck recon container-server
[filter:recon]
recon_cache_path = /var/cache/swift

文件夹权限:

chown -R swift:swift /srv/node
mkdir -p /var/cache/swift
chown -R swift:swift /var/cache/swift

Create initial rings

Controller

cd /etc/swift  创建环

swift-ring-builder account.builder create 10 3 1
swift-ring-builder account.builder add r1z1-192.168.23.12:6002/sdb1 100  #添加存储区
swift-ring-builder account.builder add r1z1-192.168.23.12:6002/sdc1 100
swift-ring-builder account.builder  #查看环
swift-ring-builder account.builder rebalance  #负载均衡环

swift-ring-builder container.builder create 10 3 1
swift-ring-builder container.builder add r1z1-192.168.23.12:6001/sdb1 100
swift-ring-builder container.builder add r1z1-192.168.23.12:6001/sdc1 100
swift-ring-builder container.builder
swift-ring-builder container.builder rebalance

swift-ring-builder object.builder create 10 3 1
swift-ring-builder object.builder add r1z1-192.168.23.12:6000/sdb1 100
swift-ring-builder object.builder add r1z1-192.168.23.12:6000/sdc1 100
swift-ring-builder object.builder
swift-ring-builder object.builder rebalance

Distribute ring configuration files

Copy the account.ring.gz, container.ring.gz, and object.ring.gz files to the /etc/swift directory on each storage node and any additional nodes running the proxy service.

scp -r account.ring.gz container.ring.gz object.ring.gz [email protected]192.168.23.12:/etc/swift/

Finalize installation

controller

curl -o /etc/swift/swift.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/swift.conf-sample  #swift.conf
[swift-hash]
swift_hash_path_suffix = yippee  #HASH前缀swift_hash_path_prefix = yippee  #HASH后缀

[storage-policy:0]
name = Policy-0
default = yes

Copy the swift.conf file to the /etc/swift directory on each storage node and any additional nodes running the proxy service.

scp -r swift.conf object.ring.gz [email protected]192.168.23.12:/etc/swift/

all nodes

文件夹权限:

chown -R swift:swift /etc/swift

On the controller node and any other nodes running the proxy service

systemctl enable openstack-swift-proxy.service memcached.service
systemctl start openstack-swift-proxy.service memcached.service

storage nodes

systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.service
systemctl start openstack-swift-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.service
systemctl enable openstack-swift-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.service
systemctl start openstack-swift-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.service
systemctl enable openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service
systemctl start openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service

重启时出现无法创建容器问题以及容器不见了的问题,三个服务未启动,端口被占用;

swift-init all start
netstat –tnlp
kill -9 xxx  #删除对应pid
swift init all restart

至此,swift安装完成。

时间: 2024-10-07 20:08:36

openstack学习(七):swift配置以及使用的相关文章

理解 OpenStack Swift (1):OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置

本系列文章着重学习和研究OpenStack Swift,包括环境搭建.原理.架构.监控和性能等. (1)OpenStack + 三节点Swift 集群+ HAProxy + UCARP 安装和配置 (2)Swift 原理和架构 (3)Swift 监控 (4)Swift 性能 要实现的系统的效果图: 特点: 使用三个对等物理节点,每个节点上部署所有Swift 服务 使用开源的 UCARP 控制一个 VIP,它会被绑定到三个物理网卡中的一个. 使用开源的 HAProxy 做负载均衡 开启 Swift

(转载)openstack学习指南

OpenStack Hacker养成指南 朱 荣泽     |     2013. 8. 8 [toc wrapping="right"] 0 阅读指南 希望本文能够解开你心中萦绕已久的心结,假如是死结,请移步到 https://wiki.openstack.org/wiki/Main_Page 学习OpenStack其实就是学习各种Python库的过程. 把OpenStack的设计原则贴在你的墙上. https://wiki.openstack.org/wiki/BasicDesig

springMVC3学习(七)--Interceptor拦截器

Spring为我们提供了:org.springframework.web.servlet.HandlerInterceptor接口, org.springframework.web.servlet.handler.HandlerInterceptorAdapter适配器, 实现这个接口或继承此类,能够很方便的实现自己的拦截器. 有下面三个方法: Action之前运行 public boolean preHandle(HttpServletRequest request, HttpServletR

Spark学习七:spark streaming与flume集成

Spark学习七:spark streaming与flume集成 标签(空格分隔): Spark 一,启动flume flume-conf.properties文件 agent002.sources = sources002 agent002.channels = channels002 agent002.sinks = sinks002 ## define sources agent002.sources.sources002.type = exec agent002.sources.sour

iOS: 学习笔记, Swift操作符定义

Swift操作符可以自行定义, 只需要加上简单的标志符即可. @infix 中置运算. 如+,-,*,/运算 @prefix 前置运算. 如- @postfix 后置运算. a++, a-- @assignment 赋值运算. +=, -=, --a, ++a // // main.swift // SwiftBasic // // Created by yao_yu on 14-7-27. // Copyright (c) 2014年 yao_yu. All rights reserved.

Jetty学习三:配置概览-需要配置什么

上一节讲述了怎么配置Jetty,这节将告诉你使用Jetty你需要配置些什么. 配置Server Server实例是Jetty服务端的中心协调对象,它为所有其他Jetty服务端组件提供服务和生命周期管理.在标准Jetty发布中,核心的服务端配置是在etc/jetty.xml文件中,你也能在其中包含其他服务端配置,可以包括: 1)ThreadPool Server实例提供了一个线程池,你可以在etc/jetty.xml中配置最大线程数和最小线程数. 2)Handlers Jetty服务端只能有一个H

Swift学习——A Swift Tour 枚举和结构体

Enumerations and Structures Enumerations   枚举的使用 使用 enum 定义一个枚举,枚举里面可以关联方法,比如下文中的描述方法 enum Rank: Int { case Ace = 1 case Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten case Jack, Queen, King func simpleDescription() -> String { switch self { ca

Jetty学习二:配置概览-怎么配置Jetty

Jetty POJO配置 Jetty的核心组件是Plain Old Java Objects(POJOs):配置Jetty的大部分工作就是在Jetty POJOs上的初始化.装配和设置域的处理,你能通过以下的方式来实现:  1)直接通过Java代码初始化和装配Jetty对象.这个在后面Embedding Jetty讲. 2)用Jetty XML配置(一个控制反转(IoC)框架)初始化和装配Jetty对象.etc/jetty.xml文件是基本的Jetty XML配置文件,但有一些其它的etc/je

Selenium Webdriver 学习总结-Jenkins配置(八)

这周单位要做一个人脸美化的项目,查资料遇到这位大牛的博客,地址如下:点击打开链接 我的代码也是在他的基础上进行修改的,但是他对图像的RGB三个通道平等调节,为了适应我的需求,我改成了针对三个通道分别调节.废话不多说,开始上源码 void ImageAdjust(Mat& src, Mat& dst, vector<double> low_in, vector<double> high_in, vector<double> low_out, vector&

深度学习主机环境配置: Ubuntu16.04 + GeForce GTX 1070 + CUDA8.0 + cuDNN5.1 + TensorFlow

深度学习主机环境配置: Ubuntu16.04 + GeForce GTX 1070 + CUDA8.0 + cuDNN5.1 + TensorFlow 最近在公司做深度学习相关的学习和实验,原来一直在自己的电脑上安装虚拟机跑,速度实在太慢,主机本身性能太弱,独显都没有,物理安装Ubuntu也没多大意义,所以考虑用公司性能最强悍的游戏主机(i7 6700+GTX 1070) 做实验,这台主机平时是用来跑HTC VIVE的,现在归我用了o(*≧▽≦)ツ. 原本以为整个一套安装下来会很顺利,一路火花