Xrootd

From Daya Bay
Jump to navigation Jump to search

Xrootd serves a number of local directories to the network in a unified namespace. NuWa software can stream data to and from Xrootd. See how it is used at BNL's RACF.

Xrootd URLs

Files under Xrootd are accessed via a URL like:

root://SERVERNAME//PATH/TO/FILE.root

When using TFile::Open() it is best to include an additional parameter to the URL:

root://SERVERNAME//PATH/TO/FILE.root?mkpath=1

This will assure that any intermediate parts to the path that may not exist will be created automatically. Even if you have already written to the path you should still include ?mkpath=1 because the path may not yet be created on every storage node. If you use "xrdcp" this is done implicitly.

Command line file access via xrdcp

You can copy files between local storage and Xrootd with xrdcp

xrdcp localfile.root root://SERVER/PATH/
xrdcp localfile.root root://SERVER/PATH/savedfile.root
xrdcp root://SERVER/PATH/savedfile.root copiedfile.root
xrdcp root://SERVER/PATH/savedfile.root .

xrdcp won't let you overwrite a file unless you pass the "-f" flag.

File management

  • See Rafiman topic for syncing an xrootd setup from PDSF.

Browsing Xrood with xrd

Xrootd provides xrd a command line interface to Xrootd functionality. The following session gives an idea of how to use it.

xrd
(C) 2004 SLAC INFN $Revision: 1.21 $ - Xrootd version: 20081122-0000
Welcome to the xrootd command line interface.
Type 'help' for a list of available commands.
>connect daya0002
root://daya0002.rcf.bnl.gov:1094/>
cd xrootd
root://daya0002.rcf.bnl.gov:1094//xrootd>dirlist
testdir
MDC09b
RawData
...
root://daya0002.rcf.bnl.gov:1094//xrootd>cd RawData/MiniDryRun
root://daya0002.rcf.bnl.gov:1094//xrootd/RawData/MiniDryRun>dirlist
2010
2009
root://daya0002.rcf.bnl.gov:1094//xrootd>dirlist
...(recursive listing)...
root://daya0002.rcf.bnl.gov:1094//xrootd/RawData/MiniDryRun>help
...
root://daya0002.rcf.bnl.gov:1094//xrootd/RawData/MiniDryRun>exit

Using the POSIX Preload Library

There is a library that will allow the standard POSIX to "see" xrootd space. You can use it from the command line by setting two variables:

LD_PRELOAD=$ROOTSYS/lib/libXrdPosixPreload.so 
XROOTD_VMP=daya0001:/xrootd/

Note, it is best not to set these permanently in your main shell, but rather in a shell script or one-shot like:

bash> LD_PRELOAD=$ROOTSYS/lib/libXrdPosixPreload.so XROOTD_VMP=daya0001:/xrootd/ ls -l root://daya0002//xrootd/
total 45
drwx------+ 1 bvdb dayabay 4096 Dec 10  2009 MDC09b/
drwx------+ 1 bvdb dayabay 4096 Feb 12 15:11 RawData/
drwx------+ 1 bvdb dayabay 4096 Jan 19 14:54 barnyard/
drwx------+ 1 bvdb dayabay 4096 Feb 18 15:58 bv/
drwx------+ 1 bvdb dayabay 4096 Jan 21 10:48 greek/
drwx------+ 1 bvdb dayabay 4096 Jan 21 10:58 test0002/
drwx------+ 1 bvdb dayabay 4096 Jan 15 11:41 test0003/
drwx------+ 1 bvdb dayabay 4096 Jan  6 12:36 testMDC09b/
drwx------+ 1 bvdb dayabay 4096 Dec 10  2009 testdir/
drwx------+ 1 bvdb dayabay 4096 Jul  1 10:45 tmp/

or

LD_PRELOAD=$ROOTSYS/lib/libXrdPosixPreload.so XROOTD_VMP=daya0001:/xrootd/  cp root://daya0002//xrootd/MDC09b/output/MDCLED_RACF_DRY_D11003.root  /data0/...

Links