Download GLITE 3.1 USER GUIDE

Transcript
$ ldapsearch -x -H ldap://lxb2006.cern.ch:2135 -b "mds-vo-name=local, o=grid"
In order to restrict the search, a filter of the form attribute operator value can be used. The operator is
one of those defined in the following table (note that < and > are not included):
Operator
=
>=
<=
=*
˜=
Description
Entries whose attribute is equal to the value
Entries whose attribute is greater than or equal to the value
Entries whose attribute is less than or equal to the value
Entries that have any value set for that attribute
Entries whose attribute value approximately matches the specified value
Furthermore, complex search filters can be formed by using boolean operators to combine constraints. The boolean
operators that can be used are “AND” (&), “OR” (|) and “NOT” (!). The syntax for such expressions is the
following:
( "&" or "|" or "!" (filter1) [(filter2) ...] )
Example of search filters are:
(& (Name=Smith) (Age>=32))
(! (GlueHostMainMemoryRAMSize<=1000))
It is possible to construct complex queries, but the syntax is not very intuitive so some experimentation may be
needed. Be aware that filters may need to be escaped to prevent special characters being interpreted by the shell.
In LDAP, a special attribute objectClass is defined for each directory entry. It indicates which object classes
are defined for that entry in the LDAP schema. This makes it possible to filter entries that contain a certain object
class. The filter for this case would be:
’objectclass=<name>’
Apart from filtering the search, a list of attribute names can be specified, in order to limit the values returned.
As shown in the next example, only the value of the specified attributes will be returned. Alternatively, grep or
other Unix tools can be used to postprocess the output.
A description of all objectclasses and their attributes usable with the ldapsearch command can be found in
Appendix G.
Example 5.1.4.2
(Getting information about the site name from the GRIS on a CE)
$ ldapsearch -x -h lcgbdii02.gridpp.rl.ac.uk -p 2170 -b o=grid \
’(&(objectclass=GlueSite)(GlueSiteName=ral*))’ GlueSiteWeb \
GlueSiteLatitude GlueSiteLongitude
version: 2
CERN-LCG-GDEIS-722398
Manuals Series
Page 57