You must stop the ldap service in two primary and secondary LDAP Server.
1. run "db_checkpoint" to make sure all the data have been written inside the BDB database:
--> db_checkpoint-4.3 -1 -h /var/db/openldap-data/
Copy ldap database from primary server to second server :
----------------------------
scp IP:/var/lib/ldap/* /var/lib/ldap/ (doing on the secondary server)
or scp /var/lib/ldap/* root@IP:/var/lib/ldap/ (doing on the primary server)
chown -R ldap.ldap /var/lib/ldap
chmod 700 /var/lib/ldap
----------------------------
1. Setup a new LDAP Server that its settings are similiar with the primary LDAP Server.
2. Add the following lines to the configuration file(slapd.conf) in Primary LDAP Server:
------------------------------
Line1 : replogfile /var/lib/ldap/replica.log
Line2 : replica uri=ldap://Secondary LDAP Server's IP binddn="cn=Manager,dc=my,dc=domain,dc=name" bindmethod=simple credentials=password
------------------------------
3. Add the following lines to the configuratino file(slapd.conf) in Secondary LDAP Server:
------------------------------
Line1 : updatedn "cn=Manager,dc=my,dc=domain,dc=name"
Line2 : updaterefldap://Primary LDAP Server's IP
------------------------------
Wednesday, February 9, 2011
Tuesday, February 8, 2011
How to redirect a webpage
header("Location: http://IP or Server Domain name/redirect-to-this-web-page");
?>
?>
How to restore Boot Loader GRUB
OS - Centos
1. Using Centos Installer Disk
2. Select rescue mode by this command "linux rescue"
3. Run chroot /mnt/sysimage to change to original root environment
4. Run grub to enter GRUB environment
5. Run grub-install --recheck /dev/hd? (? can be a,b,c or 0,1,2, you can also use this command to find out yours)
6. Done.
1. Using Centos Installer Disk
2. Select rescue mode by this command "linux rescue"
3. Run chroot /mnt/sysimage to change to original root environment
4. Run grub to enter GRUB environment
5. Run grub-install --recheck /dev/hd? (? can be a,b,c or 0,1,2, you can also use this command to find out yours)
6. Done.
Wednesday, November 24, 2010
LDAP Skills
Skill 1
---------------------------------------------------------------------
What is "
Logs of current transactions need to be stored into files so that the database can be recovered in the event of an application crash. Administrator can change the size limit of a single log file (by default 10MB), and have old log files removed automatically, by setting up DB environment (see below). The reason Berkeley DB never deletes any log files by default is that the administrator may wish to backup the log files before removal to make database recovery possible even after a catastrophic failure, such as file system corruption.
The slapd_db_archive tool knows what log files are used in current transactions, and what are not. Administrators can move unused log files to a backup media, and delete them. To have them removed automatically, place
The files with names __db.001, __db.002, etc are just shared memory regions (or whatever). These ARE NOT `logs', they must be left alone. Don't be afraid of them, they do not grow like logs do.
The "alock" is an autorecovery mechanism introduced in the OpenLDAP 2.3 release to assist with autorecovery. Given more information on the error messages coming from alock would be useful, since it is supposed to help you recover from hard reboots gracefully.
For recovered the BDB database.
How can we clear all the redundant log file?
slapd_db_archive -a: Identify BDB logs which is not in use, and can be safely deleted
slapd_db_archive -l: List all the log files in BDB
slapd_db_archive -d: Remove all the unused logs files
-----------------------------------------------------------------
Skill 2
------------------
How to recover OpenLDAP database?
How to backup OpenLDAP database in form of LDIF to remote Server:
---------------------------------------------
1. Backup-Script(ldap.sh):
***************************
#! /bin/sh
cd /root
rm -f /var/ldap_backup.ldif
/usr/sbin/slapcat > /var/ldap_backup.ldif
mount -t cifs -o username=ldap,password=ldap123 //192.168.2.200/ldapbackup /var/backup
cp -rf /var/ldap_backup.ldif /var/backup/
umount /var/backup
***************************
2. How to run a sh script on linux OS:
# sh script file
---------------------------------------------
3. Add a cron job:
# crontab -l
# crontab -e
30 3 * * * sh /var/ldap.sh
----------------------------------------
Reference Site
1. http://www.zytrax.com/books/ldap/ch6/bdb.html
---------------------------------------------------------------------
What is "
log.XXXXXXXXXX" in the BDB backend directory?Logs of current transactions need to be stored into files so that the database can be recovered in the event of an application crash. Administrator can change the size limit of a single log file (by default 10MB), and have old log files removed automatically, by setting up DB environment (see below). The reason Berkeley DB never deletes any log files by default is that the administrator may wish to backup the log files before removal to make database recovery possible even after a catastrophic failure, such as file system corruption.
The slapd_db_archive tool knows what log files are used in current transactions, and what are not. Administrators can move unused log files to a backup media, and delete them. To have them removed automatically, place
set_flags DB_LOG_AUTOREMOVE directive in DB_CONFIG. Note that if the log files are removed automatically, recovery after a catastrophic failure is likely to be impossible.The files with names __db.001, __db.002, etc are just shared memory regions (or whatever). These ARE NOT `logs', they must be left alone. Don't be afraid of them, they do not grow like logs do.
The "alock" is an autorecovery mechanism introduced in the OpenLDAP 2.3 release to assist with autorecovery. Given more information on the error messages coming from alock would be useful, since it is supposed to help you recover from hard reboots gracefully.
For recovered the BDB database.
How can we clear all the redundant log file?
slapd_db_archive -a: Identify BDB logs which is not in use, and can be safely deleted
slapd_db_archive -l: List all the log files in BDB
slapd_db_archive -d: Remove all the unused logs files
-----------------------------------------------------------------
Skill 2
------------------
How to recover OpenLDAP database?
we can repair the OpenLDAP database by the following command:
/usr/sbin/slapd_db_recover -v -h /var/lib/ldap
after recovery, make sure to chown the files back to ldap:ldap or else it will still be busted.
------------------How to backup OpenLDAP database in form of LDIF to remote Server:
---------------------------------------------
1. Backup-Script(ldap.sh):
***************************
#! /bin/sh
cd /root
rm -f /var/ldap_backup.ldif
/usr/sbin/slapcat > /var/ldap_backup.ldif
mount -t cifs -o username=ldap,password=ldap123 //192.168.2.200/ldapbackup /var/backup
cp -rf /var/ldap_backup.ldif /var/backup/
umount /var/backup
***************************
2. How to run a sh script on linux OS:
# sh script file
---------------------------------------------
3. Add a cron job:
# crontab -l
# crontab -e
30 3 * * * sh /var/ldap.sh
----------------------------------------
Reference Site
1. http://www.zytrax.com/books/ldap/ch6/bdb.html
Tuesday, October 19, 2010
How to update samba from 3.0.33 to 3.3.8
How to update samba from 3.0.33 to 3.3.8
1. Backup all your samba related data and configuration files
2. Upgrade your server to Centos 5.4 or 5.5
3. Remove samba, samba-client, samba-common (yum remove package name)
4. Insert your Centos DVD and mount it to your server:
---------
a. mount -t iso9660 /dev/cdrom /media/cdrom/
b.
---------
5. Done.
1. Backup all your samba related data and configuration files
2. Upgrade your server to Centos 5.4 or 5.5
3. Remove samba, samba-client, samba-common (yum remove package name)
4. Insert your Centos DVD and mount it to your server:
---------
a. mount -t iso9660 /dev/cdrom /media/cdrom/
b.
vi /etc/yum.repos.d/CentOS-Media.repo , and Make sure enabled is set to 1: enabled=1
c. Save and close the file. To use repo put your DVD and along with the other repos, enter:# yum --enablerepo=c5-media install pacakge-name
d. To only use the DVDmedia repo, do this:# yum --disablerepo=\* --enablerepo=c5-media install samba3x---------
5. Done.
Thursday, August 19, 2010
OpenWebMail
OpenWebMail
How to create multiple global address book:
1. Go to /var/www/cgi-bin/openwebmail/etc/addressbooks/, and create an empty file in this directory. Then this file will automatically be a global address book.
For example, i create a new global address book (command):
1. touch newbook
2. chown mailadmin.email newbook (My own setting - chown mamil:mail newbook)
3. chmod 640 newbook (My own setting - chmod 660 newbook)
How to create multiple global address book:
1. Go to /var/www/cgi-bin/openwebmail/etc/addressbooks/, and create an empty file in this directory. Then this file will automatically be a global address book.
For example, i create a new global address book (command):
1. touch newbook
2. chown mailadmin.email newbook (My own setting - chown mamil:mail newbook)
3. chmod 640 newbook (My own setting - chmod 660 newbook)
Sunday, July 18, 2010
Subscribe to:
Posts (Atom)