Monday, June 26, 2017



DSE Cassandra Node Failed To Start Post OS Upgrade 


One of our Cassandra production cluster node refused to start after OS Patching was done with following errorr.

ERROR [main] 2017-06-25 18:09:40,906  CassandraDaemon.java:709 - Exception encountered during startup
org.apache.cassandra.io.FSReadError: java.io.EOFException
        at org.apache.cassandra.hints.HintsDescriptor.readFromFile(HintsDescriptor.java:142) ~[cassandra-all-3.0.8.1293.jar:3.0.8.1293]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_66]
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[na:1.8.0_66]
        at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[na:1.8.0_66]
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[na:1.8.0_66]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[na:1.8.0_66]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_66]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_66]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_66]
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_66]
        at org.apache.cassandra.hints.HintsCatalog.load(HintsCatalog.java:65) ~[cassandra-all-3.0.8.1293.jar:3.0.8.1293]
        at org.apache.cassandra.hints.HintsService.<init>(HintsService.java:88) ~[cassandra-all-3.0.8.1293.jar:3.0.8.1293]
        at org.apache.cassandra.hints.HintsService.<clinit>(HintsService.java:63) ~[cassandra-all-3.0.8.1293.jar:3.0.8.1293]
        at org.apache.cassandra.service.StorageProxy.<clinit>(StorageProxy.jav


Upon looking around, we found that there is a reported major bug with this error under this JIRA as following.

CassandraCASSANDRA-12728 Handling partially written hint files

Cause – 
Corruption to the hints tables causing Cassandra to go in failure loop. This could have happen due to following. 

1. Node was rebooted before service was shutdown properly. 
2. service went down abruptly while writing Hints table. 
3. Node rebooted due to power failure. 

Since the cause of the issue was corrupted Hints table, we need to cleanup the hints for the node and then try to restart. 

After that node started fine. Also, since the node was down, it is imperative to run the repair on the node to make sure the data is consistent. 

Hope that helps. 

Thursday, April 6, 2017

Golden Gate 12.2 Monitoring JAGENT 

Not Starting Post Upgrade


After an upgrade from 12.1 to 12.2 JAGENT, the monitoring agent is not starting up. 


Error - 
[2017-04-05T09:50:33.133-07:00] [JAGENT] [ERROR] [OGGMON-20497] [com.goldengate.monitor.jagent.comm.ws.NotificationsCollector] [tid: StatusCollector] [ecid: 0000Lfr0uKD5mZSpyCd9iW1Oof4E000003,0] Failed to get Status Information. RESTful Web Service might not be available.
[2017-04-05T09:50:38.134-07:00] [JAGENT] [ERROR] [OGGMON-20494] [com.goldengate.monitor.jagent.comm.ws.NotificationsCollector] [tid: StatusCollector] [ecid: 0000Lfr0uKD5mZSpyCd9iW1Oof4E000003,0] Error occurred while registering the OGG process. Exception: [[
 source parameter must not be null
]]

OR 

Exception in thread "StatusCollector" java.lang.NullPointerException
        at com.goldengate.monitor.jagent.comm.ws.NotificationsCollector.checkAndDeleteProcess(NotificationsCollector.java:140)
        at com.goldengate.monitor.jagent.comm.ws.NotificationsCollector.checkAndPublishRegisteredAndDeletedProcess(NotificationsCollector.java:128)


SOLUTION

Login to ggsci prompt and run following 

[ggsadmin@12.2.0]$agctl stop   goldengate xxxx

[ggsadmin@12.2.0]$./ggsci

GGSCI () 1> delete datastore
Are you sure you want to delete the datastore? y
2017-04-06T18:23:20Z  INFO    OGG-06492  Datastore deleted

GGSCI () 2> create datastore
Profile 'Trace' added.
2017-04-06T18:23:27Z  INFO    OGG-06489  Datastore created
GGSCI () 3> exit

[ggsadmin@12.2.0]$agctl start   goldengate xxxxx

Even after this if the agent doesnt start, please check the prm file for the agent. 

[ggsadmin@ bin]$cat /ggsadmin/app/cqxad02p/ggate/12.2.0/dirprm/jagent.prm

COMMAND java -Dconfig.dir=/ggsadmin/app/cqxad02p/ggate/12.2.0/cfg -Djava.util.logging.config.class=oracle.core.ojdl.logging.LoggingConfiguration -Doracle.core.ojdl.logging.config.file=/ggsadmin/app/cqxad02p/ggate/12.2.0/cfg/logging-config.xml -Doracle.core.ojdl.logging.componentId=JAGENT -jar -Xms512m -Xmx1024m /ggsadmin/app/cqxad02p/jagent12.2/oggmon/ogg_agent/dirjar/jagent.jar

[ggsadmin@cfg]$ll /ggsadmin/app/cqxad02p/jagent12.2/oggmon/ogg_agent/dirjar/jagent.jar

-rw-r----- 1 ggsadmin oinstall 363165 Oct 12  2015 /ggsadmin/app/cqxad02p/jagent12.2/oggmon/ogg_agent/dirjar/jagent.jar

the JAGENT.jar file has no executable permissions and hence it was not starting up

[ggsadmin@cfg]$chmod  755 /ggsadmin/app/cqxad02p/jagent12.2/oggmon/ogg_agent/dirjar/jagent.jar


[ggsadmin@cfg]$ll /ggsadmin/app/cqxad02p/jagent12.2/oggmon/ogg_agent/dirjar/jagent.jar
-rwxr-xr-x 1 ggsadmin oinstall 363165 Oct 12  2015 /ggsadmin/app/cqxad02p/jagent12.2/oggmon/ogg_agent/dirjar/jagent.jar

After this change, the JAGENT started fine. 


Thursday, February 16, 2017

PSU bundle patch 5 Database Patch Set Update : 12.1.0.2.x : Installed in the CDB but not in the PDB 

OR 

validate_con_names: PDB$SEED is not open


The issue happens to one of our Oracle Database Appliance where after patching one the PDB fails to start. 

Upon checking the issue we came across following. The reason that caused the issue was when patch was applied the PDB was not open in read/write mode, hence datapatch component was not applied on that PDB 

SQL> select * from PDB_PLUG_IN_VIOLATIONS;

26-JUL-16 02.15.57.395533 PM                                                PQGECAH02                                                    SQL Patch                                                         ERROR                0          1
PSU bundle patch 5 (Database Patch Set Update : 12.1.0.2.5 (21359755)): Installed in the PDB but not in the CDB.
PENDING
Call datapatch to install in the PDB or the CDB

Then we tried following queries to open the PDB in read write mode. 

SQL> alter session set container = xxxxxx;

alter system disable restricted session;
select con_id,name,open_mode from gv$pdbs;
select con_id,logins,status from gv$instance;


SYS@xxxxx>select con_id,name,open_mode from gv$pdbs;

    CON_ID NAME                           OPEN_MODE
---------- ------------------------------ ----------
         2 PDB$SEED                       READ ONLY
         3 xxxxx                               READ WRITE
         2 PDB$SEED                       READ ONLY
         3 xxxxx                               MOUNTED


SYS@xxxxx>SELECT restricted FROM gv$containers WHERE con_id = 3;

RES
---
YES

SYS@CQXAC06P1>alter session set container = xxxxxx;
Session altered.

SYS@xxxxx>shutdown
Pluggable Database closed.

SYS@xxxxx>startup
Warning: PDB altered with errors.
Pluggable Database opened.

SYS@xxxxx>select con_id, name , open_mode , restricted FROM gv$containers ;

    CON_ID NAME                           OPEN_MODE  RES
---------- ------------------------------ ---------- ---
         1 CDB$ROOT                       READ WRITE NO
         2 PDB$SEED                       READ ONLY  NO
         3 xxxxx                               READ WRITE YES
         1 CDB$ROOT                       READ WRITE NO
         2 PDB$SEED                       READ ONLY  NO
         3 xxxxx                               READ WRITE YES


Run following from one of the nodes.
./datapatch -verbose -pdbs xxxxxx

[oracle@xxxxOPatch]$ ./datapatch -verbose -pdbs xxxxxx
SQL Patching tool version 12.1.0.2.0 on Thu May 26 13:25:17 2016
Copyright (c) 2015, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_68726_2016_05_26_13_25_17/sqlpatch_invocation.log

Bootstrapping registry and package to current versions...done
Connecting to database...OK
Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of SQL patches:
Bundle series PSU:
  ID 5 in the binary registry and not installed in any PDB

Adding patches to installation queue and performing prereq checks...
Installation queue:
  For the following PDBs: PQBSMAC06
    Nothing to roll back
    The following patches will be applied:
      21359755 (Database Patch Set Update : 12.1.0.2.5 (21359755))

Installing patches...
Patch installation complete.  Total patches installed: 1

Validating logfiles...
Patch 21359755 apply (pdb PQBSMAC06): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/21359755/19194568/21359755_apply_CQXAC06P_PQBSMAC06_2016May26_13_26_04.log (no errors)
SQL Patching tool complete on Thu May 26 13:26:09 2016


Lower patch in CDB_DEST than in CDB_SOURCE?

There is another situation, where your PDB has higher patch level than your CDB. 
Now this becomes a bit more tricky. See the output of PDB_PLUG_IN_VIOLATIONS:

TYPE  MESSAGE
---- ----------------------------------------------------------------------------
ERROR PSU bundle patch 1 (PSU Patch 4711): Installed in the PDB but not in the CDB
ACTION
------------------------------------------------
Call datapatch to install in the PDB or the CDB

What does this mean? Should I install now the current CDB/PDB's PSU into my target environment before being able to step down? 

If you think this message is misleading. And when you look into the MyOracle Support Note describing this under scenario 3 (MOS Note:1935365.1 - Multi tenant Unplug/Plug Best Practices) you'll see that the author silently assumed as well that is is more likely that you'll remove the patch from the PDB. 

But how do you remove changes which came in with datapatch from within a PDB only?

You will need to run datapatch -rollback on the affected PDBs only:

[oracle@xxxxOPatch]$ ./datapatch -rollback <patch id> –force [–bundle_series] -pdbs <pdb1,pdb2,...,pdbn>

This will rollback any patches installed on PDBs and then you can subsequently run the datapatch on CDB, which will fix all the issues. 

One more workaround would be following. 

SQL>alter pluggable database pdb close immediate instances=all;

SQL>alter pluggable database pdb open upgrade;

SQL>>select * from gv$pdbs;


-- Run datapatch from ORACLE_HOME/OPatch

[oracle@xxx OPatch]$ ./datapatch -verbose

There is one more thing that one can come across when applying datapatch on CDB. 
during datapatch apply it may wait and fail on time out with failure to grant access to one user as follows. 


SQL> GRANT SELECT ON sys.gv_$instance TO dv_secanalyst
  2  /
GRANT SELECT ON sys.gv_$instance TO dv_secanalyst
                    *
ERROR at line 1:
ORA-04021: timeout occurred while waiting to lock object


WORKAROUND:

One can startup the database in restrict mode and execute the failed SQL statement manually but require downtime to startup the database in restrict mode.


SQL> GRANT SELECT ON sys.gv_$instance TO dv_secanalyst

The above statement will not work if you startup the database in normal mode.


Another Issue - 


Error
validate_con_names: PDB$SEED is not open
catconInit: Unexpected error returned by validate_con_names for inclusive Container list

Cause - 

PDB$SEED is not open:

SQL> SELECT name, open_mode FROM v$pdbs;

NAME OPEN_MODE
------------------------------ ----------
PDB$SEED MOUNTED
PQAUG01  READ WRITE 


Fix - 

SQL> alter session set "_oracle_script"=TRUE;
SQL> alter pluggable database pdb$seed OPEN READ ONLY;
SQL> alter session set "_oracle_script"=FALSE;
SQL> SELECT name, open_mode FROM v$pdbs;

NAME                                                                             OPEN_MODE
-------------------------------------------------------------------------------- ----------
PDB$SEED                                                                         READ ONLY
PQAUG01                                                                          READ WRITE

Friday, November 11, 2016

MongoDB StartUp Issues with 

"systemctl status mongod.service" and "journalctl -xe"


We recently had issue where one of our replicaset member went offline for some time and  fell behind in syncing.
To come around the situation, we decide the clean out the node and start the service so that it will sync automatically from other replicaset members.
However after cleaning out the data directories the mongo refused to start. 

sh-4.2$ pbrun /etc/init.d/mongod start
Starting mongod (via systemctl):  Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.                 [FAILED]

-sh-4.2$ pbrun /etc/init.d/mongod status

â mongod.service - SYSV: Mongo is a scalable, document-oriented database.
   Loaded: loaded (/etc/rc.d/init.d/mongod)
   Active: failed (Result: exit-code) since Fri 2016-11-11 10:09:20 MST; 2min 49s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 6552 ExecStop=/etc/rc.d/init.d/mongod stop (code=exited, status=0/SUCCESS)
  Process: 10514 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)
 Main PID: 2156 (code=exited, status=0/SUCCESS)

