go to  ForumEasy.com   
LdapPro  
 
 
   Home  |  MyForum  |  FAQ  |  Archive    You are not logged in. [Login] or [Register]  
Forum Home » Native LDAP Servers -- AD, OpenLdap, etc. » OpenDJ Command Line Usage Examples
Email To Friend  |   Set Alert To This Topic Rewarding Points Availabe: 0 (What's this) New Topic  |   Post Reply
Author Topic: OpenDJ Command Line Usage Examples
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 08/17/2011 08:07:07 PM    Edit  |   Quote  |   Report 
OpenDJ Command Line Usage Examples
Starting point: Download openDJ-version.zip and unzip it into any folder.



Example 1. setup -- Installs and configures an OpenDJ instance.

C:\tmp\OpenDJ-2.4.3>setup --cli --doNotStart -p 389 --adminConnectorPo
rt 4444 -D "cn=Directory Manager" -w password -b dc=example,dc=com -a

OpenDJ 2.4.3
Please wait while the setup program initializes...

Do you want to enable SSL? (yes / no) [no]:

Do you want to enable Start TLS? (yes / no) [no]:

Enable the server to run as a Windows Service? (yes / no) [no]:


Setup Summary
=============
LDAP Listener Port:            389
Administration Connector Port: 4444
LDAP Secure Access:            disabled
Root User DN:                  cn=Directory Manager
Directory Data:                Create New Base DN dc=example,dc=com.
Base DN Data: Only Create Base Entry (dc=example,dc=com)

Do not start Server when the configuration is completed
Do not enable the server to run as a Windows Service


What would you like to do?

    1)  Set up the server with the parameters above
    2)  Provide the setup parameters again
    3)  Print equivalent non-interactive command-line
    4)  Cancel and exit

Enter choice [1]:

See C:\tmp\AppData\Local\Temp\opends-setup-8557193669937784914.log for
 a detailed log of this operation.

Configuring Directory Server ..... Done.
Creating Base Entry dc=example,dc=com ..... Done.

To see basic server configuration status and configuration you can launch C:\tmp
\OpenDJ-2.4.3\bat\status.bat



Note: The setup command can only be executed once.

If you try to run it the second time,

C:\tmp\OpenDJ-2.4.3>setup --cli --doNotStart -p 389 --adminConnectorPo
rt 4444 -D "cn=Directory Manager" -w password -b dc=example,dc=com -a


here is what you may get:

Server Already Configured
setup.bat command-line can only be used with servers that have not yet been
configured.  The current server:
- Contains data
- Has already been configured

 Profile | Reply Points Earned: 0
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 08/17/2011 08:30:40 PM    Edit  |   Quote  |   Report 
Example 2: Start OpenDJ Server Instance

C:\tmp\OpenDJ-2.4.3\bat>start-ds

[17/Aug/2011:17:25:52 -0700] category=CORE severity=INFORMATION msgID=132 msg=Th
e Directory Server is beginning the configuration bootstrapping process
[17/Aug/2011:17:25:52 -0700] category=EXTENSIONS severity=INFORMATION msgID=1049
147 msg=Loaded extension from file 'C:\tmp\OpenDJ-2.4.3\lib\extensions
\snmp-mib2605.jar' (build 2.4.3, revision 6998)
[17/Aug/2011:17:25:52 -0700] category=CORE severity=NOTICE msgID=458886 msg=Open
DJ 2.4.3 (build 20110613203412Z, R6998) starting up
[17/Aug/2011:17:25:54 -0700] category=RUNTIME_INFORMATION severity=NOTICE msgID=
20381717 msg=Installation Directory:  C:\tmp\OpenDJ-2.4.3
[17/Aug/2011:17:25:54 -0700] category=RUNTIME_INFORMATION severity=NOTICE msgID=
20381719 msg=Instance Directory:      C:\tmp\OpenDJ-2.4.3
[17/Aug/2011:17:25:54 -0700] category=RUNTIME_INFORMATION severity=NOTICE msgID=
20381713 msg=JVM Information: 1.6.0_22-b04 by Sun Microsystems Inc., 64-bit arch
itecture, 1907032064 bytes heap size
[17/Aug/2011:17:25:54 -0700] category=RUNTIME_INFORMATION severity=NOTICE msgID=
20381714 msg=JVM Host: TestHost, running Windows XP amd64, 2380467584
bytes physical memory size, number of processors available 8
[17/Aug/2011:17:25:54 -0700] category=RUNTIME_INFORMATION severity=NOTICE msgID=
20381715 msg=JVM Arguments: "-Dorg.opends.server.scriptName=start-ds"
[17/Aug/2011:17:25:55 -0700] category=ACCESS_CONTROL severity=INFORMATION msgID=
12582978 msg=Added 10 Global Access Control Instruction (ACI) attribute types to
 the access control evaluation engine
