openstack-swift雲存儲部署(二)

接上篇,swift-proxy和swift-store的安裝node

先說一下服務器分配swift

    swift-proxy和keystone部署在192.168.25.11vim

    swift-store是兩臺  分別是192.168.25.12和192.168.25.13  (這是測試IP)centos

先安裝代理節點swift-proxy:服務器

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

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

    不要問我以上那個幹嘛用的  原本它是openstack的有關的包下載的地方,至關於一個鏡像地址,但事實是它裏面什麼也沒有可是這個環境還必須得安裝,就這麼簡單粗暴,安裝完成後在/etc/yum.repos.d/下會生成兩個文件 epel.repo和epel-    testing.repo 但實際上epel-testing.repo這個文件並無什麼卵用。vim 到epel.repo文件裏註銷掉[epel]下的以mirror開頭的那一行(#mirror。。。),打開http開頭的那一行。而後在命令行執行yum  makecache就ok了。memcached

    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/  在這個地址裏隨便下載你須要的包吧!不收費!ui

    以上安裝完成後,修改配置文件:/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 雲存儲就部署完成了!

相關文章
相關標籤/搜索