Nov 11 10:09:20 hqiqlmemdb01 systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
Nov 11 10:09:20 hqiqlmemdb01 runuser[10522]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Nov 11 10:09:20 hqiqlmemdb01 runuser[10522]: pam_unix(runuser:session): session closed for user mongod
Nov 11 10:09:20 hqiqlmemdb01 mongod[10514]: Starting mongod: [FAILED]
Nov 11 10:09:20 hqiqlmemdb01 systemd[1]: mongod.service: control process exited, code=exited status=1
Nov 11 10:09:20 hqiqlmemdb01 systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..
Nov 11 10:09:20 hqiqlmemdb01 systemd[1]: Unit mongod.service entered failed state.
Nov 11 10:09:20 hqiqlmemdb01 systemd[1]: mongod.service failed.
-

While checking the mongod.conf file, I spoted the mongodb.key value. This file was there for authentication. 

security:
  authorization: enabled
  keyFile: /data/mongodb/pqmrsme001/mongodb.key

While cleaning up Data directory, we also wiped out that file. so I copied the file back from backup and placed it in data directory. 
After that process started just fine. 


-sh-4.2$ pbrun /etc/init.d/mongod start
Starting mongod (via systemctl):                           [  OK  ]

-sh-4.2$ pbrun /etc/init.d/mongod status
mongod.service - SYSV: Mongo is a scalable, document-oriented database.
   Loaded: loaded (/etc/rc.d/init.d/mongod)
   Active: active (running) since Fri 2016-11-11 10:28:44 MST; 6s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 6552 ExecStop=/etc/rc.d/init.d/mongod stop (code=exited, status=0/SUCCESS)
  Process: 11733 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=0/SUCCESS)
 Main PID: 11745 (mongod)
   CGroup: /system.slice/mongod.service
           11745 /usr/bin/mongod -f /etc/mongod.conf

