You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Bryan Berry <br...@gmail.com> on 2014/04/09 12:23:45 UTC

how to create new partitions programmatically w/out writing java code?

I would like to create a new partition programmatically, ideally using
something like the commandline tool ldapadd, to create a new partition. Is
there any way to do this w/out writing java code? alternately is there any
way to prepopulate a partition in a new ldap instance by putting a copy of
a partition database?

Re: how to create new partitions programmatically w/out writing java code?

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 4/15/14 11:25 AM, Bryan Berry a écrit :
> Hello Emmanuel,
>
> I have not been successful trying to add the partition.
>
> I have added the text you specified, minus the line
>
>  "ads-contextentry:: <The context entry as a valid LDIF file, base64
> encoded>"
>
> and I still don't see the new partition. I apologize for my lack of
> knowledge about ldap, I am just getting started.
>
> I feel that i am likely missing something very basic

You should see the partition in the namingContexts, in the rootDSE. But
if you don't inject the associated contextEntry, you won't see anything
in your tree.

The partition is just the container, but it contains nothing whn you
create it. the contextEntry is the root of your partition, and it's the
very first entry you will see.

Have you read
http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html ?


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: how to create new partitions programmatically w/out writing java code?

Posted by Bryan Berry <br...@gmail.com>.
Hello Emmanuel,

I have not been successful trying to add the partition.

I have added the text you specified, minus the line

 "ads-contextentry:: <The context entry as a valid LDIF file, base64
encoded>"

and I still don't see the new partition. I apologize for my lack of
knowledge about ldap, I am just getting started.

I feel that i am likely missing something very basic


On Mon, Apr 14, 2014 at 2:36 PM, Emmanuel Lécharny <el...@gmail.com>wrote:

> Le 4/14/14 2:15 PM, Bryan Berry a écrit :
> > Thanks Emmanuel, that's very helpful
> >
> > one more quick question, how do i come up with this value?
> >
> > ads-contextentry:: <The context entry as a valid LDIF file, base64
> encoded>
>
> You don't even have to add this entry in the LDIF file.
>
> You can just start the server, and add teh context entry with an LDAP
> add operation.
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>

Re: how to create new partitions programmatically w/out writing java code?

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 4/14/14 2:15 PM, Bryan Berry a écrit :
> Thanks Emmanuel, that's very helpful
>
> one more quick question, how do i come up with this value?
>
> ads-contextentry:: <The context entry as a valid LDIF file, base64 encoded>

You don't even have to add this entry in the LDIF file.

You can just start the server, and add teh context entry with an LDAP
add operation.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: how to create new partitions programmatically w/out writing java code?

Posted by Bryan Berry <br...@gmail.com>.
Thanks Emmanuel, that's very helpful

one more quick question, how do i come up with this value?

ads-contextentry:: <The context entry as a valid LDIF file, base64 encoded>


On Mon, Apr 14, 2014 at 2:08 PM, Emmanuel Lécharny <el...@gmail.com>wrote:

