'\"macro stdmacro
.if n .pH g4.ypfiles @(#)ypfiles	40.3 of 1/29/90
.\" Copyright 1989 AT&T
.\" @(#)ypfiles.5 1.10 89/09/28 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.nr X
.if \nX=0 .ds x} ypfiles 4 "" "\&"
.if \nX=1 .ds x} ypfiles 4 ""
.if \nX=2 .ds x} ypfiles 4 "" "\&"
.if \nX=3 .ds x} ypfiles "" "" "\&"
.TH \*(x}
.SH NAME
\f4ypfiles\fP \- the YP database and directory structure
.SH DESCRIPTION
.P
The 
\s-1YP\s0
network lookup service uses a distributed,
replicated database of
\f4dbm\fR
files contained in the
\f4/var/yp\fR
directory hierarchy on each
\s-1YP\s0
server.
A
\f4dbm\fR
database consists of two files,
one has the filename extension
\f4\&.pag\fR
and the other has the filename extension
\f4\&.dir\fR.
For instance, the database named
\f4publickey\fR,
is implemented by the pair of files
\f4publickey.pag\fR
and
\f4publickey.dir\fR.
.P
A
\f4dbm\fR
database served by the
\s-1YP\s0
is called a
\s-1YP\s0
\f2map\fR.
A
\s-1YP\s0
\f2ypdomain\fR
is a subdirectory of
\f4/var/yp\fR
containing a set of
\s-1YP\s0
maps. 
Any number of
\s-1YP\s0
domains can exist.
Each may contain any number of maps.
.P
No maps are required by the
\s-1YP\s0
lookup service itself, although they may
be required for the normal operation of
other parts of the system. 
There is no list of maps which
\s-1YP\s0
serves \(em if the map exists in a given domain, and a
client asks about it, the
\s-1YP\s0
will serve it.
For a map to be
accessible consistently, it must exist on all
\s-1YP\s0
servers that serve the domain.
To provide data consistency between the
replicated maps, an  entry to run
\f4ypxfr\fR
periodically should be made in the privileged user's
\f4crontab\fR
file on each server.
More information on this topic is in
\f4ypxfr\fR(1M).
.P
\s-1YP\s0
maps should contain two distinguished
key-value pairs.
The first is the key
\f4\s-1YP_LAST_MODIFIED\s0\fR,
having as a value a ten-character
\s-1ASCII\s0
order number.
The order number should be the
system time in seconds when the map was built.
The second key is
\f4\s-1YP_MASTER_NAME\s0\fR,
with the name of the
\s-1YP\s0
master server as a value.
\f4makedbm\fR(1M)
generates both key-value pairs automatically.
A map that does not contain both
key-value pairs can be served by the
\s-1YP\s0,
but the
\f4ypserv\fR
process will not be able to return values for
``Get order number'' or ``Get master name'' requests.
See
\f4ypserv\fR(1M).
In addition, values of these two keys are used by
\f4ypxfr\fR
when it transfers a map from a master
\s-1YP\s0
server to a slave.
If
\f4ypxfr\fR
cannot figure out where to get the map,
or if it is unable to
determine whether the local copy is more
recent than the copy at the master,
extra command line switches must be set
when it is run.
.P
\s-1YP\s0
maps must be generated and modified
only at the master server. 
They are copied to the slaves using
\f4ypxfr\fR(1M)
to avoid potential byte-ordering problems among
\s-1YP\s0
servers running on machines with different
architectures, and to minimize the amount of disk
space required for the dbm files.
The
\s-1YP\s0
database can be initially
set up for both masters and slaves by using
\f4ypinit\fR(1M).
.P
After the server databases are set up, it
is probable that the contents of
some maps will change.
In general, some
\s-1ASCII\s0
source version of the
database exists on the master, and it
is changed with a standard text editor.
The update is incorporated into the
\s-1YP\s0
map and is propagated from
the master to the slaves by running
\f4/var/yp/Makefile\fR,
see
\f4ypmake\fR(1M).
All Sun-supplied maps have entries in
\f4/var/yp/Makefile\fR;
if a
\s-1YP\s0
map is added, edit this file to support the new map.
The makefile uses
\f4makedbm\fR(1M)
to generate the
\s-1YP\s0
map on the master, and
\f4yppush\fR(1M)
to propagate the changed map to the slaves.
\f4yppush\fR
is a client of the map
\f4ypservers\fR,
which lists all the
\s-1YP\s0
servers.
For more information on this topic, see
\f4yppush\fR(1M).
.SH FILES
.PD 0
.TP 20
\f4/var/yp\fR
.TP
\f4/var/yp/aliases\fR
.TP
\f4/var/yp/Makefile\fR
.PD
.SH "SEE ALSO"
\f4makedbm\fR(1M),
\f4ypinit\fR(1M),
\f4ypmake\fR(1M),
\f4yppoll\fR(1M),
\f4yppush\fR(1M),
\f4ypserv\fR(1M),
\f4ypxfr\fR(1M),
\f4dbm\fR(3),
\f4publickey\fR(4)