Thursday, September 15, 2016


Enable Authentication & Authorization on 

MongoDB Ops Manager


In this note, I will describe how to enable authentication and authorization on MongoDB Ops Manager cloud control env. 

My setup is as follows
3 node rerplicaset for Ops Manager Metadata Repository
3 node rerplicaset for Ops Manager Sync Store DB 
2 node for application servers
1 node for Backup Daemon 

At high level we need to do following. 

a. Create db user in rerplicaset with right roles.
b. Modify Ops manager config files with user details
c. Create key file on replicaset nodes and copy it on all nodes (assuming you are using single key file across all replica sets. If otherwise create multiple key files)
d. Modify mongod.conf file on all nodes of all replica sets and restart mongbdb in rolling fashion.


1.  create users on both replset(metadata and blockstore/syncstore)

db.createUser(
  {
    user: "opsmanager",
    pwd: "xxxxxxx",
    roles: [ { role: "root", db: "admin" } ]
  }
)
Make sure the data is replicated.

2. modify opsmanager config files with users details

#mongo.mongoUri=mongodb://username:password@memdb03.phx.aexp.com:27017,memdb02.phx.aexp.com:27017,memdb01.phx.aexp.com:27017

3. bounce all opsmanagers and backup daemon

pbrun /etc/init.d/mongodb-mms restart


