220 likes | 326 Views
Scommands Tutorial. By: Roman Olschanowsky roman2u@sdsc.edu. Scommands. Command line access to the SRB Download then compile from http://www.sdsc.edu/srb/index.php/Scommands (make sure you get non-encrypted client only, as well as correct version that matches server version)
E N D
Scommands Tutorial By: Roman Olschanowsky roman2u@sdsc.edu
Scommands • Command line access to the SRB • Download then compile fromhttp://www.sdsc.edu/srb/index.php/Scommands (make sure you get non-encrypted client only, as well as correct version that matches server version) • Login to a machine with Scommand binaries • via ssh to a *nix machine • Win32 binaries from command window
Scommand Features • Command line interface -> SCRIPTING • Available for all of the most popular UNIX flavors and DOS • S-commands are the most flexible and powerful of the clients • They are the fastest, and most reliable • They are multithreaded for big gains in data flow • They are great for scripts, perl wrappers, batch jobs, etc… • Installed man pages via “man [Scommand]” • man Sput • /utilities/man/man1
Sinit Senv Spwd Sls Scd Sget Sput Ssh Scp Smv (logical) Sphymove (physical) Srm Smkdir Srmdir Serror Schmod Common Scommands (69 total) • Don’t forget to Sexit!
Scommand Notes • Shelp • Gives list of commands with brief summary • “[Scommand] <return>” gives usage info (usually) or try –h flag • Sinit – establishes a session • Senv – displays connection information • Spwd – display current working directory • Sexit – ends session
SRB Connection parameters • Verify/Create ~/.srb/.MdasEnv • Verify/Create ~/.srb/.MdasAuth OR • Set environment variables
~/.srb/.MdasEnv File mdasCollectionHome '/home/roman.sdsc' srbUser 'roman' mdasDomainName 'sdsc' AUTH_SCHEME 'ENCRYPT1' srbHost ‘srb.sdsc.edu' srbPort ‘7321' defaultResource ‘sfs-tape-tgd'
Environment Variables #!/bin/sh export mdasCollectionName="/home/du0.npaci" export srbHost=“srb.sdsc.edu" export srbPort=“7321" export srbUser="du0" export mdasDomainName="npaci" export srbAuth="2006SRBclass" export defaultResource=“sfs-tape-tgd" export AUTH_SCHEME="ENCRYPT1"
~/.srb/.MdasAuth 2006SRBclass (in SRB version 3.3.1 or higher) $ Sauth Enter your current SRB password: Successfully wrote ~/.srb/.srbAuthFile Remove (no longer needed) ~/.srb/.MdasAuth?:y .$CS2/j6A$"8
Other authentication methods AUTH_SCHEME: 'ENCRYPT1' – random message encrypted with your password between clients & servers. 'GSI_AUTH' - Use the Globus GSI authentication scheme. 'GSI_DELEGATE' - Use the GSI Delegation (proxy) certificate for authentication. The advantage is that this certificate can be passed from server to server whereby the user's identity continues to be maintained across servers and across zones. This scheme solves the cross zone authentication issues. 'GSI_SECURE_COMM' - Use the GSI authentication scheme and use the GSI I/O library for all socket communication between client and server.
Extra env vars for GSI auth SRB: (.MdasEnv file or env vars) AUTH_SCHEME ‘GSI_AUTH’ SERVER_DN ‘/C=US/O=NPACI/OU=SDSC/UID=srb/CN=Storage Resource Broker/Email=srb@sdsc.edu’ GLOBUS: X509_USER_PROXY="/home/du0/du0.proxy“ GLOBUS_LOCATION="/usr/local/apps/nmi-2.1" GLOBUS_INSTALL_PATH="/usr/local/apps/nmi-2.1" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/apps/nmi-2.1/lib" PATH="$PATH:/usr/local/apps/nmi-2.1/bin"
Step by Step (do inQ tutorial first) 1. Connect • First!, we need to be on a UNIX machine • ssh to du?@oly.sdsc.edu • cd .srb • “ls –al”, Notice the .MdasEnv .MdasAuth files • edit your .MdasEnv file, making it correct for your assigned du? SRB account • mdasCollectionHome '/home/du?.npaci' • srbUser 'du?' • view your .MdasAuth file • Sinit -v • “ls –al” notice the new .MdasEnv.?????? file, this file is associated with the current shell and saves your SRB session state (Like your current working dir).
Step by Step 2. Some basics • Sls • Smkdir test • Sls • Scd test • Spwd • cat .MdasEnv.????? mdasCollectionName '/home/du0.npaci/test' mdasCollectionHome '/home/du0.npaci' mdasDomainName 'npaci' srbUser 'du0' srbHost ‘srb.sdsc.edu' srbPort ‘7321' mcatZone ‘TGzone' defaultResource ‘sfs-tape-tgd‘ • Sexit, ls –al, notice it is now gone
Step by Step • Some basics • pwd, cd • Sinit • Spwd (notice you are back in your SRB home dir) • Senv • Shelp • Serror • Smkdir /home/Test • Serror -3220
Step by Step 4. Wait, how many are there? • Scd /home/Demo/SRB-Tutorial/files-2 • Sls • How many Doc.txt files are there??? • Sls –l • How many are there now? • They are all the same file, the file has been replicated to different resources which is different than copied to different resources. • The number after the owner column is the replication number, followed by the physical resource.
Step by Step 5. Lets try one • Scd to go to your SRB home dir • Scd tutorial • Scp /home/Demo/SRB-Tutorial/comics/bc.gif . • Sls –l • There should be just one replica of bc.gif • Sreplicate –S sfs-tape-sdsc bc.gif • Sls –l • Is it replicated? • Why replicate? Fault tolerance, redundancy and faster access • SgetR will list all resources • Smv only does logical move (renaming or path change) • Sphymove will move the file physically
Step by Step • Best Practices for S-command uploads and downloads Low Latency • Just upload, or recursive –r option High Latency • If it’s one big file, use Sput or Sget with –M option • If it’s a directory with lots of small files, use –b option
Step by Step 6. Download and Upload a directory • Scd /home/Demo/SRB-Tutorial • Sget –r comics • Scd • time Sput –r comics • time Sput –b comics comics2 • time Sput –b comics comics3 • Sls –l comics; Sls –l comics2 • time Srm –r comics2 • time Srm –rf comics3
Step by Step • SRB Trash system • Spwd • Add /trash to the front • Sls /trash/home/du0.npaci • That’s why it was so fast, it did not erase it, it moved it (logically). Great news! You can recover your data, just use Smv command to put data you want back. • /trash/home/du0.npaci/comics2::2005-07-26-10.39.07 • Adds timestamp to name to avoid conflicts, and to inform you when data was “trashed”
Step by Step 8. Some user defined meta data • Sufmeta • Sufmeta –Q Make = Ford • Sufmeta –c Contents Funny comics • Sufmeta Parts 4 comics/bc.gif • Sufmeta Rating “5 star” comics/bc.gif • Sufmeta comics/bc.gif
Step by Step • Put your mark on the tutorial • vi <firstname-lastname>.txt • Contents of file “Picture of my car” • Scd /home/Demo/SRB-Tutorial/cars • Sput <firstname lastname>.txt • Sls –C <firstname lastname>.txt • Schmod r npaci groups <firstname lastname>.txt • Sls –C <firstname lastname>.txt • Sufmeta Make <make> <firstname lastname>.txt • Sufmeta Model <model> <firstname lastname>.txt • Sufmeta Year <year> <firstname lastname>.txt
Step by Step 9. Rodger….Signing off • Sexit Thanks! Questions? www.sdsc.edu/srb srb@sdsc.edu