Object Storage

Bluemix Infra는 OpenStack Swift 기반의 Object Storage 서비스를 제공합니다.
Object Storage는
대규모의 비정형 데이터를 저장할 수 있는 유연하고 내구성 있는 저장 공간 및 운영에 필요한 부가 기능들을 제공합니다.


1 Object Storage 생성

SALES > https://control.bluemix.net에서 Storage > Object Storage를 클릭합니다.

Object Storage 페이지에서 “Order Object Storage” 버튼을 클릭합니다.

Order Object Storage 팝업 창이 뜨면, Select Storage Type을 “Cloud Object Storage – Standard Regional Swift API”로 선택 후 하단의 Continue 버튼을 클릭합니다.

Confirm Order 창에서 하단의 체크박스에 동의하고 Place Order를 눌러 생성을 완료합니다.

2 생성된 Object Storage 확인

생성 완료 후, Storage > Object Storage 메뉴를 클릭하면 생성이 완료된 계정을 확인할 수 있습니다.

알맞은 계정을 클릭하면 아래와 같이 각 지역별 Object Storage가 나타나고 필요로 하는 지역을 클릭합니다.

해당 지역을 클릭하면, 계정별 Object Storage를 관리할 수 있는 페이지가 나오며, 좌측의 빨간 박스의 “View Credentials”를 클릭하여 계정정보를 확인 할 수 있습니다.

확인 가능 한 계정정보는 아래와 같습니다.

3 파일 관리@SL 포탈
화면 중간의 “Add Container” 클릭하여 Container 생성을 합니다.


“Add New Container” 팝업 창이 뜨면 Container 이름을 입력하고 OK 버튼을 클릭합니다.

생성 된 Container를 확인 후, 해당 컨테이너를 클릭한 후 우측 상단의 Add File 버튼을 클릭합니다.

Browse 창이 뜨면 우측의 Select 버튼을 클릭하여, 해당 파일을 선택하고 “Add” 버튼을 클릭하여 Upload를 완료합니다

Download가 필요한 경우, Upload 되어 있는 파일을 클릭하고 우측의 Actions > Download 버튼을 클릭합니다.

4 파일 관리@Swift
Swift client 설치 사전 준비

è python 버전 2.6 이상 설치 필요

[root@client01 ~]# python Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

>>>

Swift client 설치@centOS

[root@client01 ~]# install python-setuptools
install: missing destination file operand after `python-setuptools’

Try `install –help’ for more information.

[root@client01 ~]# yum install python-setuptools

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

* base: mirrors.service.networklayer.com

* extras: mirrors.service.networklayer.com

* updates: mirrors.service.networklayer.com

Setting up Install Process

Resolving Dependencies

–> Running transaction check

—> Package python-setuptools.noarch 0:0.6.10-3.el6 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

[root@client01 ~]# easy_install pip

Searching for pip

Reading http://pypi.python.org/simple/pip/

Best match: pip 1.5.6

Downloading https://pypi.python.org/packages/source/p/pip/pip-1.5.6.tar.gz#md5=01026f87978932060cc86c1dc527903e

Processing pip-1.5.6.tar.gz

Running pip-1.5.6/setup.py -q bdist_egg –dist-dir /tmp/easy_install-r9btj9/pip-1.5.6/egg-dist-tmp-dKOyeo

warning: no files found matching ‘pip/cacert.pem’

warning: no files found matching ‘*.html’ under directory ‘docs’

warning: no previously-included files matching ‘*.rst’ found under directory ‘docs/_build’

no previously-included directories found matching ‘docs/_build/_sources’

Adding pip 1.5.6 to easy-install.pth file

Installing pip script to /usr/bin

Installing pip2.6 script to /usr/bin

Installing pip2 script to /usr/bin

Installed /usr/lib/python2.6/site-packages/pip-1.5.6-py2.6.egg

Processing dependencies for pip

Finished processing dependencies for pip

[root@client01 ~]# pip install python-swiftclient


Downloading/unpacking python-swiftclient

Downloading python-swiftclient-2.1.0.tar.gz (62kB): 62kB downloaded

Running setup.py (path:/tmp/pip_build_root/python-swiftclient/setup.py) egg_info for package python-swiftclient

Installed /tmp/pip_build_root/python-swiftclient/pbr-0.9.0-py2.6.egg

