↓↓↓↓↓↓↓↓视频已上线B站↓↓↓↓↓↓↓↓

》》》》》》传送门

本次搭建仅采用Compute单节点做swift组件

1.Controller安装并配置控制节点

2.Compute安装和配置存储节点

3.Compute节点安装并配置组件

4.Controller节点创建,分发并初始化rings

5.启动服务

6.Controller执行验证操作

1.Controller安装并配置控制节点

1.获得凭证并创建身份认证服务的凭证

# . /root/admin-openrc

# openstack user create --domain default --password 000000 swift
# openstack role add --project service --user swift admin #openstack service create --name swift --description "OpenStack Object Storage" object-store

2.创建对象存储服务 API 端点

# openstack endpoint create --region RegionOne object-store public http://controller:8080/v1/AUTH_%\(tenant_id\)s

# openstack endpoint create --region RegionOne object-store internal http://controller:8080/v1/AUTH_%\(tenant_id\)s

# openstack endpoint create --region RegionOne object-store admin http://controller:8080/v1



3.安装并配置组件

[root@controller ~]# yum -y install openstack-swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached

编辑文件 /etc/swift/proxy-server.conf,删除原有内容,直接添加如下内容

# vi /etc/swift/proxy-server.conf

[DEFAULT]
bind_port = 8080
swift_dir = /etc/swift
user = swift
[pipeline:main]
pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging proxy-server
[app:proxy-server]
use = egg:swift#proxy
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
user_test5_tester5 = testing5 service
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = swift
password = 000000
delay_auth_decision = True
[filter:keystoneauth]
use = egg:swift#keystoneauth
operator_roles = admin,user
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:cache]
memcache_servers = controller:11211
use = egg:swift#memcache
[filter:ratelimit]
use = egg:swift#ratelimit
[filter:domain_remap]
use = egg:swift#domain_remap
[filter:catch_errors]
use = egg:swift#catch_errors
[filter:cname_lookup]
use = egg:swift#cname_lookup
[filter:staticweb]
use = egg:swift#staticweb
[filter:tempurl]
use = egg:swift#tempurl
[filter:formpost]
use = egg:swift#formpost
[filter:name_check]
use = egg:swift#name_check
[filter:list-endpoints]
use = egg:swift#list_endpoints
[filter:proxy-logging]
use = egg:swift#proxy_logging
[filter:bulk]
use = egg:swift#bulk
[filter:slo]
use = egg:swift#slo
[filter:dlo]
use = egg:swift#dlo
[filter:container-quotas]
use = egg:swift#container_quotas
[filter:account-quotas]
use = egg:swift#account_quotas
[filter:gatekeeper]
use = egg:swift#gatekeeper
[filter:container_sync]
use = egg:swift#container_sync
[filter:xprofile]
use = egg:swift#xprofile
[filter:versioned_writes]
use = egg:swift#versioned_writes

编辑文件/etc/swift/swift.conf 删除原有内容,添加如下内容

# vi /etc/swift/swift.conf

[swift-hash]
swift_hash_path_suffix = changeme
swift_hash_path_prefix = changeme
[storage-policy:0]
name = Policy-0
default = yes
aliases = yellow, orange
[swift-constraints]
添加权限

# chown -R root:swift /etc/swift

2.Compute安装和配置存储节点

1.安装软件包
[root@compute ~]# yum -y install xfsprogs rsync openstack-swift-account openstack-swift-container openstack-swift-object
2.使用XFS格式化/dev/sdc设备

搭建Swift存储节点需要一块空盘,此处我们查看添加的空盘

# lsblk



创建分区

# fdisk /dev/sdc

# mkfs.xfs  /dev/sdc1

3.创建挂载点目录结构
[root@compute ~]# mkdir -p /swift/node

4.编辑/etc/fstab文件并添加以下内容
# vi /etc/fstab

/dev/sdc1 /swift/node xfs noatime,nodiratime,nobarrier,logbufs=8 0 0

5.挂载设备
[root@compute ~]# mount /dev/sdc1 /swift/node/

6.编辑/etc/rsyncd.conf文件并添加以下内容
[root@compute ~]#vi /etc/rsyncd.conf

pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
uid = swift
gid = swift
address = 127.0.0.1
[account]
path = /swift/node
read only = false
write only = no
list = yes
incoming chmod = 0644
outgoing chmod = 0644
max connections = 25
lock file = /var/lock/account.lock
[container]
path = /swift/node
read only = false
write only = no
list = yes
incoming chmod = 0644
outgoing chmod = 0644
max connections = 25
lock file = /var/lock/container.lock
[object]
path = /swift/node
read only = false
write only = no
list = yes
incoming chmod = 0644
outgoing chmod = 0644
max connections = 25
lock file = /var/lock/object.lock
[swift_server]
path = /etc/swift
read only = true
write only = no
list = yes
incoming chmod = 0644
outgoing chmod = 0644
max connections = 5
lock file = /var/lock/swift_server.lock

7.启动 “rsyncd” 服务和配置它随系统启动
# systemctl start rsyncd.service
# systemctl enable rsyncd.service

3.Compute节点安装并配置组件

