---
# System prepended metadata

title: Factory backup 12-01-2023

---

# Factory backup 12-01-2023

> Date: 12-01-2023
> Backup By: Anto Joeis
> Time: 10.30 AM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **3.85GB**
![](https://i.imgur.com/Gjgcwmy.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **2710412**
Storage size: **0.70GB**
![](https://i.imgur.com/ZSxOuwb.png)



---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd).
                                             
```
mkdir factory-backup-2022-12-19-2023-01-12
```
6. Modify folder permission: chmod -R 777 factory-backup-2022-12-19-2023-01-12

```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-12-19-2023-01-12

* Check backup stored or not
ls factory-backup-2022-12-19-2023-01-12/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-12-19-2023-01-12 /home/test/Qidu_DB
3. Check backup stored or not
ls Qidu_DB/factory-backup-2022-12-19-2023-01-12/dtaDB/

```
---

## Delete Realtimestatus records
    
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
    
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2023-01-11 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 2699433 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
    
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **3.15GB**
![](https://i.imgur.com/i8mDaim.png)



---
## Realtimestatus statistics (after delete)

**realtimestatus**
    
No. of documents: **10979**
Storage size: **0.002GB**
![](https://i.imgur.com/KMXz0CQ.png)



-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
# Factory backup 20-12-2022

> Date: 20-12-2022
> Backup By: Anto Joeis
> Time: 10.20 PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **4.04GB**
![](https://i.imgur.com/Tg2vmkj.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **3778042**
Storage size: **0.92GB**
![](https://i.imgur.com/nTAj97p.png)



---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd).
                                             
```
mkdir factory-backup-2022-11-30-2022-12-20
```
6. Modify folder permission: chmod -R 777 factory-backup-2022-11-30-2022-12-20

```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-11-30-2022-12-20

* Check backup stored or not
ls factory-backup-2022-11-30-2022-12-20/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-11-30-2022-12-20 /home/test/Qidu_DB
3. Check backup stored or not
ls Qidu_DB/factory-backup-2022-11-30-2022-12-20/dtaDB/

```
---

## Delete Realtimestatus records
    
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
    
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-12-19 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 3495449 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
    
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **3.19GB**
![](https://i.imgur.com/G0CvXiV.png)



---
## Realtimestatus statistics (after delete)

**realtimestatus**
    
No. of documents: **282599**
Storage size: **0.069GB**
![](https://i.imgur.com/c8zx0DD.png)



-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
                                             
# Factory backup 01-12-2022

> Date: 01-12-2022
> Backup By: Anto Joeis
> Time: 10.20 PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **5.0GB**
![](https://i.imgur.com/jIt2GsC.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **8140029**
Storage size: **1.9GB**
![](https://i.imgur.com/PwQEBmY.png)



---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd).
                                             
```
mkdir factory-backup-2022-11-03-2022-12-01
```
6. Modify folder permission: chmod -R 777 factory-backup-2022-11-03-2022-12-01

```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-11-03-2022-12-01

* Check backup stored or not
ls factory-backup-2022-11-03-2022-12-01/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-11-03-2022-12-01 /home/test/Qidu_DB
3. Check backup stored or not
ls Qidu_DB/factory-backup-2022-11-03-2022-12-01/dtaDB/

```
---

## Delete Realtimestatus records
    
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
    
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-11-30 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 7809631 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
    
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **3.1GB**
![](https://i.imgur.com/nxCxG6m.png)



---
## Realtimestatus statistics (after delete)

**realtimestatus**
    
No. of documents: **330627**
Storage size: **0.085GB**
![](https://i.imgur.com/moi3oqg.png)



-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
                                             
# Factory backup 04-11-2022

> Date: 04-11-2022
> Backup By: Anto Joeis
> Time: 10.20 PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **5.8GB**
![](https://i.imgur.com/TSx6kvL.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **12062868**
Storage size: **2.8GB**
![](https://i.imgur.com/ujCkFsg.png)



---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
    factory-backup-2022-09-25-2022-11-04
6. Modify folder permission: chmod -R 777 <folder name>

```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-09-25-2022-11-04

* Check backup stored or not
ls factory-backup-2022-09-25-2022-11-04/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-09-25-2022-11-04 /home/test/
3. Check backup stored or not
ls factory-backup-2022-09-25-2022-11-04/dtaDB/

```
---

## Delete Realtimestatus records
    
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
    
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-11-03 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 11449015 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
    
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **3.1GB**
![](https://i.imgur.com/ynYQi3C.png)



---
## Realtimestatus statistics (after delete)

**realtimestatus**
    
No. of documents: **613853**
Storage size: **0.14GB**
![](https://i.imgur.com/RIFyeOs.png)


-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
# Factory backup 26-09-2022

> Date: 26-09-2022
> Backup By: Anto Joeis
> Time: 01.10 PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **3.8GB**
![](https://i.imgur.com/qWg9DkO.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **3618352455.0**
Storage size: **1.01GB**
![](https://i.imgur.com/AOL5hFO.png)


---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
    factory-backup-2022-09-06-2022-09-26
6. Modify folder permission: chmod -R 777 <folder name>


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-09-06-2022-09-26

* Check backup stored or not
ls factory-backup-2022-09-06-2022-09-26/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-09-06-2022-09-26 /home/test/
3. Check backup stored or not
ls factory-backup-2022-09-06-2022-09-26/dtaDB/
```


---

## Delete Realtimestatus records
	
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
    
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-09-25 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 4030851 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
    
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **2.8GB**
![](https://i.imgur.com/mQVx6lV.png)



---
## Realtimestatus statistics (after delete)

**realtimestatus**
    
No. of documents: **1624222**
Storage size: **0.0006GB**
![](https://i.imgur.com/MECHZwE.png)


------
------
------
# Factory backup 07-09-2022

> Date: 07-09-2022
> Backup By: Anto Joeis
> Time: 01.00 PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **5.02GB**
![](https://i.imgur.com/bEfgkZH.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **8543172**
Storage size: **2.19GB**
![](https://i.imgur.com/8pjtzwS.png)


---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
    factory-backup-2022-07-18-2022-09-07
6. Modify folder permission: chmod -R 777 <folder name>


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-07-18-2022-09-07

* Check backup stored or not
ls factory-backup-2022-07-18-2022-09-07/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-07-18-2022-09-07 /home/test/
3. Check backup stored or not
ls factory-backup-2022-07-18-2022-09-07/dtaDB/
```


---

## Delete Realtimestatus records
	
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-09-06 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 8128244 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **2.93GB**
![](https://i.imgur.com/yJHd9KW.png)



---
## Realtimestatus statistics (after delete)

**realtimestatus**
    
No. of documents: **414949**
Storage size: **0.10GB**
![](https://i.imgur.com/wUNfYqw.png)


------
------
------
    
# Factory backup 19-07-2022

> Date: 19-07-2022
> Backup By: Nayana
> Time: 01.00 PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: ** 4.86 GB**
![](https://i.imgur.com/pteyI80.png)


---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count):8822578  ****
Storage size: ** 2.12 GB**
![](https://i.imgur.com/utut6OS.png)


---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
    factory-backup-2022-06-16-2022-07-19
6. Modify folder permission: chmod -R 777 <folder name>


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-06-16-2022-07-19

* Check backup stored or not
ls factory-backup-2022-06-16-2022-07-19/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-06-16-2022-07-19 /home/test/
3. Check backup stored or not
ls factory-backup-2022-06-16-2022-07-19/dtaDB/
```


---

## Delete Realtimestatus records
	
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-07-18 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 8576155 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: ** 2.8 GB**
![](https://i.imgur.com/xonolib.png)


---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: 246427 ****
Storage size: ** 0.06 GB**
![](https://i.imgur.com/lfFtww7.png)


------
------
------

# Factory backup 17-06-2022

> Date: 17-06-2022
> Backup By: Nayana
> Time: 10.40 AM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: ** 4.45 GB**
![](https://i.imgur.com/PFJDQig.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count):7468595  ****
Storage size: ** 1.8 GB**
![](https://i.imgur.com/yOHDpm2.png)

---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
    factory-backup-2022-05-26-2022-06-17
6. Modify folder permission: chmod -R 777 <folder name>


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-05-26-2022-06-17

* Check backup stored or not
ls factory-backup-2022-05-26-2022-06-17/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-05-26-2022-06-17 /home/test/
3. Check backup stored or not
ls factory-backup-2022-05-26-2022-06-17/dtaDB/
```


---

## Delete Realtimestatus records
	
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-06-16 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 6913191 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: ** 2.77 GB**
![](https://i.imgur.com/wF4EFQS.png)


---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents:  ****
Storage size: ** 0.13 GB**
![](https://i.imgur.com/b5WawXG.png)


------
------
------


# Factory backup 27-05-2022

> Date: 27-05-2022
> Backup By: Nayana
> Time: 01.20 PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: ** 6.1 GB**
![](https://i.imgur.com/GOY7mmE.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 14139369 ****
Storage size: ** 3.4 GB**
![](https://i.imgur.com/8NUrotA.png)

---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
  factory-backup-2022-04-06-2022-05-27
6. Modify folder permission: chmod -R 777 <folder name>


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-04-06-2022-05-27

* Check backup stored or not
ls factory-backup-2022-04-06-2022-05-27/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-04-06-2022-05-27 /home/test/
3. Check backup stored or not
ls factory-backup-2022-04-06-2022-05-27/dtaDB/
```


---

## Delete Realtimestatus records
	
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo clear
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-05-26 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 13720316 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: ** 2.7 GB**
![](https://i.imgur.com/TpAho9Q.png)


---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: 419053 ****
Storage size: ** 0.1 GB**
![](https://i.imgur.com/cyO4bTp.png)


------
------
------


# Factory backup 07-04-2022

> Date: 07-04-2022
> Backup By: Anto Joeis
> Time: 09.50 AM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: ** 5.99 GB**
![](https://i.imgur.com/MISLqBM.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 13907291 ****
Storage size: ** 3.56 GB**
![](https://i.imgur.com/lccMen4.png)

---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
  factory-backup-2022-01-27-2022-04-07
6. Modify folder permission: chmod -R 777 <folder name>


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2022-01-27-2022-04-07

* Check backup stored or not
ls factory-backup-2022-01-27-2022-04-07/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2022-01-27-2022-04-07 /home/test/
3. Check backup stored or not
ls factory-backup-2022-01-27-2022-04-07/dtaDB/
```


---

## Delete Realtimestatus records
	
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-04-06 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 13436578 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: ** 2.53 GB**
![](https://i.imgur.com/ekmGeOp.png)


---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: 471184 ****
Storage size: ** 0.11 GB**
![](https://i.imgur.com/8nDogxd.png)


------
------
------



# Factory backup 23-12-2021

> Date: 28-01-2022
> Backup By: Nayana
> Time: 10.20 AM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: ** 3.6 GB**
![](https://i.imgur.com/acFm4gL.png)


---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 5553013 ****
Storage size: ** 1.36 GB**
![](https://i.imgur.com/HLRAVTr.png)


---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -ltr
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
  factory-backup-2021-12-22-2022-01-28
6. Modify folder permission: chmod -R 777 <folder name>
7. ssh to Factory database ssh test@10.9.250.16


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2021-12-22-2022-01-28

* Check backup stored or not
ls factory-backup-2021-12-22-2022-01-28/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2021-12-22-2022-01-28 /home/test/
```


---

## Delete Realtimestatus records
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2022-01-27 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 5053581 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: ** 2.4 GB**
![](https://i.imgur.com/n8s2QDg.png)


---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: 499630 ****
Storage size: ** 0.13GB**
![](https://i.imgur.com/0v01Ntd.png)


------
------
------



# Factory backup 23-12-2021

> Date: 23-12-2021
> Backup By: Nayana
> Time: 10.20 AM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **3.2 GB**
![](https://i.imgur.com/mZYhMV2.png)




---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 3910370 ****
Storage size: ** 1 GB**
![](https://i.imgur.com/gFlGhQB.png)




---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -lrt
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
  
  factory-backup-2021-12-05-2021-12-23
6. Modify folder permission: chmod -R 777 <folder name>
7. ssh to Factory database ssh test@10.9.250.16


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2021-12-05-2021-12-23

* Check backup stored or not
ls factory-backup-2021-12-05-2021-12-23/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2021-12-05-2021-12-23 /home/test/
```


---

## Delete Realtimestatus records
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2021-12-22 00:00:00.000Z")}})

Output:{ "acknowledged" : true, "deletedCount" : 3806048 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: ** 2.23 GB**
![](https://i.imgur.com/FpNvZ8e.png)


---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: 104328****
Storage size: ** 0.02GB**
![](https://i.imgur.com/lFD3u60.png)


------
------
------

# Factory backup 06-12-2021

> Date: 06-12-2021
> Backup By: Nayana
> Time: 1.00 PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **3.86 GB**
![](https://i.imgur.com/yazBVCc.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 6870836 ****
Storage size: **1.7 GB**
![](https://i.imgur.com/7Evccmv.png)



---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -lrt
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
  
   factory-backup-2021-12-07-2021-12-06
6. Modify folder permission: chmod -R 777 <folder name>
7. ssh to Factory database ssh test@10.9.250.16


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2021-12-07-2021-12-06

* Check backup stored or not
ls factory-backup-2021-12-07-2021-12-06/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2021-12-07-2021-12-06 /home/test/
```


---

## Delete Realtimestatus records
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2021-12-05 00:00:00.000Z")}})

Output: { "acknowledged" : true, "deletedCount" : 6866487 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: ** 2.17 GB**
![](https://i.imgur.com/Eyc9gXn.png)

---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: 4349****
Storage size: ** 0.0008GB**
![](https://i.imgur.com/uEQ2CnU.png)


------
------
------


# Factory backup 09-11-2021

> Date: 09-11-2021
> Backup By: Nayana
> Time: 1.00PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **3.77 GB**
![](https://i.imgur.com/52uAbq1.png)


---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **6916312**
Storage size: **1.66 GB**
![](https://i.imgur.com/munA9aL.png)


---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -lrt
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
  factory-backup-2021-10-17-2021-11-08
6. Modify folder permission: chmod -R 777 <folder name>
7. ssh to Factory database ssh test@10.9.250.16


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2021-10-17-2021-11-08

* Check backup stored or not
ls factory-backup-2021-10-17-2021-11-08/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2021-10-17-2021-11-08 /home/test/
```


---

## Delete Realtimestatus records
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2021-11-08 00:00:00.000Z")}})

Output: { "acknowledged" : true, "deletedCount" : 6813347 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **2.12 GB**
![](https://i.imgur.com/2VkSQJy.png)


---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: **102965**
Storage size: **0.02 GB**
![](https://i.imgur.com/dBDc4J2.png)



------
------
------


# Factory backup 18-10-2021

> Date: 18-10-2021
> Backup By: Nayana
> Time: 1.00PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **3.6 GB**
![](https://i.imgur.com/f2evTUu.png)



---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **7223084**
Storage size: **1.6 GB**
![](https://i.imgur.com/GhOOJ84.png)

---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -lrt
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
   factory-backup-2021-09-22-2021-10-18
6. Modify folder permission: chmod -R 777 <folder name>
7. ssh to Factory database ssh test@10.9.250.16


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2021-09-22-2021-10-18

* Check backup stored or not
ls factory-backup-2021-09-22-2021-10-18/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2021-09-22-2021-10-18 /home/test/
```


---

## Delete Realtimestatus records
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2021-10-17 00:00:00.000Z")}})

Output: { "acknowledged" : true, "deletedCount" : 6404400 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **2.03 GB**
![](https://i.imgur.com/BDlPZgM.png)




---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: **658812**
Storage size: **0.001 GB**
![](https://i.imgur.com/nonzemg.png)


------
------
------


# Factory backup 23-09-2021

> Date: 23-09-2021
> Backup By: Nayana
> Time: 1.00PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **3.75 GB**
![](https://i.imgur.com/18P8Fgr.png)


---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **7223084**
Storage size: **1.78 GB**
![](https://i.imgur.com/U2aM9OM.png)



---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -lrt
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
   factory-backup-2021-08-23-2021-09-23
6. Modify folder permission: chmod -R 777 <folder name>
7. ssh to Factory database ssh test@10.9.250.16


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2021-08-23-2021-09-23

* Check backup stored or not
ls factory-backup-2021-08-23-2021-09-23/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2021-08-23-2021-09-23 /home/test/
```


---

## Delete Realtimestatus records
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2021-09-22 00:00:00.000Z")}})

Output: { "acknowledged" : true, "deletedCount" : 6974144 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **2.03 GB**
![](https://i.imgur.com/GW4YlBj.png)



---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: **658812**
Storage size: **0.06 GB**
![](https://i.imgur.com/aZf31Qj.png)

------
------
------


# Factory backup 24-08-2021

> Date: 24-08-2021
> Backup By: Nayana
> Time: 5.40PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **3.43 GB**
![](https://i.imgur.com/rdJhhTP.png)

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **6101991**
Storage size: **1.52 GB**
![](https://i.imgur.com/3L1EB6l.png)


---
ssh to Factory database ssh test@10.9.250.16
2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -lrt
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
   factory-backup-2021-08-04-2021-08-24
6. Modify folder permission: chmod -R 777 <folder name>
7. ssh to Factory database ssh test@10.9.250.16


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2021-08-04-2021-08-24

* Check backup stored or not
ls factory-backup-2021-07-14-2021-08-05/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2021-08-04-2021-08-24 /home/test/
```


---

## Delete Realtimestatus records
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2021-08-23 00:00:00.000Z")}})

Output: { "acknowledged" : true, "deletedCount" : 5443220 }

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## dtaDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **2.07 GB**
![](https://i.imgur.com/MoRLmO4.png)


---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: **658812**
Storage size: **0.16 GB**
![](https://i.imgur.com/aZf31Qj.png)


------
------
------
# Factory backup 05-08-2021

> Date: 05-08-2021
> Backup By: Nayana
> Time: 1PM


## dtaDB database statistics (Before delete)

1. **Database and collection statistics before deleting old records**
**dtaDB**
Storage size: **3.62 GB**
![](https://i.imgur.com/u4PLso8.png)

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **7219954**
Storage size: **1.77 GB**
![](https://i.imgur.com/ucouaxX.png)

---

2. Compress and backup the existing dtaDB on the production server 
3. Check existing folders 
```
Path: /home/test/
Command: ls -lrt
```
5. Create folder : mkdir <folder name> 
   Folder name format:<factory-backup-(START Date yyyy-mm-dd)-(End Date yyyy-mm-dd)>
6. Modify folder permission: chmod -R 777 <folder name>
7. ssh to Factory database ssh test@10.9.250.16


```
* backup database
mongodump --uri="mongodb://10.9.250.16:27017/dtaDB?" --gzip --out=/home/test/factory-backup-2021-07-14-2021-08-05

* Check backup stored or not
ls factory-backup-2021-07-14-2021-08-05/dtaDB/

* Copy backup to RD_backup machine
1. ssh to 10.10.80.76
2. Execute below command on 10.10.80.76 
scp -r test@10.9.250.16:/home/test/factory-backup-2021-07-14-2021-08-05 /home/test/
```


---

## Delete Realtimestatus records
1. ssh to Factory database ssh test@10.9.250.16
2. sudo su
3. execute command in mongo shell
4. mongo 
5. use dtaDB
6. Delete the old records in realtimestatus collection
```
db.realtimestatus.deleteMany({"date":{$lt: new ISODate("2021-08-04 00:00:00.000Z")}})

Output: { "acknowledged" : true, "deletedCount" : 6970680}

# Compact the collection
db.runCommand({compact:'realtimestatus'})
```

---
## datDB database statistics (after delete)
4. Database and collection statistics after deleting old records
**dtaDB**
Storage size: **1.91 GB**
![](https://i.imgur.com/Iz7F0ee.png)

---
## Realtimestatus statistics (after delete)

**realtimestatus**
No. of documents: **249274**
Storage size: **0.07 GB**
![](https://i.imgur.com/R3sfdL2.png)
