(七)Open Stack(M)---- Swift安装和配置(上)

简介: (七)Open Stack(M)---- Swift安装和配置(上)

感谢指剑大佬发表的博客与视频!感谢所 爱大佬的支持!

(六)Open Stack(M)----Horizon(Dashboard)安装和配置

一:准备工作 ---- 硬盘添加

在虚拟机还没开机(关闭虚拟机后)时,在硬件配置compute节点上添加一个硬盘。

二:控制节点的配置

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.安装并配置swift组件

yum -y install openstack-swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached

4.编辑文件 /etc/swift/proxy-server.conf

删除原有内容,再进行添加

cp /etc/swift/proxy-server.conf /etc/swift/proxy-server.conf.bank
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

截图如下:

5.编辑文件/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]

截图如下:

6.添加权限

chown -R root:swift /etc/swift

三:存储节点的配置(计算节点充当存储节点)

1.安装软件包

yum -y install xfsprogs rsync openstack-swift-account openstack-swift-container openstack-swift-object

2.使用XFS格式化分区新设备

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

1.查看磁盘

lsblk

截图如下:

可以发现新添加的磁盘,即/dev/sdb

2.格式化

fdisk /dev/sdb

截图如下:

3.分区

mkfs.xfs  /dev/sdb1

4.创建挂载点目录结构

mkdir -p /sift/node

5.挂载

mount /dev/sdb1 /swift/node/

截图如下·:

6.编辑/etc/fstab文件并添加以下内容

vi /etc/fstab

追加如下内容:

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

截图如下:

3.编辑/etc/rsyncd.conf文件

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

截图如下:

4.启动rsyncd服务和配置开机自启

systemctl start rsyncd.service
 systemctl enable rsyncd.service

截图如下:

目录
相关文章
|
2月前
|
存储 Swift 对象存储
OpenStack的对象存储(Swift)
【8月更文挑战第24天】
56 1
|
2月前
|
存储 网络性能优化 块存储
OpenStack的块存储卷管理创建与配置
【8月更文挑战第27天】
46 3
|
5月前
|
安全 编译器 Swift
【Swift开发专栏】Swift的编译优化与构建配置
【4月更文挑战第30天】Swift编译优化与构建配置对开发效率和应用性能至关重要。编译优化包括不同级别的优化、函数内联、泛型特化、尾递归优化、死代码消除和链接时优化。在Xcode的"Build Settings"中可调整相关标志。构建配置涉及Debug与Release模式、自定义配置、条件编译、构建设置和脚本。开发时,应适时测试、选择适当优化级别、避免过度优化,并利用条件编译区分不同版本的代码。有效管理构建设置可提升开发质量和性能。
71 0
|
5月前
|
存储 运维 Swift
openstack cinder、swift运维命令
Cinder是OpenStack的块存储服务,提供虚拟机块设备功能,包括卷的创建、挂载等。它由cinder-api、cinder-scheduler和cinder-volume三个组件构成,前者处理请求,中间者负责调度,后者执行卷管理。Swift是OpenStack的分布式对象存储服务,高可用、持久性,适用于大文件存储。Swift架构对称,无单点故障,提供类似文件系统的简单逻辑和高效读写。Cinder关注虚拟机层面的块存储,而Swift则提供对象存储服务。命令示例展示了如何使用cinder和openstack命令操作云硬盘和Swift容器。
110 0
|
5月前
|
Ubuntu Linux Swift
安装Swift编程语言的工具
安装Swift编程语言的工具
119 4
|
API 数据库
(九)Open Stack(M)--- Heat安装和配置
(九)Open Stack(M)--- Heat安装和配置
135 0
|
存储 API 数据库
(八)Open Stack(M)---Cinder安装和配置
(八)Open Stack(M)---Cinder安装和配置
113 0
|
存储 Swift 对象存储
(七)Open Stack(M)---- Swift安装和配置(下)
(七)Open Stack(M)---- Swift安装和配置(下)
74 0
|
3月前
|
Unix 调度 Swift
苹果iOS新手开发之Swift 中获取时间戳有哪些方式?
在Swift中获取时间戳有四种常见方式:1) 使用`Date`对象获取秒级或毫秒级时间戳;2) 通过`CFAbsoluteTimeGetCurrent`获取Core Foundation的秒数,需转换为Unix时间戳;3) 使用`DispatchTime.now()`获取纳秒级精度的调度时间点;4) `ProcessInfo`提供设备启动后的秒数,不表示绝对时间。不同方法适用于不同的精度和场景需求。
68 3