1.编辑 /etc/swift/account-server.conf 文件,删除原有内容,直接添加以下内容
#vi /etc/swift/account-server.conf

[DEFAULT]
bind_port = 6002
user = swift
swift_dir = /etc/swift
devices = /swift/node
mount_check = false
[pipeline:main]
pipeline = healthcheck recon account-server
[app:account-server]
use = egg:swift#account
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
[account-replicator]
[account-auditor]
[account-reaper]
[filter:xprofile]
use = egg:swift#xprofile

2.编辑/etc/swift/container-server.conf文件,删除原有内容,直接添加以下内容:
# vi /etc/swift/container-server.conf

[DEFAULT]
bind_port = 6001
user = swift
swift_dir = /etc/swift
devices = /swift/node
mount_check = false
[pipeline:main]
pipeline = healthcheck recon container-server
[app:container-server]
use = egg:swift#container
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
[container-replicator]
[container-updater]
[container-auditor]
[container-sync]
[filter:xprofile]
use = egg:swift#xprofile

3.编辑/etc/swift/object-server.conf文件,删除原有内容,直接添加以下内容:
# vi /etc/swift/object-server.conf

[DEFAULT]
bind_port = 6000
user = swift
swift_dir = /etc/swift
devices = /swift/node
mount_check = false
[pipeline:main]
pipeline = healthcheck recon object-server
[app:object-server]
use = egg:swift#object
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:recon]
use = egg:swift#recon
recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock
[object-replicator]
[object-reconstructor]
[object-updater]
[object-auditor]
[filter:xprofile]
use = egg:swift#xprofile

4.编辑文件/etc/swift/swift.conf 删除原有内容,添加如下内容
# vi /etc/swift/swift.conf

[swift-hash]
swift_hash_path_suffix = changeme
swift_hash_path_prefix = changeme
[storage-policy:0]
name = Policy-0
default = yes
aliases = yellow, orange
[swift-constraints]

5.确认挂载点目录结构是否有合适的所有权:
# chown -R swift:swift /swift/node

6.创建 “recon” 目录和确保它有合适的所有权:
# mkdir -p /var/cache/swift
# chown -R root:swift /var/cache/swift
# chmod -R 775 /var/cache/swift
# chown -R root:swift /etc/swift

4.Controller节点创建,分发并初始化rings

1.创建账户ring

1.切换到 ``/etc/swift``目录。创建基本 account.builder 文件:

# cd /etc/swift
# swift-ring-builder account.builder create 18 1 1
2.添加每个节点到 ring 中:
# swift-ring-builder account.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6002 --device sdc1 --weight 100
3.验证ring内容
# swift-ring-builder account.builder
4.平衡ring
# swift-ring-builder account.builder rebalance

2.创建ring容器

1.切换到 ``/etc/swift``目录。创建基本``container.builder``文件:
# cd /etc/swift
# swift-ring-builder container.builder create 10 1 1
2.添加每个节点到 ring 中:
# swift-ring-builder container.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6001 --device sdc1 --weight 100
3.验证 ring 的内容:
# swift-ring-builder container.builder
4.平衡 ring:
# swift-ring-builder container.builder rebalance

3.创建Ring对象

1.切换到 ``/etc/swift``目录。创建基本``object.builder``文件:
# swift-ring-builder object.builder create 10 1 1
2.添加每个节点到 ring 中:
# swift-ring-builder object.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6000 --device sdc1 --weight 100
3.验证 ring 的内容:
# swift-ring-builder object.builder
4.平衡 ring:
# swift-ring-builder object.builder rebalance

4.Compute节点复制Controller的配置文件

复制``account.ring.gz``,container.ring.gz``和``object.ring.gz 文件到每个存储节点和其他运行了代理服务的额外节点的 /etc/swift 目录。
[root@compute ~]# scp controller:/etc/swift/*.ring.gz /etc/swift/

5.启动服务

1.在控制节点Controller上,启动对象存储代理服务及其依赖服务,并将它们配置为随系统启动:

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

2.在存储节点Compute上,启动对象存储服务,并将其设置为随系统启动

# 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-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.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-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.service # systemctl start openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service
# systemctl enable openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service

6.Controller执行验证操作

1.导入demo凭证

# . /root/demo-openrc

2. 显示服务状态:

# swift stat

3.创建容器 container1

# openstack container create container1

4.上传一个测试文件到container1容器

# openstack object create container1 /root/demo-openrc

5.列出container1容器里的所有文件

# openstack object list container1

6.从container1容器里下载一个测试文件

# openstack object save container1 /root/demo-openrc

