6.4 More on the CDSL


6.4 More on the CDSL

The previous section showed that even on a standalone Tru64 UNIX system, CDSLs are everywhere. In this section, we will discuss how to manage those CDSLs.

IMPORTANT CDSL PUBLIC SERVICE ANNOUNCEMENT

We of the "Citizens to Promote Transparency in Cluster Environments (CPTCE)" – "Kaput-see" – yeah, we know our name needs work – would like it known that CDSLs exist as a transparent method for accessing files, by the name you know and love, regardless of where they are. Pay no attention to the author behind the computer!

In all seriousness, CDSLs are a "behind-the-scenes" feature to make your life as an administrator easier. In a perfect world, nothing ever goes wrong, but you need to know what to do in the real world, so humor us as we discuss how to manage CDSLs.

As we have stated, a CDSL is a special type of symbolic link that contains a "{memb}" in the path. It is the kernel's path resolution software within the Virtual File System that resolves the "{memb}" to the member-specific directory as we demonstrated earlier in this chapter. A CDSL is a symbolic link and is treated as a symbolic link by the underlying physical file systems. Therefore, some issues may arise with exporting a file system via NFS or restoring a tar(1) backup that contains CDSLs to a non-Tru64 UNIX system. In the case of NFS, if cluster member exports a file system containing CDSLs, the CDSLs in the file system will resolve to the client's member-specific files or not at all – see section 20.4.2.1. As for tar, the restored CDSLs will be unusable on systems not running at least version 5.0 of Tru64 UNIX.

6.4.1 Creating a CDSL using the mkcdsl(8) command

Since a CDSL is a symbolic link, you can use the ln(1) command with the "-s" option, although it is highly recommended that you use the mkcdsl command. The mkcdsl command does the following:

  • Creates a CDSL.

  • Optionally, copies the file or directory to the destination of the CDSL.

  • Updates the CDSL inventory file (/var/adm/cdsl_admin.inv). See the next section for more details on this.

    In the first example, we create a CDSL (myFirstCDSL) in the root(/) directory using the mkcdsl command and print out the result.

     # cd / && mkcdsl myFirstCDSL && fln myFirstCDSL myFirstCDSL -> cluster/members/{memb}/myFirstCDSL 
    Note

    although we have created a CDSL that points to somewhere, that somewhere points to nowhere.

     # wc -l myFirstCDSL wc: myFirstCDSL : No such file or directory 

    This is not an error, but rather the nature of a symbolic link. You can remedy this situation by simply copying a file to /myFirstCDSL.

     # cp .profile myFirstCDSL && wc –l myFirstCDSL 74 myFirstCDSL 

    Next, let's create a directory under root (/) to illustrate the mkcdsl command with the "-c" option. The "-c" option copies the file (or in this case, the directory) from its location to a member-specific location while leaving a CDSL in the file's location.

     # C=cluDir && mkdir $C && mkcdsl -c $C && fln $C cluDir -> cluster/members/{memb}/cluDir 

    You can see what the mkcdsl would do (without actually doing it) using the "-n" option.

     # mkcdsl -n anotherCDSL mkcdsl would: ln -s cluster/members/{memb}/anotherCDSL /anotherCDSL 

6.4.2 Maintaining CDSLs

There are two commands that can be used to maintain CDSLs on a system:

  • cdslinvchk(8)

  • mkcdsl(8)

6.4.2.1 Using the cdslinvchk(8) command

The cdslinvchk command verifies that all the CDSLs installed on the system exist by searching the subset inventory files located in /usr/.smdb. (the *.inv files) and the /var/adm/cdsl_admin.inv file. If the command detects any errors, it writes them in the cdsl_check_list file located in /var/adm. The cdslinvchk command checks only for missing CDSLs; it does not recreate missing links. To recreate a missing CDSL, use the mkcdsl command.

 # cdslinvchk Successful CDSL inventory check 

Let's remove a CDSL to demonstrate an error condition.

 # mv /etc/rc.config /etc/rc.config.cdsl 

Rerun the CDSL inventory check program.

 # cdslinvchk Failed CDSL inventory check. See details in /var/adm/cdsl_check_list 

Check the contents of the error log.

 # cat /var/adm/cdsl_check_list Expected CDSL: ./etc/rc.config -> ../cluster/members/{memb}/etc/rc.config An administrator or application has removed this CDSL. 

How would you correct this? Use the mkcdsl command as we discussed earlier in this chapter.

 # mkcdsl /etc/rc.config 

Rerun the cdslinvchk program to make sure we put everything back together correctly.

 # cdslinvchk Successful CDSL inventory check 

Do not forget to remove the saved link.

 # rm /etc/rc.config.cdsl 

