King0770-Notes-Merge Two Independent Machines: Difference between revisions

No edit summary
No edit summary
Line 12: Line 12:
Run the following command on both machines.
Run the following command on both machines.


<code><div>zmlocalconfig -s | grep pass | grep ldap</div></code>
<code><pre>zmlocalconfig -s | grep pass | grep ldap</pre></code>


If the passwords do not match between the two machines, you will need to change the passwords so the passwords match between both machines. After changing the passwords, you will need to restart ZCS services. (See zmldappasswd)
If the passwords do not match between the two machines, you will need to change the passwords so the passwords match between both machines. After changing the passwords, you will need to restart ZCS services. (See zmldappasswd)
Line 23: Line 23:
Here's a small script to help facilitate this step. Basically, this will export all info the ldap-master will need to import.
Here's a small script to help facilitate this step. Basically, this will export all info the ldap-master will need to import.


<code><div>
<code><pre>
#!/bin/bash
#!/bin/bash


Line 54: Line 54:
rm -rf tmp.$$
rm -rf tmp.$$


</div></code>
</pre></code>

Revision as of 13:56, 19 April 2009


Why merge two different Zimbra machines?

Possible reasons:

Section I - LDAP Passwords

Run the following command on both machines.

zmlocalconfig -s | grep pass | grep ldap

If the passwords do not match between the two machines, you will need to change the passwords so the passwords match between both machines. After changing the passwords, you will need to restart ZCS services. (See zmldappasswd)


Section II - Exporting ldap info from the ldap-replica

This is actually pretty straight forward. Basically we're going to export the ldap info into a file. Normally we can use the zmslapcat tool to export, however, we will need to parse out some superfluous info that zmslapcat would include.

Here's a small script to help facilitate this step. Basically, this will export all info the ldap-master will need to import.

#!/bin/bash

if [ `whoami` != "zimbra" ]; then
        echo "You must be the zimbra user to run this script."
exit 0
fi

echo $PATH | grep /opt/zimbra/openldap/sbin >/dev/null
R=$?
if [ $R = 1 ]; then
PATH=$PATH:/opt/zimbra/openldap/sbin
export PATH
fi

cd /tmp

echo "Exporting machine LDAP info. Grabbing the value of zmhostname"
slapcat -f ~/conf/slapd.conf -s cn=`zmhostname`,cn=servers,cn=zimbra >> tmp.$$

echo "Exporting domain and user information"
for DOM in `zmprov gad | sed 's/\./ /g' | awk '{ print $NF }' | sort -u`; do slapcat -f ~/conf/slapd.conf -s dc=$DOM; done >> tmp.$$

echo "Exporting COS's"
for COS in `zmprov gac`; do slapcat -f ~/conf/slapd.conf -s cn=$COS,cn=cos,cn=zimbra; done  >> tmp.$$

echo "Creating file in /tmp."
grep -v -e "entryCSN" -e "modifiersName" -e "modifyTimestamp" -e "createTimestamp" -e "creatorsName" -e "entryUUID" -e "structuralObjectClass" tmp.$$ >> all.`zmhostname`_`date +%F`.ldif

rm -rf tmp.$$

Jump to: navigation, search