From T3_KR_KNU
Revision as of 01:42, 15 June 2017 by Hanbi (Talk | contribs) (xrdfs 사용하기)

Jump to: navigation, search

1 Storage Element Tutorial

CRAB 등을 사용하여 얻은 데이터를 보관할 수 있는 저장 공간을 Storage Element (SE)라 한다. 이곳에 데이터를 저장하기 위해서는 몇가지 특수한 명령어를 사용해야 한다.

[주의 : tcsh, csh 등 에서 관련 명령어를 사용할 때, 경로 인자에 반드시 " " 를 사용해주시기 바랍니다.]


1.1 voms 인증

  • voms 인증 후 사용할수 있다.
$ voms-proxy-init --voms cms


1.2 T2_KR_KNU의 Computing Resource 실시간 조회하기 (CPU, Disk 자원 조회)

  • UI 에서 "knuinfo" 명령어를 실행합니다.
$ knuinfo
$
-----------------------------------------------------------------------------------------
   CPU    Free Total Jobs      Running Waiting ComputingElement
   161      99         62           62       0 cluster118.knu.ac.kr:8443/cream-pbs-cms
   496     127        368          368       0 cluster50.knu.ac.kr:8443/cream-pbs-cms
-----------------------------------------------------------------------------------------
 Avail Space(kB)  Used Space(kB)  Type  SE
    125508644406    644170969874  SRM   cluster142.knu.ac.kr
-----------------------------------------------------------------------------------------


1.3 SE(Storage Element)의 사용자 디렉토리 경로

$ srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/(username)/.../SrcFile
$ dcap://cluster142.knu.ac.kr/pnfs/knu.ac.kr/data/cms/store/user/(username)/.../SrcFile
$ gsidcap://cluster142.knu.ac.kr:22128/pnfs/knu.ac.kr/data/cms/store/user/(username)/.../SrcFile

참고사항:
- 위의 예시에서 username은 향후 publish 할 경우를 대비하서 경북대 ID가 아니라 CERNID를 사용해야 합니다.
- 만약에 본인의 디렉토리가 만들어져 있지 않는 경우에는 관리자에게 연락바랍니다.


1.4 test.file 파일의 SE 및 local 디렉토리로 복사하기

$ gfal-copy srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/(username)/.../SrcFile     srm://cluster142/.../DestFile
$ gfal-copy srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/(username)/.../SrcFile     file:////u/user/(username)/.../DestFile
$ gfal-copy gsidcap://cluster142.knu.ac.kr:22128/pnfs/knu.ac.kr/data/cms/store/user/(username)/.../SrcFile     file:////u/user/(username)/.../DestFile


1.5 xrootd 를 활용한 SE Data 접근 방법

1.5.1 xrdcp client 사용하기