Create key file on replicaset nodes -

1. create key file on replset , both

 openssl  rand -base64 755 > /etc/mongodb.key
 chown mongod:mongod /etc/mongodb.key
 chmod  400 /etc/mongodb.key

copy /etc/mongodb.key to all db instances in both repl set.

2.  modify mongb conf files for authrization and key file (secondary, secondary, primary)

 Go to the first secondary instance and change following in conf file. (Try to do it before hand for all replica sets, all nodes)

 security:
  authorization: enabled
  keyFile: /data/mongodb/pqmrsme001/mongodb.key
  
 bounce the mongodb instance and make sure its in sync with primary

 Go to second secondary perform the above change and then primary

 pbrun /etc/init.d/mongod restart


##After first/primary node restart

[root@lpdosput00250 ~]#  mongo --port 27017 --authenticationDatabase admin -u opsmanager -p xxxxxxx
MongoDB shell version: 3.2.1
MongoDB Enterprise rs0:RECOVERING> rs.status()
{
        "set" : "rs0",
        "date" : ISODate("2016-08-18T18:46:06.886Z"),
        "myState" : 3,
        "term" : NumberLong(141),
        "heartbeatIntervalMillis" : NumberLong(2000),
        "members" : [
                {
                        "_id" : 0,
                        "name" : "10.20.176.248:28017",
                        "health" : 1,
                        "state" : 3,
                        "stateStr" : "RECOVERING",    <-- Notice the change of state
                        "uptime" : 34,
                        "optime" : {
                                "ts" : Timestamp(1471545769, 1),
                                "t" : NumberLong(141)
                        },
                        "optimeDate" : ISODate("2016-08-18T18:42:49Z"),
                        "infoMessage" : "could not find member to sync from",
                        "configVersion" : 3,
                        "self" : true
                },
                {
                        "_id" : 1,
                        "name" : "10.20.176.248:28018",
                        "health" : 0,
                        "state" : 6,
                        "stateStr" : "(not reachable/healthy)", <-- Notice the change of state
                        "uptime" : 0,
                        "optime" : {
                                "ts" : Timestamp(0, 0),
                                "t" : NumberLong(-1)
                        },
                        "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                        "lastHeartbeat" : ISODate("2016-08-18T18:46:03.207Z"),
                        "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                        "pingMs" : NumberLong(0),
                        "authenticated" : false,
                        "configVersion" : -1
                },
                {
                        "_id" : 2,
                        "name" : "10.20.176.248:28019",
                        "health" : 0,
                        "state" : 6,
                        "stateStr" : "(not reachable/healthy)", <-- Notice the change of state
                        "uptime" : 0,
                        "optime" : {
                                "ts" : Timestamp(0, 0),
                                "t" : NumberLong(-1)
                        },
                        "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                        "lastHeartbeat" : ISODate("2016-08-18T18:46:03.209Z"),
                        "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                        "pingMs" : NumberLong(0),
                        "authenticated" : false,
                        "configVersion" : -1
                }
        ],
        "ok" : 1
}

