You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Krish Dey <kr...@gmail.com> on 2019/11/07 03:11:02 UTC

Re: Embedded ApacheDS

Hi All,
I am trying to do User Lookup and eventually returning their groups.

Its returning the result very slow. A single filtering is taking around 2
secs.
Though i have done the following,

partitionFactory.addIndex
<https://www.codota.com/code/java/methods/org.apache.directory.server.core.factory.PartitionFactory/addIndex>(partition,
SchemaConstants.OBJECT_CLASS_AT, 5000);

Is it not enough?
I have added a custom attribute to my partition which is sAMAccount.

Do I need to do anything different?

Any help would be appreciated.

Thanks
Krish


On Tue, Feb 14, 2017 at 3:16 PM Cyril FILLON <cy...@yahoo.fr.invalid>
wrote:

>
>
> Many thanks, this link has been really helpful for me.
> Thanks again.
>
>
>
>
> ----- Mail original -----
> De : Krish <kr...@gmail.com>
> À : users@directory.apache.org
> Envoyé le : Jeudi 9 février 2017 17h20
> Objet : Re: Embedded ApacheDS
>
>
> https://github.com/krishdey/EmbeddedLdapKDC
> Sorry forgot to paste the link
> Sent from my iPhone
>
>
> > On Feb 9, 2017, at 10:49 AM, Krish <kr...@gmail.com> wrote:
> >
> > Look into this project and see if it helps.
> > I have created an embedded apache ds and also loaded custom partook and
> Microsoft schema custom attributes to it.
> >
> > Thanks
> > Krish
> >
> > Sent from my iPhone
> >
> >> On Feb 9, 2017, at 10:18 AM, Cyril FILLON <cy...@yahoo.fr.INVALID>
> wrote:
> >>
> >> Hi all,
> >>
> >>
> >> I am trying to setup an embedded ApacheDS 2.0.0-M23 server from my java
> code, snippet is given below.
> >>
> >> I tried to create a new partition, but unfortunately it fails miserably
> since I cannot see this partition from ApacheDS Studio.
> >> Anyone could help me or give me a code snippet in order to be able to
> start the ApacheDS server from Java code and create a partition?
> >> I already gave a look to the documentation page
> http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html,
> however the code snippet does not work as well.
> >>
> >>
> >> Many thanks in advance.
> >>
> >> public void start()
> >> {
> >>   ApacheDsService apacheDsService = new ApacheDsService();
> >>
> >>   apacheDsService.start(new InstanceLayout(this.ldapInstanceFolder));
> >>   DirectoryService directoryService =
> this.apacheDsService.getDirectoryService();
> >>
> >>   directoryService.getChangeLog().setEnabled(true);
> >>   directoryService.setAllowAnonymousAccess(true);
> >>
> >>   final SchemaManager schemaManager =
> this.directoryService.getSchemaManager();
> >>
> >>
> >>   // Create the partition
> >>   final Dn suffixDn = new Dn(schemaManager, "o=sevenSeas");    final
> JdbmPartition partition = getJdbmPartition(this.directoryService,
> "sevenSeas", suffixDn, contextEntry);
> >>   partition.initialize();
> >>
> >>
> >>   directoryService.addPartition(partition);
> >> }
> >>
> >>
> >> private JdbmPartition getJdbmPartition(final DirectoryService
> directoryService, final String partitionId, final Dn suffixDN, final Entry
> entry) throws ConfigurationException
> >>  {
> >>   final JdbmPartition jdbmPartition = new
> JdbmPartition(directoryService.getSchemaManager(),
> directoryService.getDnFactory());
> >>
> >>   jdbmPartition.setId(partitionId);
> >>   jdbmPartition.setCacheSize(1000);
> >>   jdbmPartition.setOptimizerEnabled(true);
> >>   File partitionPath = new
> File(directoryService.getInstanceLayout().getPartitionsDirectory(),
> partitionId);
> >>   jdbmPartition.setPartitionPath(partitionPath.toURI());
> >>
> >>   try
> >>   {
> >>     jdbmPartition.setSuffixDn(suffixDN);
> >>   }
> >>   catch (final LdapInvalidDnException lide)
> >>   {
> >>     lide.printStackTrace();
> >>     throw new ConfigurationException(lide.getMessage());
> >>   }
> >>
> >>   jdbmPartition.setSyncOnWrite(true);
> >>
> >>      return jdbmPartition;
> >> }
> >>
> >> Cyril
>

Re: Embedded ApacheDS

