next up previous contents
Next: Image 服務 Glance Up: 物件儲存 Swift Previous: 配置 Swift Object Storage   Contents

確認 Swift Storage 安裝成功

  1. 列出目前 swift 是空的。
    [root@kvm4 ~(keystone_admin)]# swift list
    [root@kvm4 ~(keystone_admin)]#
    
  2. 產生 3 個 512 個隨機字元的檔案。
    [root@kvm4 ~(keystone_admin)]# head -c 512 /dev/urandom > data1.file
    [root@kvm4 ~(keystone_admin)]# head -c 512 /dev/urandom > data2.file
    [root@kvm4 ~(keystone_admin)]# head -c 512 /dev/urandom > data3.file
    
  3. 上傳檔案至 containers。
    [root@kvm4 ~(keystone_admin)]# swift --help
    Usage: swift <command> [options] [args]
    
    Commands:
      stat [container] [object]
        Displays information for the account, container, or object depending on the
        args given (if any).
      list [options] [container]
        Lists the containers for the account or the objects for a container. -p or
        --prefix is an option that will only list items beginning with that prefix.
        -d or --delimiter is option (for container listings only) that will roll up
        items with the given delimiter (see Cloud Files general documentation for
        what this means).
      upload [options] container file_or_directory [file_or_directory] [...]
    
    [root@kvm4 ~(keystone_admin)]# swift upload c1 data1.file 
    data1.file
    [root@kvm4 ~(keystone_admin)]# swift upload c1 data2.file 
    data2.file
    [root@kvm4 ~(keystone_admin)]# swift upload c2 data3.file 
    data3.file
    
  4. 再列出目前 swift 有兩個 containers c1 及 c2。
    [root@kvm4 ~(keystone_admin)]# swift list
    c1
    c2
    
  5. 列出 containers 中的內容,是剛剛上傳的檔案。
    [root@kvm4 ~(keystone_admin)]# swift list c1
    data1.file
    data2.file
    [root@kvm4 ~(keystone_admin)]# swift list c2
    data3.file
    
  6. 找出上傳檔案儲存狀況,發現每個檔案各有一個副本,且存在不同的 partition,與先前設定的副本數一致。
    [root@kvm4 ~(keystone_admin)]# find /srv/node/ -type f -name "*data"
    /srv/node/z1d1/objects/100/f0e/323b355ca91af8f729f7dc88e779cf0e/1390585465.01657.data
    /srv/node/z1d1/objects/45/a62/16a1247b40242e3c4e4bb5b39072fa62/1390585473.22765.data
    /srv/node/z1d1/objects/74/485/253ba7238aa99020182b73f00cb30485/1390585459.15301.data
    /srv/node/z2d1/objects/45/a62/16a1247b40242e3c4e4bb5b39072fa62/1390585473.22765.data
    /srv/node/z2d1/objects/74/485/253ba7238aa99020182b73f00cb30485/1390585459.15301.data
    /srv/node/z2d1/objects/100/f0e/323b355ca91af8f729f7dc88e779cf0e/1390585465.01657.data
    


2015-12-29