##After Secondary node restart -

MongoDB Enterprise rs0:SECONDARY> rs.status()
{
        "set" : "rs0",
        "date" : ISODate("2016-08-18T18:47:27.806Z"),
        "myState" : 2,
        "term" : NumberLong(141),
        "heartbeatIntervalMillis" : NumberLong(2000),
        "members" : [
                {
                        "_id" : 0,
                        "name" : "10.20.176.248:28017",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "PRIMARY", <-- Notice the change of state
                        "uptime" : 10,
                        "optime" : {
                                "ts" : Timestamp(1471545769, 1),
                                "t" : NumberLong(141)
                        },
                        "optimeDate" : ISODate("2016-08-18T18:42:49Z"),
                        "lastHeartbeat" : ISODate("2016-08-18T18:47:27.724Z"),
                        "lastHeartbeatRecv" : ISODate("2016-08-18T18:47:24.382Z"),
                        "pingMs" : NumberLong(0),
                        "configVersion" : 3
                },
                {
                        "_id" : 1,
                        "name" : "10.20.176.248:28018",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY", <-- Notice the change of state
                        "uptime" : 10,
                        "optime" : {
                                "ts" : Timestamp(1471545769, 1),
                                "t" : NumberLong(141)
                        },
                        "optimeDate" : ISODate("2016-08-18T18:42:49Z"),
                        "infoMessage" : "could not find member to sync from",
                        "configVersion" : 3,
                        "self" : true
                },
                {
                        "_id" : 2,
                        "name" : "10.20.176.248:28019",
                        "health" : 0,
                        "state" : 6,
                        "stateStr" : "(not reachable/healthy)", <-- Notice the change of state
                        "uptime" : 0,
                        "optime" : {
                                "ts" : Timestamp(0, 0),
                                "t" : NumberLong(-1)
                        },
                        "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                        "lastHeartbeat" : ISODate("2016-08-18T18:47:27.726Z"),
                        "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                        "pingMs" : NumberLong(0),
                        "authenticated" : false,
                        "configVersion" : -1
                }
        ],
        "ok" : 1
}


