FedFsNfsRefGuide0.9
From Linux NFS
Chucklever (Talk | contribs) (→The nfsref command) |
Chucklever (Talk | contribs) (→Junctions in a domain root directory) |
||
Line 49: | Line 49: | ||
== Junctions in a domain root directory == | == 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 | + | A FedFS domain's top-level directory is known as its [[FedFsGlossary#Domain_Root_Directory|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 | + | Let's assume you've already set up a domain root export and domain root directory, say for the example.net domain. See [[FedFsNfsDomainRoot0.9|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 | # cd /.domainroot/example.net | ||
Line 58: | Line 60: | ||
# nfsref add engineering engr.example.net /source | # nfsref add engineering engr.example.net /source | ||
- | Now, when a shell user on | + | 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 | sales marketing engineering |
Revision as of 18:38, 9 January 2013
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.
Junction types
In the above examples, we created "NFS basic" junctions. That simply means that locations are stored right 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, locations are stored remotely on an LDAP server. This becomes interesting when junctions on several fileservers refer to the same location.
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 location information on a remote LDAP server, then you can change the location these junctions refer to simply by updating the location information on that LDAP server. In fact, you don't even need to know how many junctions use that location information: they will all be updated automatically when you update the location on the LDAP server.
A FedFS junction simply refers the fileserver to an entry on the LDAP server which contains the relevant location information for that junction. In the next section, we'll describe how to manage FedFS junctions using the nfsref command.
FedFS junctions
In order to enable automatic resolution of a FedFS junction (that is, to allow fileservers to find the LDAP server with the right location information), some set up is needed first.
Set up an LDAP server and turn it into an NSDB
Find instructions and recipes on how to do this elsewhere in the Installation Guide.
Use the nsdbparams command to tell the fileserver how to contact the NSDB
The NSDB may require some transport layer security. 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.
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. For convenience, the nfsref command uses the values contained in these variables rather than requiring extra command line options. Creating your NSDB will generate these values.
# 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 your 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:
# nfsref -t nfs-fedfs add /.domainroot/example.net/sales sales.example.net /
When an NFS client cd's into /nfs4/example.net/sales, it will mount sales.example.net:/ and cd into it. The NFS server will automatically find the location sales.example.net:/ by contacting the NSDB nsdb.example.net and querying it for the location.
In theory, FedFS junctions can share the same location information. However, the nfsref command always creates a unique set of entries on an NSDB for each junction. It does not allow location sharing. In the future, new administrative interfaces will be developed that can share location information between junctions.