6.4.2.2 Using the mkcdsl(8) command

The mkcdsl command is designed not to create just a CDSL, but to create a CDSL that can be maintained. As we have stated before, a CDSL is a symbolic link. Sure, it is a special symbolic link with the "{memb}" variable sandwiched into the path, but it is a symbolic link nonetheless. In other words, you can create a CDSL using the ln command with the "-s" switch as mentioned in the previous section, but what we haven't yet told you is why it is a bad idea to use the ln command. Simply put, the ln command does not make any log that the CDSL was ever created. Consequently, if you created a CDSL for your application so that every member can write to its own log file, for instance, you might want to know if that link were deleted, wouldn't you? By using the mkcdsl command, when the CDSL is created, an entry is added to the /var/adm/cdsl_admin.inv inventory file. How is the inventory file maintained? By using the "-i" option to the mkcdsl command.

Using the mkcdsl command with the "-i" switch permits you to do the following:

  • Add a new entry or update an existing entry in the /var/adm/cdsl_admin.inv file if the name you input to the command is a CDSL.

  • Remove an entry from the /var/adm/cdsl_admin.inv file if the name you input to the command is a non-existent CDSL.

Remember those two CDSLs we created in the previous section? Let's verify that they were entered into the cdsl_admin.inv file.

 # grep -E "myFirstCDSL|cluDir" /var/adm/cdsl_admin.inv 0           34      00000       0       0            120777      2/26/01         010     s ./myFirstCDSL     cluster/members/{memb}/myFirstCDSL - 0           29      00000       0       0            120777      2/26/01         010     s ./cluDir          cluster/members/{memb}/cluDir      - 

Now remove the CDSL "myFirstCDSL" and run the mkcdsl command with the "-i" switch.

 # C=myFirstCDSL ; rm $C && mkcdsl -i $C && grep $C /var/adm/cdsl_admin.inv < no output > 

Although we do not recommend this method for creating a CDSL, this time let's use the ln command. The ln command can also create a CDSL (since a CDSL is a symbolic link) but does not update /var/adm/cdsl_admin.inv.

 # cd / && ln -s cluster/members/{memb}/$C && fln $C myFirstCDSL -> cluster/members/{memb}/myFirstCDSL 

Check /var/adm/cdsl_admin.inv.

 # grep $C /var/adm/cdsl_admin.inv < no output > 

It is not there because ln does not update the CDSL inventory file. However, with the mkcdsl command, we can have /var/adm/cdsl_admin.inv automatically updated.

 # mkcdsl -i $C && grep $C /var/adm/cdsl_admin.inv 0         34        00000      0      0        120777         2/26/01      010         s ./myFirstCDSL    cluster/members/{memb}/myFirstCDSL - 

6.4.3 CDSL and the mv(1) command

Special care needs to be taken in using the mv command when a CDSL is involved. The mv command will not follow the link and therefore will replace the link with the file. In a standalone configuration, this may or may not be a big deal (of course, cdslinvchk will return an error); however, in a cluster this will have unpredictable (and possibly not very pleasant) results.

To illustrate this problem, create a file (we'll call it "mover") and move it to the link we created in the previous section.

 # cat > mover la dee da tweedledee tweedledum ^D 
 # ls -lid mover myFirstCDSL | awk '{ print $1,$10,$11,$12 }' 2112 myFirstCDSL -> cluster/members/{memb}/myFirstCDSL 2894 mover 

 # mv mover myFirstCDSL ; ls -lid myFirstCDSL | awk '{ print $1,$10,$11,$12 }' 2894 myFirstCDSL 

You can see by the serial number that the file is the same file, but more importantly, the CDSL is gone! It is recommended that you use the cp(1) command instead of the mv command when CDSLs are involved. If you accidentally remove a CDSL, don't worry, just recreate it with the mkcdsl command.

6.4.4 CDSL and Shells

The Korn shell ‘88 (ksh) and Korn shell ‘93 (dtksh) do not display symbolic links in the same way that the Bourne shell (sh) or C shell (csh) do. The Korn shells hide the symbolic links in output, when possible, whereas the other shells display the actual path you are in. Table 6-5

Table 6-5: Shell Responses to Symbolic Links

click to expand

illustrates each shell's response when changing the current working directory using a CDSL as the directory. Three alternate shells from the Tru64 UNIX Open Source CD are also shown in the table. Notice that the bash and zsh shells are like ksh whereas tcsh is similar to csh.

Alternately, you can use the pwd command in the /usr/bin directory.




TruCluster Server Handbook
TruCluster Server Handbook (HP Technologies)
ISBN: 1555582591
EAN: 2147483647
Year: 2005
Pages: 273

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net