##After Secondary node restart -

MongoDB Enterprise rs0:SECONDARY> rs.status()
{
        "set" : "rs0",
        "date" : ISODate("2016-08-18T18:51:29.408Z"),
        "myState" : 2,
        "term" : NumberLong(143),
        "syncingTo" : "10.20.176.248:28018",
        "heartbeatIntervalMillis" : NumberLong(2000),
        "members" : [
                {
                        "_id" : 0,
                        "name" : "10.20.176.248:28017",
                        "health" : 1,
                        "state" : 1,
                        "stateStr" : "PRIMARY", <-- Notice the change of state
                        "uptime" : 9,
                        "optime" : {
                                "ts" : Timestamp(1471546211, 1),
                                "t" : NumberLong(143)
                        },
                        "optimeDate" : ISODate("2016-08-18T18:50:11Z"),
                        "lastHeartbeat" : ISODate("2016-08-18T18:51:25.260Z"),
                        "lastHeartbeatRecv" : ISODate("2016-08-18T18:51:29.261Z"),
                        "pingMs" : NumberLong(0),
                        "electionTime" : Timestamp(0, 0),
                        "electionDate" : ISODate("1970-01-01T00:00:00Z"),
                        "configVersion" : 3
                },
                {
                        "_id" : 1,
                        "name" : "10.20.176.248:28018",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY", <-- Notice the change of state
                        "uptime" : 9,
                        "optime" : {
                                "ts" : Timestamp(1471546211, 1),
                                "t" : NumberLong(143)
                        },
                        "optimeDate" : ISODate("2016-08-18T18:50:11Z"),
                        "lastHeartbeat" : ISODate("2016-08-18T18:51:25.260Z"),
                        "lastHeartbeatRecv" : ISODate("2016-08-18T18:51:28.127Z"),
                        "pingMs" : NumberLong(0),
                        "syncingTo" : "10.20.176.248:28017",
                        "configVersion" : 3
                },
                {
                        "_id" : 2,
                        "name" : "10.20.176.248:28019",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY", <-- Notice the change of state
                        "uptime" : 10,
                        "optime" : {
                                "ts" : Timestamp(1471546211, 1),
                                "t" : NumberLong(143)
                        },
                        "optimeDate" : ISODate("2016-08-18T18:50:11Z"),
                        "syncingTo" : "10.20.176.248:28018",
                        "infoMessage" : "syncing from: 10.20.176.248:28018",
                        "configVersion" : 3,
                        "self" : true
                }
        ],
        "ok" : 1
}


After you make this change, one has to enable the password for oplog store database so that ops manager can login 
and write oplog from replica sets to oplog store database.

From OpsMgr:  Click 'Admin' in upper right, then the 'Backup' tab, then the 'Oplog Storage' sub-tab and fill in username and password fields.

Once that is done, restart the opsmanager and backup daemon servers.

If you miss the above, you will see following error on Ops manager system warnings.