> Le 4/14/14 1:54 PM, Bryan Berry a écrit :
> > Hello again friends in apacheds
> >
> > when i attempt to add the following new partition with ldapadd, I get an
> > error
> >
> > # foobar.ldif
> > dn: dc=foobar,dc=com
> > objectclass: domain
> > objectclass: top
> > dc: foobar
> >
> > -bash-4.1# ldapadd -H ldap://localhost:10389 -D 'uid=admin,ou=system' -w
> > 'xxxxxx' -f instances/default/conf/foobar.ldif
> > adding new entry "dc=foobar,dc=com"
> > ldap_add: No such object (32)
> >         additional info: NO_SUCH_OBJECT: failed for MessageType :
> > ADD_REQUEST
> > Message ID : 2
> >     Add Request :
> > Entry
> >     dn[n]: dc=foobar,dc=com
> >     objectclass: domain
> >     objectclass: top
> >     dc: cyclecloud
> > : ERR_268 Cannot find a partition for dc=foobar,dc=com
> >
> > Is there something else I need to create first in order to create a new
> > partition?
>
> You need to declare the partition in the configuration file.
>
> Either you do that with Studio, or you modify the config.ldif file and add
> those elements into it :
>
> dn:
> ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> objectclass: top
> objectClass: ads-base
> objectclass: ads-partition
> objectclass: ads-jdbmPartition
> ads-partitionSuffix: dc=foobar,dc=com
> ads-contextentry:: <The context entry as a valid LDIF file, base64 encoded>
> ads-jdbmpartitionoptimizerenabled: TRUE
> ads-partitioncachesize: 10000
> ads-partitionsynconwrite: TRUE
> ads-partitionid: example
> ads-enabled: TRUE
>
> dn:
> ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ou: indexes
> objectclass: organizationalUnit
> objectclass: top
>
> dn:
> ads-indexAttributeId=apacheRdn,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ads-indexattributeid: apacheRdn
> ads-indexHasReverse: TRUE
> ads-indexcachesize: 100
> objectclass: ads-index
> objectclass: ads-jdbmIndex
> objectclass: ads-base
> objectclass: top
> ads-enabled: TRUE
>
> dn:
> ads-indexAttributeId=apachePresence,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ads-indexattributeid: apachePresence
> ads-indexHasReverse: FALSE
> ads-indexcachesize: 100
> objectclass: ads-index
> objectclass: ads-jdbmIndex
> objectclass: ads-base
> objectclass: top
> ads-enabled: TRUE
>
> dn:
> ads-indexAttributeId=apacheOneAlias,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ads-indexattributeid: apacheOneAlias
> ads-indexHasReverse: FALSE
> ads-indexcachesize: 100
> objectclass: ads-index
> objectclass: ads-jdbmIndex
> objectclass: ads-base
> objectclass: top
> ads-enabled: TRUE
>
> dn:
> ads-indexAttributeId=apacheSubAlias,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ads-indexattributeid: apacheSubAlias
> ads-indexHasReverse: FALSE
> ads-indexcachesize: 100
> objectclass: ads-index
> objectclass: ads-jdbmIndex
> objectclass: ads-base
> objectclass: top
> ads-enabled: TRUE
>
> dn:
> ads-indexAttributeId=apacheAlias,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ads-indexattributeid: apacheAlias
> ads-indexHasReverse: FALSE
> ads-indexcachesize: 100
> objectclass: ads-index
> objectclass: ads-jdbmIndex
> objectclass: ads-base
> objectclass: top
> ads-enabled: TRUE
>
> dn:
> ads-indexAttributeId=dc,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ads-indexattributeid: dc
> ads-indexHasReverse: FALSE
> ads-indexcachesize: 100
> objectclass: ads-index
> objectclass: ads-jdbmIndex
> objectclass: ads-base
> objectclass: top
> ads-enabled: TRUE
>
> dn:
> ads-indexAttributeId=objectClass,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ads-indexattributeid: objectClass
> ads-indexHasReverse: FALSE
> ads-indexcachesize: 100
> objectclass: ads-index
> objectclass: ads-jdbmIndex
> objectclass: ads-base
> objectclass: top
> ads-enabled: TRUE
>
> dn:
> ads-indexAttributeId=entryCSN,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ads-indexattributeid: entryCSN
> ads-indexHasReverse: FALSE
> ads-indexcachesize: 100
> objectclass: ads-index
> objectclass: ads-jdbmIndex
> objectclass: ads-base
> objectclass: top
> ads-enabled: TRUE
>
> dn:
> ads-indexAttributeId=administrativeRole,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
> ads-indexattributeid: administrativeRole
> ads-indexHasReverse: FALSE
> ads-indexcachesize: 100
> objectclass: ads-index
> objectclass: ads-jdbmIndex
> objectclass: ads-base
> objectclass: top
> ads-enabled: TRUE
>
>
>
> and any index you want...
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>

Re: how to create new partitions programmatically w/out writing java code?

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 4/14/14 1:54 PM, Bryan Berry a écrit :
> Hello again friends in apacheds
>
> when i attempt to add the following new partition with ldapadd, I get an
> error
>
> # foobar.ldif
> dn: dc=foobar,dc=com
> objectclass: domain
> objectclass: top
> dc: foobar
>
> -bash-4.1# ldapadd -H ldap://localhost:10389 -D 'uid=admin,ou=system' -w
> 'xxxxxx' -f instances/default/conf/foobar.ldif
> adding new entry "dc=foobar,dc=com"
> ldap_add: No such object (32)
>         additional info: NO_SUCH_OBJECT: failed for MessageType :
> ADD_REQUEST
> Message ID : 2
>     Add Request :
> Entry
>     dn[n]: dc=foobar,dc=com
>     objectclass: domain
>     objectclass: top
>     dc: cyclecloud
> : ERR_268 Cannot find a partition for dc=foobar,dc=com
>
> Is there something else I need to create first in order to create a new
> partition?

You need to declare the partition in the configuration file. 

Either you do that with Studio, or you modify the config.ldif file and add those elements into it :

dn: ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
objectclass: top
objectClass: ads-base
objectclass: ads-partition
objectclass: ads-jdbmPartition
ads-partitionSuffix: dc=foobar,dc=com
ads-contextentry:: <The context entry as a valid LDIF file, base64 encoded>
ads-jdbmpartitionoptimizerenabled: TRUE
ads-partitioncachesize: 10000
ads-partitionsynconwrite: TRUE
ads-partitionid: example
ads-enabled: TRUE

dn: ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ou: indexes
objectclass: organizationalUnit
objectclass: top

dn: ads-indexAttributeId=apacheRdn,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: apacheRdn
ads-indexHasReverse: TRUE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex
objectclass: ads-base
objectclass: top
ads-enabled: TRUE

dn: ads-indexAttributeId=apachePresence,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: apachePresence
ads-indexHasReverse: FALSE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex
objectclass: ads-base
objectclass: top
ads-enabled: TRUE

dn: ads-indexAttributeId=apacheOneAlias,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: apacheOneAlias
ads-indexHasReverse: FALSE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex
objectclass: ads-base
objectclass: top
ads-enabled: TRUE

