Fault Monitor will help to restart DB2 instance if DB2 instance goes down due to any reason except for instance been stopped due to db2stop command.
Fault monitor must be enabled only on standalone system and not on system where you have cluster services enables like TSA, HACMP, Pacemaker etc.
Note: Post DB2 fixpack upgrade, Instance upgrade or after applying Special build, you need to reconfigure DB2 Fault monitor, otherwise fault monitor will not work.
Steps to Enable Fault Monitor
1. Enable auto start of Instance
Run below command to enable auto start of db2 instance after server restart.
Before running above command, cross check db2 instance registry variables using below command
db2set -all
Once db2iauto -on <instanceid> gets executed in db2set -all we will see new registry variable DB2AUTOSTART with value as YES
2. Enable fault monitor co-ordinator
This step will create or replace db2fmcd.service file in path /etc/systemd/system/. Run below command as root or with sudo privilege. Before enabling fault monitor co-ordinator you can verify if db2fmcd.service
cd <DB2 Installation Directory>/bin/
./db2fmcu -u -p <DB2 Installation Directory>/bin/db2fmcd
There is no output of above command but it creates file /etc/systemd/system/db2fmcd.service
You can verify it by running below command
ls -lrt /etc/systemd/system/db2fmcd.service
Before enabling fault monitor co-ordinator you can verify if db2fmcd.service is present or not..if it is present then remove it using below command. Run command as root or with sudo privilege.
cd <DB2 Installation Directory>/bin/
./db2fmcu -d
Run below command as root or with sudo privilege to start fault monitor daemon.
cd <DB2 Installation Directory>/bin/
./db2fm -i <DB2 instance id> -U
4. Startup fault monitor services
Run below command as root or with sudo privilege to start fault monitor services.
cd <DB2 Installation Directory>/bin/
./db2fm -i <DB2 instance id> -u
This command might return below error if db2 instance is up and running.
./db2fm return non-zero rc, please see log file '<DB2 Instance db2diaglog path>/db2diag.log'
To fix this stop DB2 instance and rerun command.
5. Enable fault monitor for instance
Run below command as root or with sudo privilege to enable fault monitor for instance
cd <DB2 Installation Directory>/bin/
./db2fm -i <DB2 instance id> -f on
6. Verify fault monitor status
Run below command as db2 instance user to verify fault monitor status
db2fm -s -S
7. Test DB2 fault monitor
Fault monitor can automatically restart DB2 in case of server restart or instance failure. It will not restart db2 if instance was gracefully shutdown using db2stop.
Stop db2 using db2stop
In above screenshoot, we can see that even after 30 sec of db2 being stopped, db2 was not started.
Kill db2 process using db2_kill
In above screenshoot, we can see that even, db2 was automatically started by fault monitor.
8. Disable fault monitor
Run below command as root or with sudo privilege to disable fault monitor.
cd <DB2 Installation Directory>/bin/
./db2fmcu -d
If you liked this blog and interested in knowing more about DB2, please subscribe by clicking on Subscribe to ChoudharySumit.com by Email.
The blog is very helpful
ReplyDelete