com.xgen.svc.brs.web.res.BackupConfigurationResource.updateReplicaSetConfiguration(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,java.lang.String,java.util.List,java.lang.String,java.lang.String,java.lang.String) - msg: { "serverUsed" : "memdb05:27017" , "ok" : 0.0 , "errmsg" : "not authorized on 570d36d634fc72f8790f2e63 to execute command { createIndexes: \"oplog_pdmcl101\", indexes: [ { name: \"groupId_1_rsId_1_valid_1_end_1__id_1\", ns: \"570d36d634fc72f8790f2e63.oplog_pdmcl101\", background: true, key: { groupId: 1, rsId: 1, valid: 1, end: 1, _id: 1 } } ] }" , "code" : 13} com.mongodb.CommandFailureException { "serverUsed" : "memdb05:27017" , "ok" : 0.0 , "errmsg" : "not authorized on 570d36d634fc72f8790f2e63 to execute command { createIndexes: \"oplog_pdmcl101\", indexes: [ { name: \"groupId_1_rsId_1_valid_1_end_1__id_1\", ns: \"570d36d634fc72f8790f2e63.oplog_pdmcl101\", background: true, key: { groupId: 1, rsId: 1, valid: 1, end: 1, _id: 1 } } ] }" , "code" : 13} 

Also remember that if you have monitoring and backup agents running on backup daemon, they dont need bounce coz monitoring agent does not need to talk with Meta data DB as it check the target db status and ask the opsmanager to write details to Metadata DB.

MongoDB Start Up Issues & Warnings


While taking backup of MongoDB using Ops Manager cloud control, we came across various warnings at different stages. 
following are the warnings that one may come across during start of the Head DB.


WARNING: soft rlimits too low. rlimits set to 4096 processes, 64000 files.

##Pls create following file if not already present.

 cat /etc/security/limits.d/90-nproc.conf
* soft nproc 64000
* hard nproc 64000

Make sure to reboot the system after the change.


As we are using Data Domain to store snapshots and SAN for Head DB, another error we faced was following.

unable to create or lock mongod.lock file

Here the issue was with the options we used to mount the file system.so we changed the options to include following.

nolock, noatime, nointr

There were also some more warnings regarding NUMACTL not installed. 
one way is to install the numactl on backup daemon server with the help of SA. 
OR 
we can disable it using Ops Manager UI as follows.

Non-Uniform Memory Access (NUMA) Settings

Key - mongodb.disable.numa
Value Type: boolean

To disable NUMA for the head databases:

1.Click the Admin link, then the General tab, then the Ops Manager Config page, and then the Custom section.
2.Add mongodb.disable.numa as a Key and set its Value to true.
3.Click Save.

Tuesday, August 9, 2016


Remove Old SNAPs From AWR History



Recently we came across the siutation, where our AWR snapshots taking lot of space in SYSAUX. Upon review we figure out that the DB was recently restored to new servers during physical migration. 
Hence the data from old DBID was still pertinent in DB. 

New DBID=3360745648
Old DBID = 926777616 


SYS@NPOFE02P1>select DBID,NAME from v$database;

      DBID NAME
---------- ------------
3360745648 xxxxx

SYS@NPOFE02P1>select * from dba_hist_wr_control;

      DBID SNAP_INTERVAL                  RETENTION                      TOPNSQL
---------- ------------------------------ ------------------------------ ----------
3360745648 +00000 00:15:00.0              +00015 00:00:00.0              DEFAULT
 926777616 +00000 00:15:00.0              +00060 00:00:00.0              DEFAULT

-- We checked how many snaps we do have for old DBID.
SYS@NPOFE02P1>select SNAP_ID, DBID,INSTANCE_NUMBER,SNAP_LEVEL from dba_hist_snapshot where dbid=926777616 order by snap_id, dbid;

-- find out the min and max range to remove from DB

SYS@NPOFE02P1>select min(SNAP_ID), max(SNAP_ID) from dba_hist_snapshot where dbid=926777616;

MIN(SNAP_ID) MAX(SNAP_ID)
------------ ------------
      113085       118150

 
SQL> execute dbms_workload_repository.drop_snapshot_range(113085,118150);

PL/SQL procedure successfully completed.

Once done the above step, all the snpas were removed from Database.