分享

Openstack存储swift多代理节点安装配置

sunshine_junge 发表于 2014-10-6 18:59:14 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 16558
本帖最后由 sunshine_junge 于 2014-10-6 19:01 编辑


问题导读:
1. Openstack存储swift多代理节点如何安装配置?
2. 如何新增一个节点?










Openstack的存储多代理的架构国内比较有名就是新浪SAE部署的Swift集群
本文参考Openstack官网openstack-install-guide-essex-ubuntu.pdf和os-compute-starterguide-essex.pdf文档,文档汉化版本貌似还没有,如需下载请移步Openstack官网
回归正题,以下是配置过程简单步骤



一、当前配置环境

系统:Ubuntu Server 12.04×64 存储设置:vdb1 20G

  1. 架构部署
  2. 主机名                 IP                    作用
  3. Proxy            192.168.100.7         代理节点
  4. object1          192.168.100.3        存储节点1(zone1)
  5. object2          192.168.100.4        存储节点2(zone2)
  6. 增加代理节点
  7. Proxybak         192.168.100.8      代理做冗余备份
复制代码




二、配置部署

1、安装代理节点Proxy
  1. apt-get update
  2. apt-get install swift swift-proxy memcached python-keystone python-keystoneclient
复制代码



2、创建swift.conf
  1. cat >/etc/swift/swift.conf <<EOF
  2. [swift-hash]
  3. # random unique string that can never change (DO NOT LOSE)
  4. swift_hash_path_suffix = `od -t x8 -N 8 -A n </dev/random`
  5. EOF
复制代码


3、创建Swift 的工作目录
  1. <b>mkdir -p /etc/swift
  2. chown -R swift:swift /etc/swift/</b>
复制代码

4、配置memcached ,监听默认的端口
  1. perl -pi -e "s/-l 127.0.0.1/-l 192.168.100.7/" /etc/memcached.conf
  2. service memcached restart
复制代码



5、创建/etc/swift/proxy-server.conf
  1. [DEFAULT]
  2. bind_port = 8080
  3. user = swift
  4. swift_dir = /etc/swift
  5. [pipeline:main]
  6. pipeline = catch_errors healthcheck cache authtoken keystone proxy-server
  7. [app:proxy-server]
  8. use = egg:swift#proxy
  9. account_autocreate = true
  10. [filter:keystone]
  11. paste.filter_factory = keystone.middleware.swift_auth:filter_factory
  12. operator_roles = admin, swiftoperator
  13. [filter:authtoken]
  14. paste.filter_factory = keystone.middleware.auth_token:filter_factory
  15. # Delaying the auth decision is required to support token-less
  16. # usage for anonymous referrers ('.r:*').
  17. delay_auth_decision = 1
  18. auth_protocol = http
  19. auth_host = 192.168.3.97
  20. auth_port = 35357
  21. auth_token = admin
  22. service_protocol = http
  23. service_host = 192.168.3.97
  24. service_port = 5000
  25. admin_token = admin
  26. admin_tenant_name = service
  27. admin_user = swift
  28. admin_password = swift
  29. [filter:cache]
  30. use = egg:swift#memcache
  31. memcache_servers = 192.168.100.7:11211
  32. set log_name = cache
  33. [filter:catch_errors]
  34. use = egg:swift#catch_errors
  35. [filter:healthcheck]
  36. use = egg:swift#healthcheck
复制代码



6、创建account,container,object
  1. cd /etc/swift
  2. swift-ring-builder object.builder create 7 2 1
  3. swift-ring-builder container.builder create 7 2 1
  4. swift-ring-builder account.builder create 7 2 1
  5. 创建Ring
  6. 需要记录每个Store Node /srv/node 中记录的存储设备
  7. swift-ring-builder account.builder add z1-192.168.100.3:6002/vdb1 1
  8. swift-ring-builder container.builder add z1-192.168.100.3:6001/vdb1 1
  9. swift-ring-builder object.builder add z1-192.168.100.3:6000/vdb1 1
  10. swift-ring-builder account.builder add z2-192.168.100.4:6002/vdb1 1
  11. swift-ring-builder container.builder add z2-192.168.100.4:6001/vdb1 1
  12. swift-ring-builder object.builder add z2-192.168.100.4:6000/vdb1 1
  13. 确认ring 的内容是否正确:
  14. swift-ring-builder account.builder
  15. swift-ring-builder container.builder
  16. swift-ring-builder object.builder
  17. 平衡(Rebalance) ring
  18. swift-ring-builder account.builder rebalance
  19. swift-ring-builder container.builder rebalance
  20. swift-ring-builder object.builder rebalance
  21. 开启Proxy 服务
  22. chown -R swift:swift /etc/swift
  23. #需要存储节点启动后再启动
  24. swift-init proxy start
复制代码




三、部署配置存储节点

存储节点二台配置基本一致,此处只以其中一个为例

1、安装
  1. apt-get update
  2. apt-get install swift swift-account swift-container swift-object xfsprogs
复制代码



2、创建一个新的分区
  1. fdisk /dev/vdb
  2. #创建xfs 文件系统
  3. mkfs.xfs -i size=1024 /dev/vdb1
  4. #添加到启动时挂载分区
  5. echo "/dev/vdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab
  6. mkdir -p /srv/node/vdb1
  7. mount /dev/vdb1 /srv/node/vdb1
  8. chown -R swift:swift /srv/node