$ xrdcp root://cluster142.knu.ac.kr//store/user/(username)/test.file /some/local/path/test.file
  (참조 : http://xrootd.org/doc/prod/Syntax_config.htm)

$ xrdcp /some/local/path/test.file root://cluster142.knu.ac.kr//store/user/(username)/test.file

1.5.2 libXrdPosixPreload library 사용하기

$ export LD_PRELOAD=/usr/lib64/libXrdPosixPreload.so 
$ echo “This is a new test” >./test 

$ mkdir xroot://cluster142.knu.ac.kr:1094//store/user/(username)/testdir
$ cp ./test xroot://cluster142.knu.ac.kr:1094//store/user/(username)/testdir/test 

$ cp xroot://cluster142.knu.ac.kr:1094//store/user/(username)/testdir/test ./test1
$ diff ./test1 ./test 

$ rm xroot://cluster142.knu.ac.kr:1094//store/user/(username)/testdir/test
$ rmdir xroot://cluster142.knu.ac.kr:1094//store/user/(username)/testdir

1.5.3 xrdfs 사용하기

$ echo “This is a new test” >./test 
$ cat ./test
“This is a new test”
$ xrdcp ./test xroot://cluster142.knu.ac.kr:1094//store/user/(username)/test
$ xrdfs cluster142 ls /store/user/(username)
...
/store/user/(username)/test
...
$ xrdfs cluster142.knu.ac.kr cat /store/user/(username)/test
“This is a test”
   
$ xrdfs cluster142.knu.ac.kr
[cluster142.knu.ac.kr:1094] / > cd store/user/(username)
[cluster142.knu.ac.kr:1094] /store/user/(username) > ls
...
/store/user/(username)/test
...
[cluster142.knu.ac.kr:1094] /store/user/(username) > ls test
[ERROR] Server responded with an error: [3012] Error when processing list response: Not a directory: /pnfs/knu.ac.kr/data/cms/store/user/(username)/test

[cluster142.knu.ac.kr:1094] /store/user/(username) > cat test
“This is a test”

[cluster142.knu.ac.kr:1094] /store/user/(username) > mkdir testdir
[cluster142.knu.ac.kr:1094] /store/user/(username) > ls
...
/store/user/(username)/test
/store/user/(username)/testdir 
...

[cluster142.knu.ac.kr:1094] /store/user/(username) > mv test testdir
[ERROR] Server responded with an error: [3005] Will not overwrite existing file (File exists:/pnfs/knu.ac.kr/data/cms/store/user/(username)/testdir).

[cluster142.knu.ac.kr:1094] /store/user/(username) > mv test testdir/test
[cluster142.knu.ac.kr:1094] /store/user/(username) > cd testdir
[cluster142.knu.ac.kr:1094] /store/user/(username)/testdir > ls
/store/user/(username)/testdir/test

[cluster142.knu.ac.kr:1094] /store/user/(username)/testdir > rm test
[cluster142.knu.ac.kr:1094] /store/user/(username)/testdir > cd ..
[cluster142.knu.ac.kr:1094] /store/user/(username) > rmdir testdir
[cluster142.knu.ac.kr:1094] / > quit
Goodbye.


$ xrdfs --help
Usage:
   xrdfs [--no-cwd] host[:port]              - interactive mode
   xrdfs            host[:port] command args - batch mode

Available options:

  --no-cwd no CWD is being preset

Available commands:

  exit
    Exits from the program.

                              tpc           - support for third party copies
                              wan_port      - the port to use for wan copies
                              wan_window    - the wan_port window size
                              window        - the tcp window size
                              cms           - the status of the cmsd
                              role          - the role in a cluster
                              sitename      - the site name
                              version       - the version of the server
    checksumcancel <path>   File checksum cancellation
    checksum       <path>   File checksum
    opaque         <arg>    Implementation dependent
    opaquefile     <arg>    Implementation dependent
    space          <space>  Logical space stats
    stats          <what>   Server stats; <what> is a list
                            of letters indicating information
                            to be returned:
                              a - all statistics
                              p - protocol statistics
                              b - buffer usage statistics
                              s - scheduling statistics
                              d - device polling statistics
                              u - usage statistics
                              i - server identification
                              z - synchronized statistics
                              l - connection statistics
    xattr          <path>   Extended attributes

  rm <filename>
    Remove a file.

  rmdir <dirname>
    Remove a directory.

  truncate <filename> <length>
    Truncate a file.

  prepare [-c] [-f] [-s] [-w] [-p priority] filenames
    Prepare one or more files for access.
    -c co-locate staged files if possible
    -f refresh file access time even if the location is known
    -s stage the files to disk if they are not online
    -w the files will be accessed for modification
    -p priority of the request, 0 (lowest) - 3 (highest)

  cat [-o local file] file
    Print contents of a file to stdout.
    -o print to the specified local file

  tail [-c bytes] [-f] file
    Output last part of files to stdout.
    -c num_bytes out last num_bytes
    -f           output appended data as file grows

  spaceinfo path
    Get space statistics for given path.

1.6 dcap을 이용한 SE Data 접근 방법

1.7 UI에서 NFS로 마운트된 스토리지 엘리먼트 사용하기

1.8 root에서 SE Data 접근 방법

  • dcap 프로토콜을 이용
# 읽기
$ TFile *f = TFile::Open("dcap://cluster142.knu.ac.kr//pnfs/knu.ac.kr/data/cms/store/user/(username)/test.root");
$
# 쓰기
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/dcap
$ root -l
root [0] TFile *f = TFile::Open("gsidcap://cluster142.knu.ac.kr//pnfs/knu.ac.kr/data/cms/store/user/(username)/test.root", "CREATE");
root [1] f->Close();
root [2] TFile *f2 = TFile::Open("gsidcap://cluster142.knu.ac.kr//pnfs/knu.ac.kr/data/cms/store/user/(username)/test.root", "RECREATE");
root [3] f2->Close();
root [4] .q
$
  • xrootd 프로토콜을 이용
# 읽기
$ voms-proxy-init --voms cms
$ TFile *f = TFile::Open("root://cluster142.knu.ac.kr//store/user/(username)/test.root");
$
# 쓰기
$ voms-proxy-init --voms cms
$ root -l
root [0] TFile *f = TFile::Open("root://cluster142.knu.ac.kr//store/user/(username)/test.root", "CREATE");
root [1] f->Close();
root [2] TFile *f2 = TFile::Open("root://cluster142.knu.ac.kr//store/user/(username)/test.root", "RECREATE");
root [3] f2->Close();
root [4] .q
$

1.9 복수의 파일을 동시에 전송하기

$ /usr/local/bin/lcgcp_copyfiles list.txt
$ cat  list.txt 
srm://myhost.mydomain.edu:8443//dir1/dir2/sh-copy1 file:///localdir/sh1
srm://myhost.mydomain.edu:8443//dir1/dir2/sh-copy2 file:///localdir/sh2
srm://myhost.mydomain.edu:8443//dir1/dir2/sh-copy3 file:///localdir/sh3
  • lcg_cp는 기본적으로 복수파일 전송을 지원하지 않으나 원본경로 대상경로를 포함하는 목록 파일을 생성한뒤, 위의 스크립트를 사용하면 복수의 파일을 전송할수 있다.


1.10 복사가 정상적으로 이루어졌는지 확인 또는 디렉토리의 목록 확인

$ gfal-ls -Hl srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/(username)


1.11 파일 또는 디렉토리 삭제

$ gfal-rm srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/(username)/test/test.file
$ gfal-rm srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/(username)/test
$ lcg-del -d srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/(username)/test


1.12 gfal 명령어 사용 요약

 $ voms-proxy-init --voms cms 로 proxy 생성후 아래 명령어를 수행하시면 됩니다.
 $ 조회 : gfal-ls -Hl srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/MyAccount/FolderName
 $ 복사 : gfal-copy srm://cluster142.knu.ac.kr:8443/.../FileNameSrc    srm://cluster142.knu.ac.kr:8443/.../FileNameDest
 $ 삭제 : gfal-rm srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/MyAccount/FolderName/FileName
 $ 디렉토리 삭제 : gfal-rm -R srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/MyAccount/FolderName
  • 명령어 뒤의 Option은 매뉴얼 페이지를 참고 바랍니다. (ex. man gfal-ls)
  • 1000개 이상의 파일 포함한 폴더 내용 보기 : (ex. 500번째 파일부터 700개의 파일을 보고 싶을 경우) lcg-ls --offset 500 --count 700 srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/(DestFoler)


1.13 crab3를 사용한 후 gfal-* 명령어들이 오류가 발생합니다

source /cvmfs/cms.cern.ch/crab3/crab.sh 실행후에 gfal-* 명령어들이 오류가 발생합니다.

$ gfal-ls -Hl srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/test/test.transfer
-rw-r--r-- 1   2    2    Oct 12 02:17 4.8M srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/test/test.transfer
$ source /cvmfs/cms.cern.ch/crab3/crab.sh
$ gfal-ls -Hl srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/test/test.transfer
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/usr/bin/gfal-ls", line 8, in <module>
    from gfal2_util.shell import Gfal2Shell
ImportError: No module named gfal2_util.shell

crab3 에서 사용하는 python 환경변수와 gfal-* 명령어들에 문제를 일으키기 때문입니다. gfal-* 명령어 앞에 " env --unset=LD_LIBRARY_PATH "을 넣어줌으로써 문제를 해결할 수 있습니다.

$ env --unset=LD_LIBRARY_PATH gfal-ls -Hl srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/test/test.transfer
-rw-r--r-- 1   2    2    Oct 12 02:17 4.8M srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/user/test/test.transfer


1.14 cmsenv 실행후 gfal 명령어들이 정상 동작 하지 않을때

cmsenv 실행후에 다음과 같은 오류가 발생한다면

Failed to add IO tunnel (libgsiTunnel.so: cannot open shared object file: No such file or directory). Provider: [libgsiTunnel.so].
Error ( POLLIN) (with data) on control line [12]
Failed to create a control line
Failed open file in the dCache.
gfal-copy: error: Input/output error 

아래 명령을 먼저 실행해줌으로써 문제를 해결할 수 있습니다.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/dcap 


1.15 no match 오류가 발생할때

  • tcsh에서 ?는 wild card로 인식이 됩니다. 따라서 tcsh을 사용하고 있다면 srm 경로에 반드시 ""를 사용해야 합니다.


1.16 srm*, lcg*, gfal* 주요 명령어 비교표

srm* lcg* gfal* 비고
srmls lcg-ls gfal-ls ls
srmcp lcg-cp gfal-copy cp
srmrm lcg-del gfal-rm rm
srmmkdir gfal-mkdir mkdir
srmrmdir lcg-del -d gfal-rm -R rmdir
gfal-cat cat


1.17 uberftp를 이용한 Storage Element 사용

1.18 WebFTS를 이용한 Storage Element 로의 Data 전송

1.19 Tier-2 저장공간(Disk) 활용 분류

* Storage Element (srm://cluster142.knu.ac.kr:8443/srm/managerv2?SFN=/pnfs/knu.ac.kr/data/cms/store/...)
 : 대용량 저장 공간으로 장기간 보관이 가능합니다.
  - PhEDEx를 통한 DataSet 저장
  - Analysis 이후의 결과파일 저장
 : 현재 약 830 TB의 공간을 마련하여 운영하고 있습니다.
 : 사용자의 데이터 저장으로 공간이 부족할 경우, 사전 설문을 통해 더 이상 사용하지 않는 과거 데이터의 삭제 요청을 드릴 수 있습니다. 
* User Home Directory (/u/user/...)
 : Tier-2 UI에 로그할 경우 기본적인 설정사항 등을 보관하는 장소입니다.
 : 약 9 TB 규모의 공간입니다.
 : 모든 사용자가 9 TB를 나누어 사용하므로 용량이 큰 데이터의 보관은 가급적 삼가해 주시기 바랍니다.
* Scratch Disk
 : UI에 총 4개의 임시 저장공간이 있습니다.
  - /d  : 2 TB single Disk
  - /d1 : 2 TB single Disk
  - /d2 : 2 TB single Disk
  - /d3 : Logical Volume ( 2 TB single Disk * 3)
 : scratch disk는 Storage Element와 User Home Directory 영역과 달리 Single Disk로 구성이 되어 있습니다.
 : 개별 Disk의 물리적 장애 발생 시, 데이터의 유실이 발생하므로 중요한 데이터 및 장기 보관 데이터는 반드시 Storage Element로 이동하여 주시기 바랍니다.