zoukankan      html  css  js  c++  java
  • openstack-swift云存储部署(二)

    接上篇,swift-proxy和swift-store的安装

    先说一下服务器分配

        swift-proxy和keystone部署在192.168.25.11

        swift-store是两台  分别是192.168.25.12和192.168.25.13  (这是测试IP)

    先安装代理节点swift-proxy:

        wget -c http://mirror.neu.edu.cn/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

        rpm -ivh epel-release-6-8.noarch.rpm

        不要问我以上那个干吗用的  本来它是openstack的有关的包下载的地方,相当于一个镜像地址,但事实是它里面什么也没有但是这个环境还必须得安装,就这么简单粗暴,安装完成后在/etc/yum.repos.d/下会生成两个文件 epel.repo和epel-    testing.repo 但实际上epel-testing.repo这个文件并没有什么卵用。vim 到epel.repo文件里注销掉[epel]下的以mirror开头的那一行(#mirror。。。),打开http开头的那一行。然后在命令行执行yum  makecache就ok了。

        yum install openstack-swift openstack-swift-proxy  openstack-swift-account openstack-swift-container   openstack-swift-object memcached 

      安装以上包时会有N 多的依赖性,根据要求一一安装,但是坑爹的是好多需要的依赖性centos6.4里、没、有、然后找了N久找到一个下载地址https://repos.fedorapeople.org/openstack/EOL/openstack-icehouse/epel-6/  在这个地址里随便下载你需要的包吧!不收费!

        以上安装完成后,修改配置文件:/etc/swift/swift.conf

          [swift-hash]

          #random unique string that can never change (DO NOT LOSE)

          swift_hash_path_suffix = `od -t x8 -N 8 -A n < /dev/random`

        创建自签名证书

          cd /etc/swift

          openssl req -new -x509 -nodes -out cert.crt -keyout cert.key

        配置proxy-server:/etc/swift/proxy-server.conf  

          [DEFAULT]
          bind_port = 8080
          workers = 8
          user = swift

          [pipeline:main]
          pipeline = healthcheck cache authtoken keystone proxy-server

          [app:proxy-server]
          use = egg:swift#proxy
          allow_account_management = true
          account_autocreate = true

          [filter:cache]
          use = egg:swift#memcache
          memcache_servers = 192.168.25.12:11211
          set log_name = cache

          [filter:catch_errors]
          use = egg:swift#catch_errors

          [filter:healthcheck]
          use = egg:swift#healthcheck

          [filter:keystone]
          paste.filter_factory = keystone.middleware.swift_auth:filter_factory
          use = egg:swift#keystoneauth
          operator_roles = Menber,admin, SwiftOperator
          is_admin = true
          cache = swift.cache

          [filter:authtoken]
          paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
          delay_auth_decision = 10
          service_port = 5000
          service_host = 127.0.0.1
          admin_tenant_name = service
          admin_user = swift
          admin_password = swift
          auth_host = 127.0.0.1
          auth_port = 35357
          auth_protocol = http
          auth_uri = http://127.0.0.1:5000/
          auth_token = 89bbecb48e973be18dd7
          admin_token = 89bbecb48e973be18dd7
          signing_dir = /tmp/keystone-signing-swift

      创建 account, container, object rings   第二个参数为每个对象复制的个数

          swift-ring-builder account.builder create 18 1 1

        swift-ring-builder container.builder create 18 1 1

        swift-ring-builder object.builder create 18 1 1


      添加每个节点上的存储设备:

        swift-ring-builder account.builder add z1-192.168.25.12:6002/sdb1 100 (swift-ring-builder account.builder add z2-192.168.25.13:6002/sdb1 100)

        swift-ring-builder container.builder add z1-192.168.25.12:6001/sdb1 100

        swift-ring-builder object.builder add z1-192.168.25.12:6000/sdb1 100


      检查每个ring中的内容

        swift-ring-builder account.builder

        swift-ring-builder container.builder

        swift-ring-builder object.builder

      重新平衡ring

        swift-ring-builder account.builder rebalance

        swift-ring-builder container.builder rebalance

        swift-ring-builder object.builder rebalance

      复制所有配置文件为swift用户所有

        chown -R swift:swift /etc/swift

      启动proxy服务(在存储节点服务启动之后再启动)

        swift-init  proxy start

    下面安装存储节点,因为两台存储节点配置一样,所以只以192.168.25.12为例:

      同样没有包但是需要环境的epel的配置,雷同swift-proxy的配置

      yum install openstack-swift-account openstack-swift-container  openstack-swift-object xfsprogs(没有的包自己去https://repos.fedorapeople.org/openstack/EOL/openstack-icehouse/epel-6/这个地址找)

      创建虚拟磁盘:

        fdisk /dev/sdb=》创建虚拟磁盘sdb1

        mkfs.xfs  -i size=1024  /dev/sdb1  创建文件系统

        echo "/dev/sdb1  /srv/node/sdb1  xfs  noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab 添加到启动时自动挂载分区

        mkdir -p /srv/node/sdb1

        mount /dev/sdb1  /srv/node/sdb1  当然也可以执行mount -a  是/etc/fstab 生效

        chown -R swift:swift  /srv/node

      创建/etc/rsyncd.conf (rsync需要yum)

        uid = swift

        gid = swift

        log file = /var/log/rsyncd.log
        pid file = /var/run/rsyncd.pid
        address = 192.168.25.12
        [account]
        max connections = 2
        path = /srv/node
        read only = false
        lock file = /var/lock/account.lock
        [container]
        max connections = 2
        path = /srv/node
        read only = false
        lock file = /var/lock/container.lock
        [object]
        max connections = 2
        path = /srv/node
        read only = false
        lock file = /var/lock/object.lock

      在开启rsync服务之前需要拷贝swift-proxy中/etc/swift/下的swift.conf object.ring.gz container.ring.gz account.ring.gz 到存储节点的/etc/swift目录下。

      rsync --daemon --config=/etc/rsyncd.conf  开启rsync服务 

      创建三个配置文件:

        /etc/swift/account-server.conf

          [DEFAULT]
          bind_ip = 192.168.25.12
          bind_port = 6002
          workers = 2

          [pipeline:main]
          pipeline = account-server

          [app:account-server]
          use = egg:swift#account

          [account-replicator]

          [account-auditor]

          [account-reaper]

        /etc/swift/container-server.conf

          [DEFAULT]

          bind_ip = 192.168.25.12
          bind_port = 6001
          workers = 2

          [pipeline:main]
          pipeline = container-server

          [app:container-server]
          use = egg:swift#container

          [container-replicator]

          [container-updater]

          [container-auditor]

          [container-sync]

        /etc/swift/object-server.conf

          [DEFAULT]

          bind_ip = 192.168.25.12
          bind_port = 6000
          workers = 3

          [pipeline:main]
          pipeline = object-server

          [app:object-server]
          use = egg:swift#object

          [object-replicator]

          [object-updater]

          [object-auditor]

      开启storage服务

        swift-init object-server start

        swift-init object-replicator start

        swift-init object-updater start  

        swift-init object-auditor start

        swift-init container-server start    

        swift-init container-replicator start

        swift-init container-updater start

        swift-init container-auditor start

        swift-init account-server start  

         swift-init account-replicator start

        swift-init account-auditor start

    以上是主节点和存储节点的配置

    192.168.25.13的配置与12的配置相同  只是需要把account-server.conf container-server.conf object-server.conf 的ip改为本机ip即可

    下面进行测试:

      在主节点上:swift -V 2.0 -A http://localhost:35357/v2.0 -U admin:admin -K 123456 stat

            swift -V 2.0 -A http://localhost:35357/v2.0 -U admin:admin -K 123456 upload myfile token 上传文件到存储节点,在/srv/node/sdb1/objects目录下

            swift -V 2.0 -A http://localhost:35357/v2.0 -U admin:admin -K 123456 download myfile token  可从存储节点下载文件

    以上整个openstack  swift 云存储就部署完成了!

  • 相关阅读:
    JS-07 (js的面向对象编程)
    AI SiameseFC
    phpstorm调试
    Php 编译扩展
    canvas
    AI FCN
    AI WebGL
    Python flask
    JIT 即时编译
    小程序
  • 原文地址:https://www.cnblogs.com/qfdxxdr/p/5442097.html
Copyright © 2011-2022 走看看