OpenStack-M版(Mitaka)搭建基于(Centos7.2)+++十、Openstack对象存储服务(swift)下

来源:互联网 发布:现在在淘宝做动漫周边 编辑:程序博客网 时间:2024/06/05 19:34

十、Openstack对象存储服务(swift)下

控制节点上执行



一、创建账户(account)ring


1.切换到 /etc/swift目录

[root@controller ~]# cd /etc/swift/[root@controller swift]# 



2.创建基本 account.builder 文件
swift-ring-builder account.builder create 10 1 1


参数解释:

(10)Ring的分区数

(1)表示副本数(我本来一个都不想要的结果要求至少一个副本

(1)表示分区数据的迁移时间为1小时

[root@controller swift]# swift-ring-builder account.builder create 10 1 1
此操作无返回


3.添加每个节点到 ring 中
swift-ring-builder account.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6002 --device sdb --weight 10

swift-ring-builder account.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6002 --device sdc --weight 10


--ip(存储节点管理网络ip我这里是安装在计算节点上所以是计算节点管理网络ip)

--port( 端点)

--device (存储设备名称)

--weight (存储设备大小)


[root@controller swift]# swift-ring-builder account.builder add \> --region 1 --zone 1 --ip 192.168.100.20 --port 6002 --device sdb --weight 10Device d0r1z1-192.168.100.20:6002R192.168.100.20:6002/sdb_"" with 10.0 weight got id 0[root@controller swift]# swift-ring-builder account.builder add \> --region 1 --zone 1 --ip 192.168.100.20 --port 6002 --device sdc --weight 10Device d1r1z1-192.168.100.20:6002R192.168.100.20:6002/sdc_"" with 10.0 weight got id 1


4.验证 ring 的内容

swift-ring-builder account.builder

[root@controller swift]# swift-ring-builder account.builderaccount.builder, build version 21024 partitions, 1.000000 replicas, 1 regions, 1 zones, 2 devices, 100.00 balance, 0.00 dispersionThe minimum number of hours before a partition can be reassigned is 1 (0:00:00 remaining)The overload factor is 0.00% (0.000000)Ring file account.ring.gz not found, probably it hasn't been written yetDevices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance flags meta             0       1     1  192.168.100.20  6002  192.168.100.20              6002       sdb  10.00          0 -100.00                    1       1     1  192.168.100.20  6002  192.168.100.20              6002       sdc  10.00          0 -100.00       


5.平衡 ring

swift-ring-builder account.builder rebalance

[root@controller swift]# swift-ring-builder account.builder rebalanceReassigned 1024 (100.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00




二、创建容器(container)ring


1.创建基本 container.builder 文件
swift-ring-builder container.builder create 10 1 1


参数解释:

(10)Ring的分区数

(1)表示副本数(我本来一个都不想要的结果要求至少一个副本

(1)表示分区数据的迁移时间为1小时

[root@controller 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 sdb --weight 10

swift-ring-builder container.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6001 --device sdc --weight 10


--ip(存储节点管理网络ip我这里是安装在计算节点上所以是计算节点管理网络ip)

--port( 端点)

--device (存储设备名称)

--weight (存储设备大小)


[root@controller swift]# swift-ring-builder container.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6001 --device sdb --weight 10Device d0r1z1-192.168.100.20:6001R192.168.100.20:6001/sdb_"" with 10.0 weight got id 0[root@controller swift]# swift-ring-builder container.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6001 --device sdc --weight 10Device d1r1z1-192.168.100.20:6001R192.168.100.20:6001/sdc_"" with 10.0 weight got id 1

3.验证 ring 的内容

swift-ring-builder container.builder

[root@controller swift]# swift-ring-builder container.buildercontainer.builder, build version 21024 partitions, 1.000000 replicas, 1 regions, 1 zones, 2 devices, 100.00 balance, 0.00 dispersionThe minimum number of hours before a partition can be reassigned is 1 (0:00:00 remaining)The overload factor is 0.00% (0.000000)Ring file container.ring.gz not found, probably it hasn't been written yetDevices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance flags meta             0       1     1  192.168.100.20  6001  192.168.100.20              6001       sdb  10.00          0 -100.00                    1       1     1  192.168.100.20  6001  192.168.100.20              6001       sdc  10.00          0 -100.00       


4.平衡 ring

swift-ring-builder container.builder rebalance

[root@controller swift]# swift-ring-builder container.builder rebalanceReassigned 1024 (100.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00



三、创建对象(object)ring


1.创建基本 object.builder 文件
swift-ring-builder object.builder create 10 1 1


参数解释:

(10)Ring的分区数

(1)表示副本数(我本来一个都不想要的结果要求至少一个副本

(1)表示分区数据的迁移时间为1小时

[root@controller swift]# 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 sdb --weight 10

swift-ring-builder object.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6000 --device sdc --weight 10


--ip(存储节点管理网络ip我这里是安装在计算节点上所以是计算节点管理网络ip)

--port( 端点)

--device (存储设备名称)

--weight (存储设备大小)

[root@controller swift]# swift-ring-builder object.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6001 --device sdb --weight 10Device d0r1z1-192.168.100.20:6001R192.168.100.20:6000/sdb_"" with 10.0 weight got id 0[root@controller swift]# swift-ring-builder object.builder add --region 1 --zone 1 --ip 192.168.100.20 --port 6001 --device sdc --weight 10Device d1r1z1-192.168.100.20:6001R192.168.100.20:6000/sdc_"" with 10.0 weight got id 1


3.验证 ring 的内容

swift-ring-builder object.builder

[root@controller swift]# swift-ring-builder object.builderobject.builder, build version 21024 partitions, 1.000000 replicas, 1 regions, 1 zones, 2 devices, 100.00 balance, 0.00 dispersionThe minimum number of hours before a partition can be reassigned is 1 (0:00:00 remaining)The overload factor is 0.00% (0.000000)Ring file object.ring.gz not found, probably it hasn't been written yetDevices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance flags meta             0       1     1  192.168.100.20  6001  192.168.100.20              6000       sdb  10.00          0 -100.00                    1       1     1  192.168.100.20  6001  192.168.100.20              6000       sdc  10.00          0 -100.00       


4.平衡 ring

swift-ring-builder object.builder rebalance

[root@controller swift]# swift-ring-builder object.builder rebalanceReassigned 1024 (100.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00




四、将文件发送到存储节点(我这里计算节点就是存储节点)

文件:object.ring.gz account.ring.gz container.ring.gz


scp *.gz 192.168.100.20:/etc/swift/

[root@controller swift]# scp *.gz 192.168.100.20:/etc/swift/The authenticity of host '192.168.100.20 (192.168.100.20)' can't be established.ECDSA key fingerprint is 5a:43:e9:cb:f4:eb:b4:b4:e6:26:1a:5a:f2:f3:55:56.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.100.20' (ECDSA) to the list of known hosts.root@192.168.100.20's password: account.ring.gz                                                                                                                                             100%  455     0.4KB/s   00:00    container.ring.gz                                                                                                                                           100%  448     0.4KB/s   00:00    object.ring.gz                                                                                                                                              100%  442     0.4KB/s   00:00    

可以在存储节点 /etc/swift 目录下查看是否有文件

[root@compute ~]# cd /etc/swift/[root@compute swift]# lsaccount.ring.gz  account-server  account-server.conf  container.ring.gz  container-server  container-server.conf  object.ring.gz  object-server  object-server.conf  swift.conf



五、配置swift.conf 文件



1.从对象存储源仓库中获取 /etc/swift/swift.conf 文件

curl -o /etc/swift/swift.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/swift.conf-sample


[root@controller swift]# curl -o /etc/swift/swift.conf   https://git.openstack.org/cgit/openstack/swift/plain/etc/swift.conf-sample  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                 Dload  Upload   Total   Spent    Left  Speed100  7894  100  7894    0     0   6718      0  0:00:01  0:00:01 --:--:--  6729

2.修改配置文件/etc/swift/swift.conf

vi /etc/swift/swift.conf


vi /etc/swift/swift.conf配置哈希路径前缀和后缀(获取的配置文件有默认值不用改)swift_hash_path_suffix = changemeswift_hash_path_prefix = changeme配置默认存储策略(获取的配置文件中这两个值是打开的其实不用管)[storage-policy:0]name = Policy-0default = yes

3.复制swift.conf文件到每个存储节点(我这里计算节点就是存储节点)

scp swift.conf 192.168.100.20:/etc/swift

[root@controller swift]# scp swift.conf 192.168.100.20:/etc/swiftroot@192.168.100.20's password: swift.conf                                                                                                                                                  100% 7894     7.7KB/s   00:00    

4.在所有节点上,赋予配置文件目录合适的所有权

chown -R root:swift /etc/swift


(控制节点)[root@controller swift]# chown -R root:swift /etc/swift(存储结点【计算节点】)[root@compute swift]# chown -R root:swift /etc/swift

阅读全文
3 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 微信版本低登录不了怎么办苹果手机 手机版本低登录不了微信怎么办? 进入微信公众号显示登录失败怎么办 安卓系统手机亮度调到最低怎么办 阿里妈妈买家号虚假交易违规怎么办 淘宝商让我修改追评叫我怎么办 红冲金额大于了当月的销售额怎么办 淘宝买家号虚假交易评价删除怎么办 淘宝卖的宝贝电话写错了怎么办 邮政快递都揽件了一直不运输怎么办 应用宝里面的安装包安装不了怎么办 苹果平板电脑充电接口坏了怎么办 读书郎平板电脑开不了机怎么办 平板电脑死机开不了机了怎么办 欧灵平板电脑忘记图密解锁怎么办 淘宝没货发给人被投诉了怎么办 淘宝店铺既不能开又不能注销怎么办 妻子被骗五万疑似被洗脑我该怎么办 奖虫账号和密码不匹配怎么办 开淘宝店余额宝里的钱怎么办 京东找不到所有宝贝的链接了怎么办 淘宝店链接改了标题没流量怎么办 淘宝手淘搜索自然流量少怎么办 4个月宝贝不食欲下降怎么办 淘宝商家预售时间到了不发货怎么办 淘宝修改类目被处置管控了怎么办 淘宝换手机号是已经注册了的怎么办 闲鱼违规把我淘宝店铺冻结了怎么办 开网店店主想买自己的东西怎么办 以前用微博登录头条的账号怎么办 公众号注册提示邮箱已被占用怎么办 学信网注册时出现邮箱被占用怎么办 手机淘宝店铺接不到买家消息怎么办 买了东西淘宝店铺没了怎么办 淘宝店铺直播间虚假交易违规怎么办 手机淘宝退款物流单号填错了怎么办 淘宝评价删除了卖家没有返现怎么办 想摆摊卖麻辣烫不知怎么摆怎么办 在淘宝卖东西买家退款不退货怎么办 在闲鱼网上买东西被骗了怎么办 开通花呗的手机号不用了怎么办