[17/Aug/2011:17:25:55 -0700] category=BACKEND severity=INFORMATION msgID=9437595
 msg=Local DB backend userRoot does not specify the number of lock tables: defau
lting to 97
[17/Aug/2011:17:25:55 -0700] category=BACKEND severity=INFORMATION msgID=9437594
 msg=Local DB backend userRoot does not specify the number of cleaner threads: d
efaulting to 24 threads
[17/Aug/2011:17:25:56 -0700] category=JEB severity=NOTICE msgID=8847402 msg=The
database backend userRoot containing 1 entries has started
[17/Aug/2011:17:25:56 -0700] category=EXTENSIONS severity=INFORMATION msgID=1048
797 msg=DIGEST-MD5 SASL mechanism using a server fully qualified domain name of: 
TestHost
[17/Aug/2011:17:25:57 -0700] category=CORE severity=INFORMATION msgID=720 msg=No
 worker queue thread pool size specified: sizing automatically to use 24 threads

[17/Aug/2011:17:25:57 -0700] category=PROTOCOL severity=NOTICE msgID=2556180 msg
=Started listening for new connections on Administration Connector 0.0.0.0 port
4444
[17/Aug/2011:17:25:57 -0700] category=PROTOCOL severity=NOTICE msgID=2556180 msg
=Started listening for new connections on LDAP Connection Handler 0.0.0.0 port 3
89
[17/Aug/2011:17:25:57 -0700] category=CORE severity=NOTICE msgID=458887 msg=The
Directory Server has started successfully
[17/Aug/2011:17:25:57 -0700] category=CORE severity=NOTICE msgID=458891 msg=The
Directory Server has sent an alert notification generated by class org.opends.se
rver.core.DirectoryServer (alert type org.opends.server.DirectoryServerStarted,
alert ID 458887):  The Directory Server has started successfully



An LDAP query can be executed to confirm that the server is running:

C:\>ldapsearch -p 389 -D "cn=Directory Manager" -w
 password -b "dc=example,dc=com" -s sub "(objectclass=*)"

dn: dc=example,dc=com
dc: example
objectClass: domain
objectClass: top

 Profile | Reply Points Earned: 0
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 08/17/2011 08:55:31 PM    Edit  |   Quote  |   Report 
Example 3: Configure Server -- Create a backend

C:\tmp\OpenDJ-2.4.3\bat>dsconfig -p 4444 -D "cn=Directory Manager" -w password --trustAll 
create-backend --backend-name myDate --set base-dn:o=myData --set enabled:true --type local-db


>>>> Configure the properties of the Local DB Backend

        Property           Value(s)
        ---------------------------
    1)  backend-id         myDate
    2)  base-dn            o=myData
    3)  compact-encoding   true
    4)  db-cache-percent   10
    5)  db-cache-size      0 b
    6)  db-directory       db
    7)  enabled            true
    8)  index-entry-limit  4000
    9)  writability-mode   enabled

    ?)  help
    f)  finish - create the new Local DB Backend
    q)  quit

Enter choice [f]:

The Local DB Backend was created successfully



Note #1: create-backend creates only naming context.

A search is run against the newly create backend will fail to bring back anything:

C:\tmp\OpenDJ-2.4.3\bat>ldapsearch -p 389 -D "cn=Directory Manager" -w password -b "o=myData" -s sub "(objectclass=*)"

SEARCH operation failed
Result Code:  32 (No Such Entry)
Additional Information:  The search base entry 'o=myData' does not exist


This is due to the fact that no data has been populated to this backend yet.

Note #2: dsconfig requires that the server to be configured must be running.

If you stop the server and run the same command again:

C:\tmp\OpenDJ-2.4.3\bat>dsconfig -p 4444 -D "cn=Directory Manager" -w password --trustAll 
create-backend --backend-name myDate --set base-dn:o=myData --set enabled:true --type local-db


Unable to connect to the server at "localhost" on port 4444

 Profile | Reply Points Earned: 0
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 08/17/2011 09:39:09 PM    Edit  |   Quote  |   Report 
Example 4: Configure Server -- Create index

C:\tmp\OpenDJ-2.4.3\bat>dsconfig -p 4444 -D "cn=Directory Manager" -w password --trustAll 
create-local-db-index --backend-name myDate --index-name cn 
--set index-type:equality --set index-type:substring


>>>> Configure the properties of the Local DB Index

        Property                        Value(s)
        -----------------------------------------------------------------------
    1)  attribute                       cn
    2)  index-entry-limit               4000
    3)  index-extensible-matching-rule  No extensible matching rules will be
                                        indexed.
    4)  index-type                      equality, substring

    ?)  help
    f)  finish - create the new Local DB Index
    q)  quit

Enter choice [f]:

The Local DB Index was created successfully


 Profile | Reply Points Earned: 0

 
Powered by ForumEasy © 2003-2005, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.