(九)OpenStack---M版---双节点搭建---Swift(单节点)安装和配置的更多相关文章

  1. 纯手工搭建K8s(单节点)

    准备说明: 因为为纯手动搭建,所以针对安装时需要的一些安装包需提前下载好 cfssl_linux-amd64. cfssljson_linux-amd64. cfssl-certinfo_linux- ...

  2. openstack Q版部署-----环境搭建(1)

    浏览器建议全程使用火狐或者谷歌,不然VNC可能会有问题 一.环境准备 系统:centos7.2 x86_64 controller 2c+8g+40g 10.1.80.110 可以nat上网 comp ...

  3. hadoop-2.6.0.tar.gz + spark-1.5.2-bin-hadoop2.6.tgz的集群搭建(单节点)

    前言 本人呕心沥血所写,经过好一段时间反复锤炼和整理修改.感谢所参考的博友们!同时,欢迎前来查阅赏脸的博友们收藏和转载,附上本人的链接.http://www.cnblogs.com/zlslch/p/ ...

  4. Openstack入门篇(十七)之Cinder服务-->安装并配置一个本地存储节点

    怎样为块存储服务安装并配置存储节点.为简单起见,这里配置一个有一个空的本地块存储设备的存储节点.这个向导用的是 /dev/sdb,此处选用linux-node1节点作为存储节点,需要在vmware中添 ...

  5. hadoop-2.6.0.tar.gz + spark-1.5.2-bin-hadoop2.6.tgz的集群搭建(单节点)(Ubuntu系统)

    前言 本人呕心沥血所写,经过好一段时间反复锤炼和整理修改.感谢所参考的博友们!同时,欢迎前来查阅赏脸的博友们收藏和转载,附上本人的链接.http://www.cnblogs.com/zlslch/p/ ...

  6. hadoop-2.6.0.tar.gz + spark-1.6.1-bin-hadoop2.6.tgz的集群搭建(单节点)(CentOS系统)

    福利 => 每天都推送 欢迎大家,关注微信扫码并加入我的4个微信公众号:   大数据躺过的坑      Java从入门到架构师      人工智能躺过的坑         Java全栈大联盟   ...

  7. Spring-Cloud之Eureka注册中心环境搭建(单节点)

    一 Eureka概述 服务启动时会生成服务的基本信息对象InstanceInfo,然后在启动时会register到服务治理中心. 注册完成后会从服务治理中心拉取所有的服务信息,缓存在本地. 之后服务会 ...

  8. openstack controller ha测试环境搭建记录(十四)——配置cinder(存储节点)

    先简述cinder存储节点的配置:  1.IP地址是10.0.0.41:  2.主机名被设置为block1:  3.所有节点的hosts文件已添加相应条目:  4.已经配置了ntp时间同步:  5.已 ...

  9. openstack controller ha测试环境搭建记录(十二)——配置neutron(计算节点)

    在计算节点配置内核参数:vi /etc/sysctl.confnet.ipv4.conf.all.rp_filter=0net.ipv4.conf.default.rp_filter=0 在计算节点使 ...

随机推荐

  1. js字符串操作总结(必看篇)

    本文链接: https://www.jb51.net/article/97915.htm 字符方法 <!DOCTYPE html> <html lang="en" ...

  2. Python 栈(stack)

    Python 栈(stack) 栈(stack)又名堆栈,它是一种运算受限的线性表 栈只能在一端进行插入和删除操作,它按照先进后出(FILO)的原则存储数据,先进入的数据被压入栈底,最后的数据在栈顶 ...

  3. vue 使用JavaScript表达式

    vue使用JavaScript的运算方式 代码如下: <!doctype html> <html lang="en"> <head> <m ...

  4. json去除value值的前后空格

    /** * @Title: JsonStrTrim * @author : jsw * @date : 2012-12-7 * @time : 上午09:19:18 * @Description: 传 ...

  5. k8s云集群混搭模式落地分享

    在 <k8s云集群混搭模式,可能帮你节省50%以上的服务成本>一文中,介绍了使用k8s + 虚拟节点混合集群的方式,为负载具有时间段波峰.波谷交替规律的业务节约成本,提高服务伸缩效率的部署 ...

  6. HTML连载40-盒子宽度和高度的练习、box-sizing属性

    一.判断方法 1.判断是否元素宽高为200的盒子 只需要看:边框+内边距+内容宽度/内容高度的值是否等于200 2.判断是否内容宽高为100的盒子 只需要看:width和heght的值是否等于100 ...

  7. liunx下安装mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz

    1.解压准备一个赶紧的环境,然后安装mysql. 2.cd到/usr/local/目录下,修改文件名为mysql 修改完目录名以后我们cd到mysql下,建立一个data目录命令:cd mysql/ ...

  8. .NET Core 多框架支持(net45+netstandard20)实践中遇到的一些问题总结

    .NET Core 多框架支持(net45+netstandard20)实践中遇到的一些问题总结 前言 本文主要是关于.NET Standard 代码 在多框架 和 多平台 支持自己实践过程中遇到的一 ...

  9. 解决前后端调用,跨域二次请求Access-Control-Max-Age

    发现前后端分离的项目中,前端发起一个请求到后端,在Chrome浏览器下面debug的时候,Network下面看到同一个url有两条请求,url有两条请求,第一条请求的Method为OPTIONS,第二 ...

  10. 使用SolrJ(即java客户端)开发Solr。

    1.什么是SolrJ呢? 答:Solrj是访问Solr服务的java客户端,提供索引和搜索的请求方法,SolrJ通常在嵌入在业务系统中,通过SolrJ的API接口操作Solr服务.开始配置schema ...