[pbr] Processing SOURCES.txt

warning: LocalManifestMaker: standard file ‘-c’ not found

warning: no previously-included files found matching ‘.gitignore’

warning: no previously-included files found matching ‘.gitreview’

warning: no previously-included files matching ‘*.pyc’ found anywhere in distribution

warning: no files found matching ‘*’ under directory ‘tools’

Downloading/unpacking requests>=1.1 (from python-swiftclient)

Downloading requests-2.3.0-py2.py3-none-any.whl (452kB): 452kB downloaded

Downloading/unpacking simplejson>=2.0.9 (from python-swiftclient)

Downloading simplejson-3.5.3.tar.gz (70kB): 70kB downloaded

Running setup.py (path:/tmp/pip_build_root/simplejson/setup.py) egg_info for package simplejson

Downloading/unpacking six>=1.5.2 (from python-swiftclient)

Downloading six-1.7.3-py2.py3-none-any.whl

Installing collected packages: python-swiftclient, requests, simplejson, six

Running setup.py install for python-swiftclient

[pbr] Reusing existing SOURCES.txt

changing mode of build/scripts-2.6/swift from 644 to 755

changing mode of /usr/bin/swift to 755

Running setup.py install for simplejson

building ‘simplejson._speedups’ extension

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c simplejson/_speedups.c -o build/temp.linux-x86_64-2.6/simplejson/_speedups.o

Successfully installed python-swiftclient requests simplejson six

Cleaning up…

[root@client01 ~]# swift

Usage: swift [–version] [–help] [–snet] [–verbose]
[–debug] [–info] [–quiet] [–auth <auth_url>]
[–auth-version <auth_version>] [–user <username>]
[–key <api_key>] [–retries <num_retries>]
[–os-username <auth-user-name>] [–os-password <auth-password>]
[–os-tenant-id <auth-tenant-id>]
[–os-tenant-name <auth-tenant-name>]
[–os-auth-url <auth-url>] [–os-auth-token <auth-token>]
[–os-storage-url <storage-url>] [–os-region-name <region-name>]
[–os-service-type <service-type>]
[–os-endpoint-type <endpoint-type>]
[–os-cacert <ca-certificate>] [–insecure]
[–no-ssl-compression]
<subcommand> …

5 Swift Client 환경 구성
è /etc/profile 파일에 아래와 같은 환경 변수 추가

[root@client01 ~]# env|grep ST_ ST_AUTH=https://ams01.objectstorage.service.networklayer.com/auth/v1.0/

ST_USER=IBMOS315492-5:IBM315492

ST_KEY=e977c502dc8de6487dbde655627dccde2fb3001341df34dd7be0540b9f187ccb

6 Swift 명령어
è 상태 확인: swift stat

Web으로 업로드 한 Container 1개 Object 2개 정보 확인

[root@client01 ~]# swift stat
Account: AUTH_16f6bceb-a79e-446c-b573-0d935336ab12

Containers: 1

Objects: 2

Bytes: 2209604

Meta Nas-Id: 3224130

Meta Cdn-Id: 10030

X-Timestamp: 1404194826.55718

X-Trans-Id: tx3b9995a1b56143e3a1d02-0053bdbd93

Content-Type: text/plain; charset=utf-8

Accept-Ranges: bytes

è 메타 정보 업데이트: swift post

è 메타 정보 확인: swift list

신규 컨테이너, CLI 생성 후 목록 확인

[root@client01 ~]# swift post CLI [root@client01 ~]# swift list

CLI

Manual

[root@client01 ~]# swift list CLI

[root@client01 ~]#

è 파일 업로드: swift upload

신규 컨테이너 CLI에 파일 업로드 후 정보 확인

[root@client01 ~]# swift upload CLI /etc/hosts etc/hosts

[root@client01 ~]# swift list CLI

etc/hosts

[root@client01 ~]# swift stat CLI


Account: AUTH_16f6bceb-a79e-446c-b573-0d935336ab12

Container: CLI

Objects: 1

Bytes: 85

Read ACL:

Write ACL:

Sync To:

Sync Key:

Accept-Ranges: bytes

X-Timestamp: 1404944026.60595

X-Trans-Id: tx76681b930f0a428c899fb-0053bdbf8e

Content-Type: text/plain; charset=utf-8

[root@client01 ~]#