Posts

Remove Shards from the existing Sharded cluster

Important points to be considered  before removing the shard from the existing shard cluster Make sure that the shard data is migrated to the other shards successfully. Make sure the balancer is enabled before you run the remove shard. Step-1: find the shard name to be removed  To find the name of the shard, connect to mongos instance.  db.adminCommand( { listShards: 1 } ) Output: mongos> db.adminCommand( { listShards: 1 } ) { "shards" : [ { "_id" : "replicaset1", "host" : "replicaset1/mysql8.localdomain:27011,mysql8.localdomain:27012,mysql8.localdomain:27013", "state" : 1 }, { "_id" : "replicaset2", "host" : "replicaset2/mysql8.localdomain:27021,mysql8.localdomain:27022,mysql8.localdomain:27023", "state" : 1 }, { "_id" : "replicaset3", "host" : "replicaset3/mysql8.localdomain:27031,mysql8.lo...

Configure Delayed, hidden member and Arbiter in MongoDB

Steps to Configure Delayed, hidden member and Arbiter in MongoDB To configure replication please follow the below link. https://ferozmdba.blogspot.com/2020/07/mongodb-replication-and-sharding.html Points to remember Hidden member will always be a priority "0" Delayed member will be a hidden member and priority "0" member When you consider a hidden one, make sure that priority is also "0" When configuring a delayed on, make sure that it has priority "0" as well as it is hidden. Steps to make replica as hidden var config=rs.conf() config.members[3].priority=0; config.members[3].hidden=true; rs.reconfig(config); Steps to configure slave Delayed var config=rs.conf() config.members[4].slaveDelay=3600 rs.reconfig(config);

Steps to configure replica set priority in MongoDB

 Configure replica set priority in MongoDB T o configure replication please follow the below link. https://ferozmdba.blogspot.com/2020/07/mongodb-replication-and-sharding.html 1. Add a few more mongo instances, since we have 3 mongo instances running on ports 27107,27108 and 27109. So add two more instances. mkdir -p /home/replica04 mkdir -p /home/replica05 2. start the 3 mongod server mongod --dbpath /home/replica04 --port 27107 --logpath /home/logs/replica04_log --logappend --fork --bind_ip_all -replSet replicaset01 mongod --dbpath /home/replica05 --port 27108 --logpath /home/logs/replica05_log --logappend --fork --bind_ip_all -replSet replicaset01 3. connect to primary mongod db and run the below commands var config=rs.conf() config.members[1].priority=6;  --- it sets the highest priority config.members[3].priority=0;  ---- this will never become primary whenever there is a primary replica crashes (because now (its bacame as a hidden member) rs.reconfig(config);  ...

Configure Shard/Sharding mongodb

Steps to configure Sharding in MongoDB on Linux 1. Configure 9 different servers mongod --dbpath /home/replica11 --port 27011 --logpath /home/replica11/rep11.log --logappend --fork --bind_ip_all --replSet replicaset1 --shardsvr mongod --dbpath /home/replica12 --port 27012 --logpath /home/replica12/rep12.log --logappend --fork --bind_ip_all --replSet replicaset1 --shardsvr mongod --dbpath /home/replica13 --port 27013 --logpath /home/replica13/rep13.log --logappend --fork --bind_ip_all --replSet replicaset1 --shardsvr mongod --dbpath /home/replica21 --port 27021 --logpath /home/replica21/rep21.log --logappend --fork --bind_ip_all --replSet replicaset2 --shardsvr mongod --dbpath /home/replica22 --port 27022 --logpath /home/replica22/rep22.log --logappend --fork --bind_ip_all --replSet replicaset2 --shardsvr mongod --dbpath /home/replica23 --port 27023 --logpath /home/replica23/rep23.log --logappend --fork --bind_ip_all --replSet replicaset2 --shardsvr mongod --dbpath /home/replica31 -...

Migrate the data from one disk to another or Add new disk and remove old disk in oracle ASM

old disk: DATA_DISK New disk: DATA12_DISK Step-1: check what disks are allocate to the diskgroup . oraenv +ASM1 sqlplus / as sysasm set linesize 300 set pagesize 1000 set colsep | col name for a15 col PATH for a44 col HEADER_STATUS for a10 col MODE_STATUS for a10 col DN for 9999 col STATE for a10 col LABEL for a25 select group_number,name from v$asm_diskgroup order by name; select        a.GROUP_NUMBER gn,       b.name,       a.DISK_NUMBER DN,       a.PATH,       a.MOUNT_STATUS M_Status,       a.HEADER_STATUS H_Status,       a.MODE_STATUS,       a.STATE,       a.OS_MB,       a.TOTAL_MB,       a.FREE_MB from         v$asm_disk A,        v$asm_diskgroup B        Where A.group_number=B.group_number(+)         and a.GROUP_NUMBER = ...

Oracle DBA Interview Questions and Answers

---- RMAN ---- backup strategy --------------- We are using tape backup every Sunday - Level 0 backup (full) from Monday to sat - incremental backup every 1 hour - archive log backup Hot vs cold backup ------------------- what is difference --> what is the benefit cold backup does not required recovery - because it is a consistent backup hot backup needs recovery -- because during backup time data will modify restore vs recovery -------------------- restore - restoring datafile from secondary backup location to primary location like from tape to disk recovery- applying archivelogs - doing this it make database into consistent state scenario -------- 1. If datafile SCN is higher than the other datafiles - what is the reason and how you do recovery 2. If i have 2 system datafiles, one of the datafile is lost (someone removed from OS level) can you bring the database in mount state? 1. How to check backups are failed? - V$RMAN_BACKUP_JOB_DETAILS 2. How to resolve backu...

MongoDB Replication Administration and Troubleshooting

How to connect to mongodb server (specific to the replication enabled database)   mongo "mongodb://localhost:27018,localhost:27019,localhost:27020/myDB?replicaSet=rs0" Replica Status rs.status() Example MongoDB rs0:PRIMARY> rs.status() {         "set" : "rs0",         "date" : ISODate("2020-07-09T11:57:31.329Z"),         "myState" : 1,         "term" : NumberLong(1),         "syncingTo" : "",         "syncSourceHost" : "",         "syncSourceId" : -1,         "heartbeatIntervalMillis" : NumberLong(2000),         "majorityVoteCount" : 2,         "writeMajorityCount" : 2,         "optimes" : {                 "lastCommittedOpTime" : {                 ...