FedFsNfsRefGuide0.10

From Linux NFS

Revision as of 18:09, 3 February 2014 by Chucklever (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Project: fedfs-utils

[ Project Home | News | Downloads | Docs | Mailing Lists | Source Control | Issues ]


Introduction

A FedFS domain is a file namespace composed of individual shared filesystems that are joined together by junctions. When a file-access client attempts to access a junction, the fileserver converts the junction's contents to a referral that refers the client to the correct location.

This article describes how to create and manage junctions on Linux NFS servers.

The nfsref command

On Linux, the nfsref command creates and removes junctions. The arguments are the pathname of the junction, and the junction's target. The target is a list of locations where clients can find the fileset's data.

Adding a junction

Suppose you'd like to create a junction called "junction" in a fileserver's /export directory that refers clients to the export /foo/bar on the NFS server server.example.net. The nfsref command to do that looks like this:

# nfsref add /export/junction server.example.net /foo/bar

Now, when an NFS client mounts /export and tries to "cd" into /export/junction, it will mount server.example.net:/foo/bar and cd into it.

You can list more than one location when creating a junction. Clients will each choose to mount one of these locations. This makes sense only if all the listed locations have precisely the same data.

A junction can be created on any export on a fileserver, in any directory. In this way, a hierarchy of filesystems can be defined, linked together by junctions.

Viewing a junction's locations

On the server, it's easy to see the target /export/junction:

# nfsref lookup /export/junction

Removing a junction

When you no longer want the junction, use:

# nfsref remove /export/junction

In order to alter location information stored in a junction, that junction must be removed and created again.

Junctions in a domain root directory

A FedFS domain's top-level directory is known as its domain root directory. This directory typically contains nothing but junctions that point to other exports that contain more interesting data.

Let's assume you've already set up a domain root export and domain root directory, say for the example.net domain. See Setting up a FedFS domain root server for details.

On the domain root fileserver, cd into the domain root directory, and create some junctions.

# cd /.domainroot/example.net
# nfsref add sales sales.example.net /
# nfsref add marketing marketing.example.net /public
# nfsref add engineering engr.example.net /source

The following junctions are created:

  • A junction called "sales" which refers to sales.example.net:/
  • A junction called "marketing" which refers to marketing.example.net:/public
  • A junction called "engineering" which refers to engr.example.net:/source

Now, when a shell user on an NFS file-access client changes to /nfs4/example.net, she will see these directories:

sales marketing engineering

Changing into any of these directories will take her directly to the location listed in that junction.

FedFS junctions

In the above examples, we created "NFS basic" junctions. That simply means that the target is stored in the junction itself on the fileserver. This is the default type of junction created by the nfsref command.

However, the nfsref command can also create "FedFS" junctions. In this type of junction, target information is stored on an LDAP server. This becomes interesting when junctions on several fileservers refer to the same target.

In other words, suppose you have four fileservers: A, B, C, and D. Suppose further that D has an interesting export called /x/y/z. You'd like to create junctions on A, B, and C that refer to D:/x/y/z. If you store that target information on a remote LDAP server, then you can change the target for all those junctions simply by updating the target information on that LDAP server.

In fact, you don't even need to know how many junctions use that target, or where they are stored. The next time these junctions are resolved, the new target information is retrieved automatically.

A FedFS junction simply refers the fileserver to an entry on an LDAP server which contains the target for that junction. In the next section, we'll describe how to manage FedFS junctions using the nfsref command.

In order to enable automatic resolution of a FedFS junction (that is, to allow fileservers to find the LDAP server with the right target information), some set up is needed first.

Set up an LDAP server and turn it into an NSDB

See the following articles describing how to install and configure an NSDB:

Use the nsdbparams command to tell the fileserver how to contact the NSDB

Before a fileserver may contact an NSDB, the NSDB must be registered in the fileserver's NSDB connection parameters database. To do this, use the nsdbparams command.

Suppose your NSDB was at nsdb.example.net. On your fileservers, start with this command:

# nsdbparams update nsdb.example.net

If nsdb.example.net requires TLS, you can use the nsdbparams command to add a certificate that the fileserver will use every time it needs to contact the NSDB. You will need to do this for all NSDBs the fileserver is allowed to contact, including NSDBs not in your FedFS domain.

For more information on the nsdbparams command, see Setting up NSDB connection parameters.

Set up environment variables

The environment variables FEDFS_NSDB_HOST, FEDFS_NSDB_PORT, FEDFS_NSDB_ADMIN, and FEDFS_NSDB_NCE specify what NSDB to use when creating junctions in your FedFS domain. The nfsref command uses the values contained in these variables rather than requiring extra command line options. Setting up your NSDB (above) will generate these values.

Some example values might look like this:

# export FEDFS_NSDB_HOST="nsdb.example.net"
# export FEDFS_NSDB_ADMIN="cn=Directory Manager"
# export FEDFS_NSDB_NCE="ou=fedfs,dc=example,dc=net"

You can also use nsdbparams to store some of these. See nsdbparams(8) for details.

Create FedFS junctions

This works just like creating an NFS basic junction, except that you specify "-t nfs-fedfs" on the "nfsref add" command. After setting up the NSDB and environment variables:

# cd  /.domainroot/example.net
# nfsref  -t nfs-fedfs  add  sales  sales.example.net  /

When a user on an NFSv4 client cd's into /nfs4/example.net/sales, it contacts the domain root NFS server for example.net. The domain root NFS server automatically finds the location sales.example.net:/ by contacting the NSDB nsdb.example.net and querying it for the location of that fileset. The server provides that location to the NFSv4 client, which automatically mounts sales.example.net:/ and allows the user to cd into the freshly mounted directory.

As described earlier in this article, it is possible for FedFS junctions to share the same target. However, the nfsref command always creates a unique set of entries on an NSDB for each junction it creates. It does not support sharing target information. In the future, new administrative interfaces may allow sharing targets between junctions.

Personal tools