dn: ads-indexAttributeId=apacheSubAlias,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: apacheSubAlias
ads-indexHasReverse: FALSE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex
objectclass: ads-base
objectclass: top
ads-enabled: TRUE

dn: ads-indexAttributeId=apacheAlias,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: apacheAlias
ads-indexHasReverse: FALSE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex
objectclass: ads-base
objectclass: top
ads-enabled: TRUE

dn: ads-indexAttributeId=dc,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: dc
ads-indexHasReverse: FALSE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex
objectclass: ads-base
objectclass: top
ads-enabled: TRUE

dn: ads-indexAttributeId=objectClass,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: objectClass
ads-indexHasReverse: FALSE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex
objectclass: ads-base
objectclass: top
ads-enabled: TRUE

dn: ads-indexAttributeId=entryCSN,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: entryCSN
ads-indexHasReverse: FALSE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex
objectclass: ads-base
objectclass: top
ads-enabled: TRUE

dn: ads-indexAttributeId=administrativeRole,ou=indexes,ads-partitionId=foobar,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: administrativeRole
ads-indexHasReverse: FALSE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex
objectclass: ads-base
objectclass: top
ads-enabled: TRUE



and any index you want...


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: how to create new partitions programmatically w/out writing java code?

Posted by Bryan Berry <br...@gmail.com>.
Hello again friends in apacheds

when i attempt to add the following new partition with ldapadd, I get an
error

# foobar.ldif
dn: dc=foobar,dc=com
objectclass: domain
objectclass: top
dc: foobar

-bash-4.1# ldapadd -H ldap://localhost:10389 -D 'uid=admin,ou=system' -w
'xxxxxx' -f instances/default/conf/foobar.ldif
adding new entry "dc=foobar,dc=com"
ldap_add: No such object (32)
        additional info: NO_SUCH_OBJECT: failed for MessageType :
ADD_REQUEST
Message ID : 2
    Add Request :
Entry
    dn[n]: dc=foobar,dc=com
    objectclass: domain
    objectclass: top
    dc: cyclecloud
: ERR_268 Cannot find a partition for dc=foobar,dc=com

Is there something else I need to create first in order to create a new
partition?

On Thu, Apr 10, 2014 at 5:33 PM, Bryan Berry <br...@gmail.com> wrote:

> Thanks kiran, i will try that out
> On Apr 9, 2014 5:21 PM, "Kiran Ayyagari" <ka...@apache.org> wrote:
>
>> On Wed, Apr 9, 2014 at 3:53 PM, Bryan Berry <br...@gmail.com>
>> wrote:
>>
>> > I would like to create a new partition programmatically, ideally using
>> > something like the commandline tool ldapadd, to create a new partition.
>> Is
>> >
>> using ldapadd you can only add the partition's configuration, to make the
>> partition available you need to restart the server
>>
>> > there any way to do this w/out writing java code? alternately is there
>> any
>> > way to prepopulate a partition in a new ldap instance by putting a copy
>> of
>> > a partition database?
>> >
>> if you have the data files in a compatible format then moving them to
>> partitions
>> folder and adding the appropriate configuration should do the trick
>>
>>
>>
>> --
>> Kiran Ayyagari
>> http://keydap.com
>>
>

Re: how to create new partitions programmatically w/out writing java code?

Posted by Bryan Berry <br...@gmail.com>.
Thanks kiran, i will try that out
On Apr 9, 2014 5:21 PM, "Kiran Ayyagari" <ka...@apache.org> wrote:

> On Wed, Apr 9, 2014 at 3:53 PM, Bryan Berry <br...@gmail.com> wrote:
>
> > I would like to create a new partition programmatically, ideally using
> > something like the commandline tool ldapadd, to create a new partition.
> Is
> >
> using ldapadd you can only add the partition's configuration, to make the
> partition available you need to restart the server
>
> > there any way to do this w/out writing java code? alternately is there
> any
> > way to prepopulate a partition in a new ldap instance by putting a copy
> of
> > a partition database?
> >
> if you have the data files in a compatible format then moving them to
> partitions
> folder and adding the appropriate configuration should do the trick
>
>
>
> --
> Kiran Ayyagari
> http://keydap.com
>

Re: how to create new partitions programmatically w/out writing java code?

Posted by Kiran Ayyagari <ka...@apache.org>.
On Wed, Apr 9, 2014 at 3:53 PM, Bryan Berry <br...@gmail.com> wrote:

> I would like to create a new partition programmatically, ideally using
> something like the commandline tool ldapadd, to create a new partition. Is
>
using ldapadd you can only add the partition's configuration, to make the
partition available you need to restart the server

> there any way to do this w/out writing java code? alternately is there any
> way to prepopulate a partition in a new ldap instance by putting a copy of
> a partition database?
>
if you have the data files in a compatible format then moving them to
partitions
folder and adding the appropriate configuration should do the trick



-- 
Kiran Ayyagari
http://keydap.com