复制代码



3、创建Swift 的工作目录
  1. mkdir -p /etc/swift
  2. chown -R swift:swift /etc/swift/
复制代码



4、从proxy 节点中复制配置文件
  1. scp 192.168.100.7:/etc/swift/swift.conf /etc/swift/
  2. scp 192.168.100.7:/etc/swift/object.ring.gz /etc/swift/
  3. scp 192.168.100.7:/etc/swift/container.ring.gz /etc/swift/
  4. scp 192.168.100.7:/etc/swift/account.ring.gz /etc/swift/
复制代码



5、创建/etc/rsyncd.conf
  1. uid = swift
  2. gid = swift
  3. log file = /var/log/rsyncd.log
  4. pid file = /var/run/rsyncd.pid
  5. address = 192.168.100.3 (第二台存储即写ip:192.168.100.4)
  6. [account]
  7. max connections = 2
  8. path = /srv/node/
  9. read only = false
  10. lock file = /var/lock/account.lock
  11. [container]
  12. max connections = 2
  13. path = /srv/node/
  14. read only = false
  15. lock file = /var/lock/container.lock
  16. [object]
  17. max connections = 2
  18. path = /srv/node/
  19. read only = false
  20. lock file = /var/lock/object.lock
复制代码



6、修改/etc/default/rsync 中的RSYNC_ENABLE= 属性
  1. perl -pi -e 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/' /etc/default/rsync
  2. service rsync start
复制代码



7、创建/etc/swift/account-server.conf
  1. cat >/etc/swift/account-server.conf < [DEFAULT]
  2. devices = /srv/node
  3. mount_check = false
  4. bind_port = 6002
  5. user = swift
  6. log_facility = LOG_LOCAL2
  7. bind_ip =0.0.0.0
  8. workers = 2
  9. [pipeline:main]
  10. pipeline = account-server
  11. [app:account-server]
  12. use = egg:swift#account
  13. [account-replicator]
  14. [account-auditor]
  15. [account-reaper]
  16. EOF
复制代码



8、创建/etc/swift/container-server.conf
  1. cat >/etc/swift/container-server.conf < [DEFAULT]
  2. devices = /srv/node
  3. mount_check = false
  4. bind_port = 6001
  5. user = swift
  6. log_facility = LOG_LOCAL3
  7. bind_ip =0.0.0.0
  8. workers = 2
  9. [pipeline:main]
  10. pipeline = container-server
  11. [app:container-server]
  12. use = egg:swift#container
  13. [container-replicator]
  14. [container-updater]
  15. [container-auditor]
  16. EOF
复制代码



9、创建/etc/swift/object-server.conf
  1. cat >/etc/swift/object-server.conf < [DEFAULT]
  2. devices = /srv/node
  3. mount_check = false
  4. bind_port = 6000
  5. user = swift
  6. log_facility = LOG_LOCAL4
  7. bind_ip = 0.0.0.0
  8. workers = 2
  9. [pipeline:main]
  10. pipeline = object-server
  11. [app:object-server]
  12. use = egg:swift#object
  13. [object-replicator]
  14. [object-updater]
  15. [object-auditor]
  16. EOF
复制代码



10、开启存储节点服务
  1. swift-init object-server start
  2. swift-init object-replicator start
  3. swift-init object-updater start
  4. swift-init object-auditor start
  5. swift-init container-server start
  6. swift-init container-replicator start
  7. swift-init container-updater start
  8. swift-init container-auditor start
  9. swift-init account-server start
  10. swift-init account-replicator start
  11. swift-init account-auditor start
复制代码




四、测试存储的配置是否可以使用,此时的swift架构就是1个代理多个存储的部署,代理存在单点故障隐患。

1、到192.168.100.7服务器开启代理服务
2、修改控制节点192.168.3.97认证的keystone,配置Endpoints部分。(PS:ip:192.168.3.97为Openstack的控制节点ip地址,swift我采用keystone认证)
3、dashboard 和命令行测试,此处不再描述



五、新增一个代理节点Proxybak

1、按步骤一,安装配置Proxybak节点,完全复制/etc/swift 目录下内容到新Proxybak节点,配置过程不再写。
注意,swift.conf配置文件的hash值不要修改保持一致。修改proxy-server.conf 中的IP 设置为Proxybak的IP,Ring文件直接拷贝第一个代理节点的,此节点不需要在重新生成。
2、启动代理服务
3、检测,Proxybak的代理服务启动后,应该可以获取之前Proxy上传的所有数据,同时在Proxybak上传数据,在Proxy节点也可以看到。
到此也就实现了,多代理后端存储的功能,连接任何一个代理服务器都可以看到后端的存储内容。
为了保证Openstack云存储swift的代理冗余性和稳定性,我们可以采用Nginx实现代理的负载均衡。
Nginx实现swift代理的负载均衡参考这篇《用Nginx负载均衡Openstack对象存储swift




欢迎加入about云群90371779322273151432264021 ,云计算爱好者群,亦可关注about云腾讯认证空间||关注本站微信

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条