Difference between revisions of "Shared memory for Ldap 5.x"

(Created page with "To setup SHM keys : 1. Calculate and set kernel.shmall and kernel.shmmax (you already have detailed steps for this from the wiki) 2. ldap stop 3. /opt/zimbra/sleepycat/bin/db_r...")
 
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
{{Archive}}This is for ZCS 5.0.x only, and will not survive upgrades. Our recommendation is to upgrade to ZCS 6.0.x and above and use the LC key to use SHM keys. However if upgrading is not an option at this point and the need to use SHM keys is urgent then follow the below step.
 +
 +
Pre requisites : Setup kernel paramaters to use the defined space  from memory for shared keys
 +
 +
[http://wiki.zimbra.com/wiki/OpenLDAP_Performance_Tuning#Berkeley_DB_and_Shared_memory_keys Setting up Shared keys ]
 +
 
To setup SHM keys :
 
To setup SHM keys :
  
1. Calculate and set kernel.shmall and kernel.shmmax (you already have detailed steps for this from the wiki)
+
1. Calculate and set kernel.shmall and kernel.shmmax  
 +
 
 
2. ldap stop
 
2. ldap stop
3. /opt/zimbra/sleepycat/bin/db_recover -c -h /opt/zimbra/openldap-data/
+
 
 +
3. Remove existing cache files
 +
  /opt/zimbra/sleepycat/bin/db_recover -c -h /opt/zimbra/openldap-data/
 
   This is being done to clear current MMAP files, so that if and when you roll back you have a clean slate.
 
   This is being done to clear current MMAP files, so that if and when you roll back you have a clean slate.
 +
 
3.5 Confirm whether "/opt/zimbra/openldap-data" and  __db.* is deleted.
 
3.5 Confirm whether "/opt/zimbra/openldap-data" and  __db.* is deleted.
 +
 
4. Set the shared memory keys in /opt/zimbra/conf/slapd.conf.in
 
4. Set the shared memory keys in /opt/zimbra/conf/slapd.conf.in
#shmkey
+
  #shmkey
shm_key 5
+
  shm_key 5.
 +
 
 
5. Start ldap.
 
5. Start ldap.
 +
 
6. Verify if memory keys are being used:
 
6. Verify if memory keys are being used:
ipcs -mp  (the column CPID is the process ID which is using the shared memory referenced by the key which was set up in step 6)
+
  ipcs -mp  (the column CPID is the process ID which is using the shared memory referenced by the key which was set up in step 6)
 +
 
  
Only change in the above from before, is the addition of db_recover before setting the shm keys. This is to ensure we delete the cache files before changing the config.
+
To Roll back to MMAP :
  
 +
1. ldap stop.
  
To Roll back to MMAP :
+
2. Remove the cache files
 +
  /opt/zimbra/sleepycat/bin/db_recover -c -h /opt/zimbra/openldap-data/  (this should delete the bdb cache files)
  
1. ldap stop
 
2. /opt/zimbra/sleepycat/bin/db_recover -c -h
 
/opt/zimbra/openldap-data/  (this should delete the bdb cache files)
 
 
3. ipcrm [ -M key or -m id ] (to delete files from memory, at this point rebooting should also clear the memory files)******
 
3. ipcrm [ -M key or -m id ] (to delete files from memory, at this point rebooting should also clear the memory files)******
      Skip this if the file has already been removed, but please confirm using ipcs -m or ipcs -mp to check if the memory keys have been removed. If not then user ipcrm to manually delete the shm keys
+
  Skip this if the file has already been removed, but please confirm using ipcs -m or ipcs -mp to check if the memory keys have been removed. If not then user ipcrm to manually delete the shm keys.
4. update config to comment/remove shm keys configuration
+
 
5. start ldap (this should now be using the MMAP files)
+
4. update config to comment/remove shm keys configuration.
 +
 
 +
5. start ldap (this should now be using the MMAP files).

Latest revision as of 12:44, 30 March 2015

This is for ZCS 5.0.x only, and will not survive upgrades. Our recommendation is to upgrade to ZCS 6.0.x and above and use the LC key to use SHM keys. However if upgrading is not an option at this point and the need to use SHM keys is urgent then follow the below step.

Pre requisites : Setup kernel paramaters to use the defined space from memory for shared keys

Setting up Shared keys 

To setup SHM keys :

1. Calculate and set kernel.shmall and kernel.shmmax

2. ldap stop

3. Remove existing cache files

  /opt/zimbra/sleepycat/bin/db_recover -c -h /opt/zimbra/openldap-data/
  This is being done to clear current MMAP files, so that if and when you roll back you have a clean slate.

3.5 Confirm whether "/opt/zimbra/openldap-data" and __db.* is deleted.

4. Set the shared memory keys in /opt/zimbra/conf/slapd.conf.in

  #shmkey
  shm_key 5.

5. Start ldap.

6. Verify if memory keys are being used:

  ipcs -mp  (the column CPID is the process ID which is using the shared memory referenced by the key which was set up in step 6)


To Roll back to MMAP :

1. ldap stop.

2. Remove the cache files

  /opt/zimbra/sleepycat/bin/db_recover -c -h /opt/zimbra/openldap-data/  (this should delete the bdb cache files)

3. ipcrm [ -M key or -m id ] (to delete files from memory, at this point rebooting should also clear the memory files)******

  Skip this if the file has already been removed, but please confirm using ipcs -m or ipcs -mp to check if the memory keys have been removed. If not then user ipcrm to manually delete the shm keys.

4. update config to comment/remove shm keys configuration.

5. start ldap (this should now be using the MMAP files).

Jump to: navigation, search