Promoting Replica to LDAP Master: Difference between revisions
(37 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
{{BC|Certified}} | |||
__FORCETOC__ | |||
<div class="col-md-12 ibox-content"> | |||
=Promoting Replica to LDAP Master= | |||
{{KB|{{ZC}}|{{ZCS 7.0}}|{{ZCS 6.0}}|}} | |||
{{WIP}} | |||
Only one master LDAP server can exist and this LDAP server is authoritative for user information, server configuration, etc. The instructions that follow explain how to promote a replica LDAP server to master and disable the previous LDAP master. | Only one master LDAP server can exist and this LDAP server is authoritative for user information, server configuration, etc. The instructions that follow explain how to promote a replica LDAP server to master and disable the previous LDAP master. | ||
Line 4: | Line 11: | ||
Before you can promote a replica LDAP server to become the master LDAP server, your LDAP replication servers must be up and working correctly; that is the replica LDAP server(s) must be receiving LDAP updates from the master. See the Multi-Server Installation Guide, LDAP Replication Installation chapter. | Before you can promote a replica LDAP server to become the master LDAP server, your LDAP replication servers must be up and working correctly; that is the replica LDAP server(s) must be receiving LDAP updates from the master. See the Multi-Server Installation Guide, LDAP Replication Installation chapter. | ||
'''For ZCS 8.0, you must follow the instructions at [http://wiki.zimbra.com/wiki/Promoting_Replica_to_LDAP_Master_8.0 Promoting Replica to LDAP master on ZCS 8].''' | |||
'''To promote a replica server to be master''' | '''To promote a replica server to be master''' | ||
# Shut down all services on all ZCS servers by running '''zmcontrol stop'''. | |||
# On the replica LDAP server that '''will be the new''' master LDAP server, do the following as the zimbra user: | |||
:a. Start ldap: '''ldap start''' | |||
:b. Backup the cn=config db: '''/opt/zimbra/libexec/zmslapcat -c /tmp''' | |||
:c. Note the ldap root password, as it will be used extensively: '''zmlocalconfig -s ldap_root_password''' | |||
:d. Update the main ldap database to be a master: | |||
<code> | |||
ldapmodify -x -H ldapi:/// -D "cn=config" -w "ldap root password" | |||
dn: olcDatabase={2}hdb,cn=config | |||
changetype:modify | |||
delete: olcSyncrepl | |||
</code> | |||
ctrl-D executes this change and drops you to prompt. Remember to do this for all four ldapmodify commands your running. | |||
: | <code> | ||
ldapmodify -x -H ldapi:/// -D "cn=config" -w "ldap root password" | |||
dn: olcDatabase={2}hdb,cn=config | |||
changetype:modify | |||
delete: olcUpdateRef | |||
</code> | |||
: | <code> | ||
ldapmodify -x -H ldapi:/// -D "cn=config" -w "ldap root password" | |||
dn: olcOverlay={0}syncprov,olcDatabase={2}hdb,cn=config | |||
changetype:modify | |||
add: olcSpCheckpoint | |||
olcSpCheckpoint: 20 10 | |||
</code> | |||
<code> | |||
ldapmodify -x -H ldapi:/// -D "cn=config" -w "ldap root password" | |||
dn: olcOverlay={0}syncprov,olcDatabase={2}hdb,cn=config | |||
changetype:modify | |||
add: olcSpSessionLog | |||
olcSpSessionlog: 500 | |||
</code> | |||
: | :e. Prepare the accesslog database for the new master: | ||
<code> | |||
ldap stop | |||
cd /opt/zimbra/data/ldap | |||
mkdir -p accesslog/db | |||
mkdir -p accesslog/logs | |||
</code> | |||
:f. Copy in the relevant DB_CONFIG file. For a [[Managing_Customized_BDB_configurations#Accesslog_database_custom_DB_CONFIG_file|custom DB_CONFIG]]: | |||
<code> | |||
cp /opt/zimbra/conf/custom/ldap/DB_CONFIG.accesslog /opt/zimbra/data/ldap/accesslog/db/DB_CONFIG | |||
</code> | |||
:For the default DB_CONFIG: | |||
<code> | |||
cp /opt/zimbra/openldap/var/openldap-data/DB_CONFIG.accesslog /opt/zimbra/data/ldap/accesslog/db/DB_CONFIG | |||
</code> | |||
:Start ldap again: | |||
<code> | |||
ldap start | |||
</code> | |||
:g. Add the accesslog database: | |||
<code> | |||
ldapadd -x -H ldapi:/// -D "cn=config" -w "ldap root password" | |||
dn: olcDatabase={2}hdb,cn=config | |||
changetype: add | |||
objectClass: olcDatabaseConfig | |||
objectClass: olcHdbConfig | |||
olcDatabase: {2}hdb | |||
olcDbDirectory: /opt/zimbra/data/ldap/accesslog/db | |||
olcSuffix: cn=accesslog | |||
olcAccess: {0}to dn.subtree="cn=accesslog" by dn.exact="uid=zimbra,cn=admins,cn=zimbra" read by dn.exact="cn=config" read by dn.exact="uid=zmreplica,cn=admins,cn=zimbra" read | |||
olcLastMod: TRUE | |||
olcMaxDerefDepth: 15 | |||
olcReadOnly: FALSE | |||
olcRootDN: cn=config | |||
olcSizeLimit: unlimited | |||
olcTimeLimit: unlimited | |||
olcMonitoring: TRUE | |||
olcDbCacheSize: 10000 | |||
olcDbCheckpoint: 64 5 | |||
olcDbNoSync: FALSE | |||
olcDbDirtyRead: FALSE | |||
olcDbIDLcacheSize: 10000 | |||
olcDbIndex: entryCSN eq | |||
olcDbIndex: objectClass eq | |||
olcDbIndex: reqEnd eq | |||
olcDbIndex: reqResult eq | |||
olcDbIndex: reqStart eq | |||
olcDbLinearIndex: FALSE | |||
olcDbMode: 0600 | |||
olcDbSearchStack: 16 | |||
olcDbShmKey: 0 | |||
olcDbCacheFree: 1 | |||
olcDbDNcacheSize: 0 | |||
</code> | |||
<code> | |||
ldapadd -x -H ldapi:/// -D "cn=config" -w "ldap root password" | |||
dn: olcOverlay=syncprov,olcDatabase={2}hdb,cn=config | |||
changetype: add | |||
objectClass: olcOverlayConfig | |||
objectClass: olcSyncProvConfig | |||
olcOverlay: syncprov | |||
olcSpNoPresent: TRUE | |||
olcSpReloadHint: TRUE | |||
</code> | |||
: | <code> | ||
ldapadd -x -H ldapi:/// -D "cn=config" -w "ldap root password" | |||
dn: olcOverlay=accesslog,olcDatabase={3}hdb,cn=config | |||
changetype: add | |||
objectClass: olcOverlayConfig | |||
objectClass: olcAccessLogConfig | |||
olcOverlay: accesslog | |||
olcAccessLogDB: cn=accesslog | |||
olcAccessLogOps: writes | |||
olcAccessLogSuccess: TRUE | |||
olcAccessLogPurge: 01+00:00 00+04:00 | |||
</code> | |||
:h. Update the localconfig values for this server: | |||
*NOTE: <new_master_directory_address> should be in the format of 'ldap://ldaphost.domain.com:389' | |||
<code> | |||
zmlocalconfig -e ldap_master_url=<new_master_directory_address> | |||
zmlocalconfig -e ldap_url=<new_master_directory_address> | |||
zmlocalconfig -e ldap_is_master=true | |||
zmlocalconfig -e ldap_host=<newmaster_directory_host> | |||
</code> | |||
:i. On all other servers, update the localconfig values: | |||
<code> | |||
zmlocalconfig -e ldap_master_url=<new_master_directory_address> | |||
zmlocalconfig -e ldap_host=<newmaster_directory_host> | |||
</code> | |||
:j. On all the other servers, update '''zmlocalconfig -e ldap_url''' to remove the old master server. It should already include the new one. | |||
:k. On the replicas, run '''ldap start''' | |||
:l. Use the tool '''zmldapreplicatool''' to update the LDAP Master URI in the syncrepl configuration for each replica (ZCS 7.x only) | |||
:m. Update the passwords stored in localconfig for the amavis, postfix, and nginx users to match the values stored in localconfig on the old master. This will ensure that if you run a ZCS upgrade on the new master, the passwords are preserved correctly. | |||
3. Now you run '''zmmtainit''' to edit the '''ldap*.cf''' files in '''/opt/zimbra/conf''' to set the new master LDAP server as the authority for the MTA.These files tell Postfix how to connect to the LDAP server for various commands. If you are moving the directories, you might have Postfix pointing to a server that no longer runs LDAP, which will cause mail delivery to stop. | 3. Now you run '''zmmtainit''' on the MTA servers to edit the '''ldap*.cf''' files in '''/opt/zimbra/conf''' to set the new master LDAP server as the authority for the MTA. These files tell Postfix how to connect to the LDAP server for various commands. If you are moving the directories, you might have Postfix pointing to a server that no longer runs LDAP, which will cause mail delivery to stop. | ||
Note: '''zmmtainit''' should be run on the hosts that are running an MTA, but is not required on the other hosts. | Note: '''zmmtainit''' should be run on the hosts that are running an MTA, but is not required on the other hosts. | ||
As zimbra, type the following. The "XX" is a dummy value. The zmmtainit command will use the ldap_url value from localconfig in spite of this. | |||
<code> | |||
/opt/zimbra/libexec/zmmtainit XX | |||
/opt/zimbra/libexec/zmmtainit XX | </code> | ||
4. Start the new LDAP master, type '''zmcontrol start'''. Then start up the services on all the other servers. At this point, services should be up and running on all hosts, and they should all be working off the new Master LDAP server. | 4. Start the new LDAP master, type '''zmcontrol start'''. Then start up the services on all the other servers. At this point, services should be up and running on all hosts, and they should all be working off the new Master LDAP server. | ||
Note: After the replica is promoted to Master, you should verify that the backup schedule is correctly set. Run '''zmschedulebackup -q'''. The schedule should match the backup schedule on the Mail Stores. If the backup schedule does not, run the zmschedulebackup command to set the backup schedule. | |||
==Shut down the previous master== | |||
The old LDAP master must be disabled. | |||
= Related Articles = | |||
[[LDAP|LDAP]] | |||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
{{Article Footer|Zimbra Collaboration Suite | {{Article Footer|Zimbra Collaboration Suite 6.0.2|10/1/2009}} | ||
[[Category: | [[Category:Certified]] | ||
[[Category: Installation]] | |||
[[Category: LDAP]] | |||
[[Category: ZCS 7.0]] | |||
[[Category: ZCS 6.0]] |
Latest revision as of 00:16, 30 April 2016
Promoting Replica to LDAP Master
Only one master LDAP server can exist and this LDAP server is authoritative for user information, server configuration, etc. The instructions that follow explain how to promote a replica LDAP server to master and disable the previous LDAP master.
Promoting a Replica Server – Demoting the Master Server
Before you can promote a replica LDAP server to become the master LDAP server, your LDAP replication servers must be up and working correctly; that is the replica LDAP server(s) must be receiving LDAP updates from the master. See the Multi-Server Installation Guide, LDAP Replication Installation chapter.
For ZCS 8.0, you must follow the instructions at Promoting Replica to LDAP master on ZCS 8.
To promote a replica server to be master
- Shut down all services on all ZCS servers by running zmcontrol stop.
- On the replica LDAP server that will be the new master LDAP server, do the following as the zimbra user:
- a. Start ldap: ldap start
- b. Backup the cn=config db: /opt/zimbra/libexec/zmslapcat -c /tmp
- c. Note the ldap root password, as it will be used extensively: zmlocalconfig -s ldap_root_password
- d. Update the main ldap database to be a master:
ldapmodify -x -H ldapi:/// -D "cn=config" -w "ldap root password"
dn: olcDatabase={2}hdb,cn=config
changetype:modify
delete: olcSyncrepl
ctrl-D executes this change and drops you to prompt. Remember to do this for all four ldapmodify commands your running.
ldapmodify -x -H ldapi:/// -D "cn=config" -w "ldap root password"
dn: olcDatabase={2}hdb,cn=config
changetype:modify
delete: olcUpdateRef
ldapmodify -x -H ldapi:/// -D "cn=config" -w "ldap root password"
dn: olcOverlay={0}syncprov,olcDatabase={2}hdb,cn=config
changetype:modify
add: olcSpCheckpoint
olcSpCheckpoint: 20 10
ldapmodify -x -H ldapi:/// -D "cn=config" -w "ldap root password"
dn: olcOverlay={0}syncprov,olcDatabase={2}hdb,cn=config
changetype:modify
add: olcSpSessionLog
olcSpSessionlog: 500
- e. Prepare the accesslog database for the new master:
ldap stop
cd /opt/zimbra/data/ldap
mkdir -p accesslog/db
mkdir -p accesslog/logs
- f. Copy in the relevant DB_CONFIG file. For a custom DB_CONFIG:
cp /opt/zimbra/conf/custom/ldap/DB_CONFIG.accesslog /opt/zimbra/data/ldap/accesslog/db/DB_CONFIG
- For the default DB_CONFIG:
cp /opt/zimbra/openldap/var/openldap-data/DB_CONFIG.accesslog /opt/zimbra/data/ldap/accesslog/db/DB_CONFIG
- Start ldap again:
ldap start
- g. Add the accesslog database:
ldapadd -x -H ldapi:/// -D "cn=config" -w "ldap root password"
dn: olcDatabase={2}hdb,cn=config
changetype: add
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {2}hdb
olcDbDirectory: /opt/zimbra/data/ldap/accesslog/db
olcSuffix: cn=accesslog
olcAccess: {0}to dn.subtree="cn=accesslog" by dn.exact="uid=zimbra,cn=admins,cn=zimbra" read by dn.exact="cn=config" read by dn.exact="uid=zmreplica,cn=admins,cn=zimbra" read
olcLastMod: TRUE
olcMaxDerefDepth: 15
olcReadOnly: FALSE
olcRootDN: cn=config
olcSizeLimit: unlimited
olcTimeLimit: unlimited
olcMonitoring: TRUE
olcDbCacheSize: 10000
olcDbCheckpoint: 64 5
olcDbNoSync: FALSE
olcDbDirtyRead: FALSE
olcDbIDLcacheSize: 10000
olcDbIndex: entryCSN eq
olcDbIndex: objectClass eq
olcDbIndex: reqEnd eq
olcDbIndex: reqResult eq
olcDbIndex: reqStart eq
olcDbLinearIndex: FALSE
olcDbMode: 0600
olcDbSearchStack: 16
olcDbShmKey: 0
olcDbCacheFree: 1
olcDbDNcacheSize: 0
ldapadd -x -H ldapi:/// -D "cn=config" -w "ldap root password"
dn: olcOverlay=syncprov,olcDatabase={2}hdb,cn=config
changetype: add
objectClass: olcOverlayConfig
objectClass: olcSyncProvConfig
olcOverlay: syncprov
olcSpNoPresent: TRUE
olcSpReloadHint: TRUE
ldapadd -x -H ldapi:/// -D "cn=config" -w "ldap root password"
dn: olcOverlay=accesslog,olcDatabase={3}hdb,cn=config
changetype: add
objectClass: olcOverlayConfig
objectClass: olcAccessLogConfig
olcOverlay: accesslog
olcAccessLogDB: cn=accesslog
olcAccessLogOps: writes
olcAccessLogSuccess: TRUE
olcAccessLogPurge: 01+00:00 00+04:00
- h. Update the localconfig values for this server:
- NOTE: <new_master_directory_address> should be in the format of 'ldap://ldaphost.domain.com:389'
zmlocalconfig -e ldap_master_url=<new_master_directory_address>
zmlocalconfig -e ldap_url=<new_master_directory_address>
zmlocalconfig -e ldap_is_master=true
zmlocalconfig -e ldap_host=<newmaster_directory_host>
- i. On all other servers, update the localconfig values:
zmlocalconfig -e ldap_master_url=<new_master_directory_address>
zmlocalconfig -e ldap_host=<newmaster_directory_host>
- j. On all the other servers, update zmlocalconfig -e ldap_url to remove the old master server. It should already include the new one.
- k. On the replicas, run ldap start
- l. Use the tool zmldapreplicatool to update the LDAP Master URI in the syncrepl configuration for each replica (ZCS 7.x only)
- m. Update the passwords stored in localconfig for the amavis, postfix, and nginx users to match the values stored in localconfig on the old master. This will ensure that if you run a ZCS upgrade on the new master, the passwords are preserved correctly.
3. Now you run zmmtainit on the MTA servers to edit the ldap*.cf files in /opt/zimbra/conf to set the new master LDAP server as the authority for the MTA. These files tell Postfix how to connect to the LDAP server for various commands. If you are moving the directories, you might have Postfix pointing to a server that no longer runs LDAP, which will cause mail delivery to stop.
Note: zmmtainit should be run on the hosts that are running an MTA, but is not required on the other hosts.
As zimbra, type the following. The "XX" is a dummy value. The zmmtainit command will use the ldap_url value from localconfig in spite of this.
/opt/zimbra/libexec/zmmtainit XX
4. Start the new LDAP master, type zmcontrol start. Then start up the services on all the other servers. At this point, services should be up and running on all hosts, and they should all be working off the new Master LDAP server.
Note: After the replica is promoted to Master, you should verify that the backup schedule is correctly set. Run zmschedulebackup -q. The schedule should match the backup schedule on the Mail Stores. If the backup schedule does not, run the zmschedulebackup command to set the backup schedule.
Shut down the previous master
The old LDAP master must be disabled.
Related Articles