ghiureai wrote:
*
Hi Rich,
here is the RHES doc :
Forcing Replication Updates from the Command Line*
From the consumer that requires updating, run a script that prompts the
supplier to send replication updates immediately. This script is shown
in _Example 11.5, “replicate_now Script Example”_
<Managing_Replication-Forcing_Replication_Updates.html>.
Copy this example script and name it something like replicate_now.sh.
Substitute the actual values for the variables listed in _Example 11.5,
“replicate_now Script Example”_
<Managing_Replication-Forcing_Replication_Updates.html>.
*NOTE*
This script must be run manually since it cannot be configured to run
automatically as soon as the server, which was offline, comes back
online again.
*Example 11.5. replicate_now Script Example*
#!/bin/sh
SUP_HOST=supplier_hostname
SUP_PORT=supplier_portnumber
SUP_MGRDN=supplier_directoryManager
SUP_MGRPW=supplier_directoryManager_password
MY_HOST=consumer_hostname
MY_PORT=consumer_portnumber
ldapsearch -x -1 -T -h ${SUP_HOST} -p ${SUP_PORT} -D "${SUP_MGRDN}" \
-w ${SUP_MGRPW} -b "cn=mapping tree,cn=config"
\"(&(objectclass=nsds5replicationagreement)(nsDS5ReplicaHost=${MY_HOST})
\(nsDS5ReplicaPort=${MY_PORT}))" dn nsds5ReplicaUpdateSchedule >
/tmp/$$
cat /tmp/$$ |awk 'BEGIN { s = 0 }/^dn: / { print $0;print "changetype:
modify";print
"replace: nsds5ReplicaUpdateSchedule";print
"nsds5ReplicaUpdateSchedule: 0000-2359
0123456";print "-";print "";print $0;print
"changetype: modify";
print "replace:nsds5ReplicaUpdateSchedule";}
/^nsds5ReplicaUpdateSchedule: / { s = 1; print $0; }/^$/{if ( $s == 1 ){
print "-" ;
print ""; }else{ print "nsds5ReplicaUpdateSchedule: 0000-2359
0123456";print "-" ;
print ""; };s = 0; }
' > /tmp/ldif.$$echo "Ldif is in /tmp/ldif.$$"echo
ldapmodify -x -c -h ${SUP_HOST} -p ${SUP_PORT} -D "${SUP_MGRDN}" \-w
${SUP_MGRPW}
-f /tmp/ldif.$$
AIUI the basic idea of forcing replication like this is to modify the
replication schedule, then setting it back to the original value (or
deleting the one that was added).
I'm not entirely sure this script would work in all cases. I think this
script will fail if there was no initial agreement schedule.
The basic idea, as I can grok it, is the first ldapsearch gets the
current state of the agreements.
The awk part loops through the search results and creates an ldif that
sets the agreement time for 0000-2359 0123456 then sets it back
Then the last ldapmodify applies the changes that awk calculated.
I tweaked the ldif that this created since my agreements don't have a
nsds5ReplicaUpdateSchedule by default. This works for me:
dn:
cn=meTosif.example.com,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping
tree,cn=config
changetype: modify
replace: nsds5ReplicaUpdateSchedule
nsds5ReplicaUpdateSchedule: 0000-2359 0123456
-
dn:
cn=meTosif.exaample.com,cn=replica,cn=dc\3Dexample\2Cdc\3Dcom,cn=mapping
tree,cn=config
changetype: modify
delete:nsds5ReplicaUpdateSchedule
nsds5ReplicaUpdateSchedule: 0000-2359 0123456
-
After applying this I checked the full agreement and I see this which
makes me believe it actually did something:
nsds5replicaLastUpdateStart: 20141113153408Z
nsds5replicaLastUpdateEnd: 20141113153409Z
I did this in the context of a freeIPA install.
rob