Posted by Krish Dey <kr...@gmail.com>.
Thanks a lot.
It seems to make it lot faster.

On Thu, Nov 7, 2019 at 3:47 AM Emmanuel Lécharny <el...@gmail.com>
wrote:

>
> On 07/11/2019 04:11, Krish Dey wrote:
> > Hi All,
> > I am trying to do User Lookup and eventually returning their groups.
> >
> > Its returning the result very slow. A single filtering is taking around 2
> > secs.
> > Though i have done the following,
> >
> > partitionFactory.addIndex
> > <
> https://www.codota.com/code/java/methods/org.apache.directory.server.core.factory.PartitionFactory/addIndex
> >(partition,
> > SchemaConstants.OBJECT_CLASS_AT, 5000);
>
> This is just adding an Index on the ObjectClass attributeType. You might
> want to add more indexes, depending on the search Filter you are using.
>
> Typically, you may want to index the SAMAccount attribute.
>
>
> >
> > Is it not enough?
> > I have added a custom attribute to my partition which is sAMAccount.
> >
> > Do I need to do anything different?
> >
> > Any help would be appreciated.
> >
> > Thanks
> > Krish
> >
> >
> > On Tue, Feb 14, 2017 at 3:16 PM Cyril FILLON
> <cy...@yahoo.fr.invalid>
> > wrote:
> >
> >>
> >> Many thanks, this link has been really helpful for me.
> >> Thanks again.
> >>
> >>
> >>
> >>
> >> ----- Mail original -----
> >> De : Krish <kr...@gmail.com>
> >> À : users@directory.apache.org
> >> Envoyé le : Jeudi 9 février 2017 17h20
> >> Objet : Re: Embedded ApacheDS
> >>
> >>
> >> https://github.com/krishdey/EmbeddedLdapKDC
> >> Sorry forgot to paste the link
> >> Sent from my iPhone
> >>
> >>
> >>> On Feb 9, 2017, at 10:49 AM, Krish <kr...@gmail.com> wrote:
> >>>
> >>> Look into this project and see if it helps.
> >>> I have created an embedded apache ds and also loaded custom partook and
> >> Microsoft schema custom attributes to it.
> >>> Thanks
> >>> Krish
> >>>
> >>> Sent from my iPhone
> >>>
> >>>> On Feb 9, 2017, at 10:18 AM, Cyril FILLON
> <cy...@yahoo.fr.INVALID>
> >> wrote:
> >>>> Hi all,
> >>>>
> >>>>
> >>>> I am trying to setup an embedded ApacheDS 2.0.0-M23 server from my
> java
> >> code, snippet is given below.
> >>>> I tried to create a new partition, but unfortunately it fails
> miserably
> >> since I cannot see this partition from ApacheDS Studio.
> >>>> Anyone could help me or give me a code snippet in order to be able to
> >> start the ApacheDS server from Java code and create a partition?
> >>>> I already gave a look to the documentation page
> >>
> http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html,
> >> however the code snippet does not work as well.
> >>>>
> >>>> Many thanks in advance.
> >>>>
> >>>> public void start()
> >>>> {
> >>>>    ApacheDsService apacheDsService = new ApacheDsService();
> >>>>
> >>>>    apacheDsService.start(new InstanceLayout(this.ldapInstanceFolder));
> >>>>    DirectoryService directoryService =
> >> this.apacheDsService.getDirectoryService();
> >>>>    directoryService.getChangeLog().setEnabled(true);
> >>>>    directoryService.setAllowAnonymousAccess(true);
> >>>>
> >>>>    final SchemaManager schemaManager =
> >> this.directoryService.getSchemaManager();
> >>>>
> >>>>    // Create the partition
> >>>>    final Dn suffixDn = new Dn(schemaManager, "o=sevenSeas");    final
> >> JdbmPartition partition = getJdbmPartition(this.directoryService,
> >> "sevenSeas", suffixDn, contextEntry);
> >>>>    partition.initialize();
> >>>>
> >>>>
> >>>>    directoryService.addPartition(partition);
> >>>> }
> >>>>
> >>>>
> >>>> private JdbmPartition getJdbmPartition(final DirectoryService
> >> directoryService, final String partitionId, final Dn suffixDN, final
> Entry
> >> entry) throws ConfigurationException
> >>>>   {
> >>>>    final JdbmPartition jdbmPartition = new
> >> JdbmPartition(directoryService.getSchemaManager(),
> >> directoryService.getDnFactory());
> >>>>    jdbmPartition.setId(partitionId);
> >>>>    jdbmPartition.setCacheSize(1000);
> >>>>    jdbmPartition.setOptimizerEnabled(true);
> >>>>    File partitionPath = new
> >> File(directoryService.getInstanceLayout().getPartitionsDirectory(),
> >> partitionId);
> >>>>    jdbmPartition.setPartitionPath(partitionPath.toURI());
> >>>>
> >>>>    try
> >>>>    {
> >>>>      jdbmPartition.setSuffixDn(suffixDN);
> >>>>    }
> >>>>    catch (final LdapInvalidDnException lide)
> >>>>    {
> >>>>      lide.printStackTrace();
> >>>>      throw new ConfigurationException(lide.getMessage());
> >>>>    }
> >>>>
> >>>>    jdbmPartition.setSyncOnWrite(true);
> >>>>
> >>>>       return jdbmPartition;
> >>>> }
> >>>>
> >>>> Cyril
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@directory.apache.org
> For additional commands, e-mail: users-help@directory.apache.org
>
>

