Saturday Jun 13, 2009

Using an integer range field validator annotation (Struts2)

XWork provides several mechanisms for validating form fields as part of its validation framework. One of these is through the use of annotations, and provides internationalization lookup, minimums and maximums, and automatic display of messages when validation fails.[Read More]

Wednesday Apr 08, 2009

RollingFileAppender file location

This entry describes how to use relative paths in GlassFish and Tomcat using a log4j FileAppender.[Read More]

Friday Jan 25, 2008

NeoOffice 2.2 patch 8

NeoOffice 2.2 patch 8 is available from the NeoOffice patch downloads page. This patch fixes some line spacing problems.

Friday Oct 19, 2007

OpenDS Synchronization

Setting up replication between OpenDS servers is easy. The following example uses the following parameters:
  • directory server & replication server on 10.0.2.1 (replication server port 2389)
  • directory server on 10.0.2.2
  • backend named "userRoot" to be replicated: dc=terrygardner,dc=com
First, read the documentation at the Wiki in order to understand the architecture. Download OpenDS from here. Set up a server on 10.0.2.1 and a server on 10.0.2.2. Setup 10.0.2.1 to be a replication server. On 10.0.2.1, copy the opendsroot/config/replication.ldif file to /tmp/tg-repl.ldif and edit it to look like:

---- snip ----

dn: cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config
objectClass: top
objectClass: ds-cfg-synchronization-provider
objectClass: ds-cfg-multimaster-synchronization-provider
cn: Multimaster Synchronization
ds-cfg-synchronization-provider-enabled: true
ds-cfg-synchronization-provider-class: org.opends.server.replication.plugin.MultimasterReplication

dn: cn=domains,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config
objectClass: top
objectClass: ds-cfg-branch
cn: domains

dn: cn=terrygardner,cn=domains,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config
objectClass: top
objectClass: ds-cfg-replication-domain-config
cn: terrygardner
ds-cfg-replication-dn: dc=terrygardner,dc=com
ds-cfg-replication-server: 10.0.2.1:2389
ds-cfg-replication-server: 10.0.2.2:2389
ds-cfg-directory-server-id: 2
ds-cfg-receive-status: true

dn: cn=Replication Server,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config
objectClass: top
objectClass: ds-cfg-replication-server-config
cn: Replication Server
ds-cfg-replication-server-port: 2389
ds-cfg-replication-server: 10.0.2.1:2389
ds-cfg-replication-server-id: 2
---- snip ----

On 10.0.2.2, copy the opendsroot/config/replication.ldif file to /tmp/tg-repl.ldif and edit it to look like:

---- snip ----

dn: cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config
objectClass: top
objectClass: ds-cfg-synchronization-provider
objectClass: ds-cfg-multimaster-synchronization-provider
cn: Multimaster Synchronization
ds-cfg-synchronization-provider-enabled: true
ds-cfg-synchronization-provider-class: org.opends.server.replication.plugin.MultimasterReplication

dn: cn=domains,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config
objectClass: top
objectClass: ds-cfg-branch
cn: domains

dn: cn=terrygardner,cn=domains,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config
objectClass: top
objectClass: ds-cfg-replication-domain-config
cn: terrygardner
ds-cfg-replication-dn: dc=terrygardner,dc=com
ds-cfg-replication-server: 10.0.2.2:2389
ds-cfg-replication-server: 10.0.2.1:2389
ds-cfg-directory-server-id: 1
ds-cfg-receive-status: true

dn: cn=Replication Server,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config
objectClass: top
objectClass: ds-cfg-replication-server-config
cn: Replication Server
ds-cfg-replication-server-port: 2389
ds-cfg-replication-server: 10.0.2.1:2389
ds-cfg-replication-server-id: 1
---- snip ----

Note the ds-cfg-replication-server-id attribute.

On 10.0.2.1 and 10.0.2.2, append the /tmp/tg-repl.ldif file onto opendsroot/config/config.ldif, thus:

$ copy opendsroot/config/config.ldif ~/opends-config-orig.ldif && cat /tmp/tg-repl.ldif  >> opendsroot/config/config.ldif
Make an LDIF using opendsroot/bin/make-ldif, and import into 10.0.2.1 and 10.0.2.2 using opends/bin/import/ldif. I created an LDIF with 10 users with this template file:

---- snip ----

define suffix=dc=terrygardner,dc=com
define maildomain=terrygardner.com
define numusers=10

branch: [suffix]

branch: ou=People,[suffix]
subordinateTemplate: person:[numusers]

template: person
rdnAttr: uid
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
givenName: <first>
sn: <last>
cn: {givenName} {sn}
initials: {givenName:1}<random:chars:ABCDEFGHIJKLMNOPQRSTUVWXYZ:1>{sn:1}
employeeNumber: <sequential:0>
uid: user.{employeeNumber}
mail: {uid}@[maildomain]
userPassword: password
telephoneNumber: <random:telephone>
homePhone: <random:telephone>
pager: <random:telephone>
mobile: <random:telephone>
street: <random:numeric:5> <file:streets> Street
l: <file:cities>
st: <file:states>
postalCode: <random:numeric:5>
postalAddress: {cn}${street}${l}, {st}  {postalCode}
description: This is the description for {cn}.
---- snip ----

To create the LDIF file:

$ opendsroot/bin/make-ldif -t /tmp/tg.template -o /tmp/tg.ldif
Import the LDIF:
$ opendsroot/bin/import-ldif -l /tmp/tg.ldif -o userRoot
Start both servers using opendsroot/bin/start-ds. Note: be aware of the values of your JAVA_HOME and JAVA_ARGS environment variables :) Test by modifying something. I usually change the description in the ou=people entry to reflect the replication test date:

---- snip ----

dn: ou=people,dc=terrygardner,dc=com
changetype: modify
replace: description
description: replication test 20-JUN-2007 0916
---- snip ----

The changes will be reflected in the database for 10.0.2.1 and 10.0.2.2. Really simple.

[posted with ecto]
About

Sun, LDAP, SLAMD, DSLA, java, Struts, networking, chess, books, cooking, wine, and many other things.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today