5. 安装swauth和swift (在swift用户下操作)
1. 在Proxy机器中安装swauth和swift
cd /home/swift/openstack/swauth sudo Python setup.py install --record file.txt cd /home/swift/openstack/swift #在Proxy节点中安装swift是为了使用swift的swift-proxy-server sudo python setup.py install --record file.txt 注:file.txt文件记录了安装信息,要想删除所安装的软件通过命令sudo cat file.txt | xargs rm -rf即可删除,这一步可能会出现禁止删除问题,因此你需要使用root用户来操作。
2. 在每一台Storage节点的机器中安装swift
cd /home/swift/openstack/swift sudo python setup.py install --record file.txt
6. Proxy节点的设置1.sudo apt-get install memcached #安装缓存服务器 修改/etc/ memcached.conf文件,将-l 127.0.0.1改为-l 192.168.112.129(这里我是根据我自己的情况设定的,具体原因见第一点中的图) sudo service memcached restart sudo mkdir /etc/swift cd /etc/swift sudo chown -R swift:swift /etc/swift cp /home/swift/openstack/swift/etc/proxy-server.conf /etc/swift/ cp /home/swift/openstack/swift/etc/swift.conf /etc/swift/
2.修改/etc/swift/proxy-server.conf文件,具体内容如下,原文件中没有的项需要自行增加 [DEFAULT] bind_port = 8080 user = swift log_facility = LOG_LOCAL0 [pipeline:main] pipeline = catch_errors healthcheck cache ratelimit swauth proxy-server [app:proxy-server] use = egg:swift#proxy allow_account_management = true account_autocreate = true [filter:swauth] use = egg:swauth#swauth # Highly recommended to change this. super_admin_key = swauthkey default_swift_cluster = local#:8080/auth/v1.0 [filter:healthcheck] use = egg:swift#healthcheck [filter:cache] use = egg:swift#memcache
3.修改/etc/swift/swift.conf,红色部分是随意更改的,你可以根据自己的需要更改 [swift-hash] swift_hash_path_suffix = cynric
4.生成相关ring以及builder文件,使用如下命令生成,红色部分是根据具体情况而更改的,具体原因见摘要说明里的图。每一台机器使用一个域(z1, z2, z3…依次递增) sudo chown -R swift:swift /etc/swift/* cd /etc/swift swift-ring-builder object.builder create 18 3 1 swift-ring-builder container.builder create 18 3 1 swift-ring-builder account.builder create 18 3 1 export HOST_IP=192.168.112.130 swift-ring-builder object.builder add z1-${HOST_IP}:6010/sdb1 100 swift-ring-builder container.builder add z1-${HOST_IP}:6011/sdb1 100 swift-ring-builder account.builder add z1-${HOST_IP}:6012/sdb1 100 export HOST_IP=192.168.112.131 swift-ring-builder object.builder add z2-${HOST_IP}:6010/sdb1 100 swift-ring-builder container.builder add z2-${HOST_IP}:6011/sdb1 100 swift-ring-builder account.builder add z2-${HOST_IP}:6012/sdb1 100 export HOST_IP=192.168.112.132 swift-ring-builder object.builder add z3-${HOST_IP}:6010/sdb1 100 swift-ring-builder container.builder add z3-${HOST_IP}:6011/sdb1 100 swift-ring-builder account.builder add z3-${HOST_IP}:6012/sdb1 100 swift-ring-builder object.builder rebalance swift-ring-builder container.builder rebalance swift-ring-builder account.builder rebalance
5.启动proxy服务 swift-init proxy start