Re: Embedded ApacheDS JDBM Issue

Posted by Emmanuel Lécharny <el...@gmail.com>.
Hi,

On 2022/10/06 17:47, Krish Dey wrote:
> Hi All,
> 
> I am used the embedded ApacheDS in JAVA application. I am having issues 
> with JDBM and hitting the bug 
> https://issues.apache.org/jira/browse/DIRSERVER-2333 
> <https://issues.apache.org/jira/browse/DIRSERVER-2333>
> 
> I want to switch to Mavibot. I am using the ApacheDS 2.0.0-M24.
> 
> Is it possible to switch to Mavibot in the ApacheDS 2.0.0-M24 version?

Mavibot is avaialble for M24
> 
> Does the ApacheDS 2.0.0.AM26 use Mavibot Tree by default or we need to 
> explicitly do something in the code?

Not in the code, but you need to change all teh config where you were 
using JDBM to replace that by Mavibot (partitions and indexes):

...
dn: 
ads-partitionId=system,ou=partitions,ads-directoryServiceId=default,ou=config
objectclass: top
objectClass: ads-base
objectclass: ads-partition
objectclass: ads-jdbmPartition -> ads-mavibotPartition
ads-partitionSuffix: ou=system
ads-jdbmpartitionoptimizerenabled: TRUE
ads-partitioncachesize: 10000
ads-partitionsynconwrite: TRUE
ads-partitionid: system
ads-enabled: TRUE

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

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

dn: 
ads-indexAttributeId=apachePresence,ou=indexes,ads-partitionId=system,ou=partitions,ads-directoryServiceId=default,ou=config
ads-indexattributeid: apachePresence
ads-indexHasReverse: FALSE
ads-indexcachesize: 100
objectclass: ads-index
objectclass: ads-jdbmIndex (same thing as previous)
objectclass: ads-base
objectclass: top
ads-enabled: TRUE
...



> 
> Thanks everyone for the help so far.
> 
> Krish**
> 

-- 
*Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE
T. +33 (0)4 89 97 36 50
P. +33 (0)6 08 33 32 61
emmanuel.lecharny@busit.com https://www.busit.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@directory.apache.org
For additional commands, e-mail: users-help@directory.apache.org


Embedded ApacheDS JDBM Issue

Posted by Krish Dey <kr...@gmail.com>.
Hi All,

I am used the embedded ApacheDS in JAVA application. I am having issues with JDBM and hitting the bug https://issues.apache.org/jira/browse/DIRSERVER-2333

I want to switch to Mavibot. I am using the ApacheDS 2.0.0-M24.
Is it possible to switch to Mavibot in the ApacheDS 2.0.0-M24 version?


Does the ApacheDS 2.0.0.AM26 use Mavibot Tree by default or we need to explicitly do something in the code?

Thanks everyone for the help so far.

Krish



Re: Embedded ApacheDS

Posted by Emmanuel Lécharny <el...@gmail.com>.
On 07/11/2019 04:11, Krish Dey wrote:
> Hi All,
> I am trying to do User Lookup and eventually returning their groups.
>
> Its returning the result very slow. A single filtering is taking around 2
> secs.
> Though i have done the following,
>
> partitionFactory.addIndex
> <https://www.codota.com/code/java/methods/org.apache.directory.server.core.factory.PartitionFactory/addIndex>(partition,
> SchemaConstants.OBJECT_CLASS_AT, 5000);

