King0770-Notes-Merge Two Independent Machines: Difference between revisions
No edit summary |
|||
Line 135: | Line 135: | ||
Run the following command from the ldap-replica, both machines should be displayed. If you can see both machines, the merge was successful. | Run the following command from the ldap-replica, both machines should be displayed. If you can see both machines, the merge was successful. | ||
<code><pre> | |||
zmprov gas | zmprov gas | ||
</pre></code> | |||
And run the following to see all the users from the ldap-replica | |||
<code><pre> | |||
zmprov gaa | |||
</pre></code> | |||
==Section VI - Undocumented / Potential Issues== | ==Section VI - Undocumented / Potential Issues== | ||
Will document any known issues as I am made aware. More to follow I am sure. | Will document any known issues as I am made aware. More to follow I am sure. |
Revision as of 14:08, 19 April 2009
Why merge two different Zimbra machines?
Possible reasons:
- Take advantage of the sharing capabilities, share calendar, mailbox, briefcase etc etc
- Consolidate two servers into one
- Need to transfer accounts ( See http://wiki.zimbra.com/index.php?title=CLI_zmmailboxmove_Network_Edition_only )
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.$$
Section III - Importing ldap info into ldap-master
After generating the ldif file on the replica, transfer it to the ldap-master machine. And run ldapadd to import the data into the ldap-master.
Example:
ldapadd -x -h `zmhostname` -D uid=zimbra,cn=admins,cn=zimbra -c -w `zmlocalconfig -s -m nokey zimbra_ldap_password` -f /tmp/temp.ldif"
Once the data is imported, restart ZCS services.
zmcontrol stop
zmcontrol start
Section IV - Configure the ldap-replica
At this point, we will need to configure the designated ldap-replica to be an actual ldap-replica.
For this step do the following:
ldap stop
cd /opt/zimbra/openldap-data
/opt/zimbra/sleepycat/bin/db_recover
rm alock *.bdb logs/*
cd /opt/zimbra/openldap-data/accesslog/db
/opt/zimbra/sleepycat/bin/db_recover
rm -rf /opt/zimbra/openldap-data/accesslog
ldap start
Change that server’s local config file to designate it as a replica. Type:
zmlocalconfig –e ldap_master_url="ldap://master_directory_address:389"
zmlocalconfig –e ldap_url="ldap://replica_directory_address:389 ldap://master_directory_address:389"
zmlocalconfig –e ldap_is_master=false
zmlocalconfig -e ldap_host=master_directory_address
/opt/zimbra/libexec/zmldapenablereplica
Or you can script it.
#!/bin/bash
echo "Enable Replication"
echo "What is the hostname of the ldap master?"
read MAST
zmlocalconfig -e ldap_is_master=false
zmlocalconfig -e ldap_master_url="ldap://$MAST:389"
zmlocalconfig -e ldap_url="ldap://`zmhostname`:389 ldap://$MAST:389"
zmlocalconfig -e ldap_host=$MAST
sleep 1
echo "Running zmldapenablereplica"
/opt/zimbra/libexec/zmldapenablereplica
After configuring the machine to be an ldap-replica, be sure to restart ZCS services
Section V - Test
After both machines have been rebooted, each machine should be able to see each other.
Run the following command from the ldap-replica, both machines should be displayed. If you can see both machines, the merge was successful.
zmprov gas
And run the following to see all the users from the ldap-replica
zmprov gaa
Section VI - Undocumented / Potential Issues
Will document any known issues as I am made aware. More to follow I am sure.