This is just adding an Index on the ObjectClass attributeType. You might 
want to add more indexes, depending on the search Filter you are using.

Typically, you may want to index the SAMAccount attribute.


>
> Is it not enough?
> I have added a custom attribute to my partition which is sAMAccount.
>
> Do I need to do anything different?
>
> Any help would be appreciated.
>
> Thanks
> Krish
>
>
> On Tue, Feb 14, 2017 at 3:16 PM Cyril FILLON <cy...@yahoo.fr.invalid>
> wrote:
>
>>
>> Many thanks, this link has been really helpful for me.
>> Thanks again.
>>
>>
>>
>>
>> ----- Mail original -----
>> De : Krish <kr...@gmail.com>
>> À : users@directory.apache.org
>> Envoyé le : Jeudi 9 février 2017 17h20
>> Objet : Re: Embedded ApacheDS
>>
>>
>> https://github.com/krishdey/EmbeddedLdapKDC
>> Sorry forgot to paste the link
>> Sent from my iPhone
>>
>>
>>> On Feb 9, 2017, at 10:49 AM, Krish <kr...@gmail.com> wrote:
>>>
>>> Look into this project and see if it helps.
>>> I have created an embedded apache ds and also loaded custom partook and
>> Microsoft schema custom attributes to it.
>>> Thanks
>>> Krish
>>>
>>> Sent from my iPhone
>>>
>>>> On Feb 9, 2017, at 10:18 AM, Cyril FILLON <cy...@yahoo.fr.INVALID>
>> wrote:
>>>> Hi all,
>>>>
>>>>
>>>> I am trying to setup an embedded ApacheDS 2.0.0-M23 server from my java
>> code, snippet is given below.
>>>> I tried to create a new partition, but unfortunately it fails miserably
>> since I cannot see this partition from ApacheDS Studio.
>>>> Anyone could help me or give me a code snippet in order to be able to
>> start the ApacheDS server from Java code and create a partition?
>>>> I already gave a look to the documentation page
>> http://directory.apache.org/apacheds/basic-ug/1.4.3-adding-partition.html,
>> however the code snippet does not work as well.
>>>>
>>>> Many thanks in advance.
>>>>
>>>> public void start()
>>>> {
>>>>    ApacheDsService apacheDsService = new ApacheDsService();
>>>>
>>>>    apacheDsService.start(new InstanceLayout(this.ldapInstanceFolder));
>>>>    DirectoryService directoryService =
>> this.apacheDsService.getDirectoryService();
>>>>    directoryService.getChangeLog().setEnabled(true);
>>>>    directoryService.setAllowAnonymousAccess(true);
>>>>
>>>>    final SchemaManager schemaManager =
>> this.directoryService.getSchemaManager();
>>>>
>>>>    // Create the partition
>>>>    final Dn suffixDn = new Dn(schemaManager, "o=sevenSeas");    final
>> JdbmPartition partition = getJdbmPartition(this.directoryService,
>> "sevenSeas", suffixDn, contextEntry);
>>>>    partition.initialize();
>>>>
>>>>
>>>>    directoryService.addPartition(partition);
>>>> }
>>>>
>>>>
>>>> private JdbmPartition getJdbmPartition(final DirectoryService
>> directoryService, final String partitionId, final Dn suffixDN, final Entry
>> entry) throws ConfigurationException
>>>>   {
>>>>    final JdbmPartition jdbmPartition = new
>> JdbmPartition(directoryService.getSchemaManager(),
>> directoryService.getDnFactory());
>>>>    jdbmPartition.setId(partitionId);
>>>>    jdbmPartition.setCacheSize(1000);
>>>>    jdbmPartition.setOptimizerEnabled(true);
>>>>    File partitionPath = new
>> File(directoryService.getInstanceLayout().getPartitionsDirectory(),
>> partitionId);
>>>>    jdbmPartition.setPartitionPath(partitionPath.toURI());
>>>>
>>>>    try
>>>>    {
>>>>      jdbmPartition.setSuffixDn(suffixDN);
>>>>    }
>>>>    catch (final LdapInvalidDnException lide)
>>>>    {
>>>>      lide.printStackTrace();
>>>>      throw new ConfigurationException(lide.getMessage());
>>>>    }
>>>>
>>>>    jdbmPartition.setSyncOnWrite(true);
>>>>
>>>>       return jdbmPartition;
>>>> }
>>>>
>>>> Cyril

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@directory.apache.org
For additional commands, e-mail: users-help@directory.apache.org