# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **2710412**
Storage size: **0.70GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **10979**
Storage size: **0.002GB**

-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **3778042**
Storage size: **0.92GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **282599**
Storage size: **0.069GB**

-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **8140029**
Storage size: **1.9GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **330627**
Storage size: **0.085GB**

-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **12062868**
Storage size: **2.8GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **613853**
Storage size: **0.14GB**

-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **3618352455.0**
Storage size: **1.01GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **1624222**
Storage size: **0.0006GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **8543172**
Storage size: **2.19GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **414949**
Storage size: **0.10GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count):8822578 ****
Storage size: ** 2.12 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: 246427 ****
Storage size: ** 0.06 GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count):7468595 ****
Storage size: ** 1.8 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: ****
Storage size: ** 0.13 GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 14139369 ****
Storage size: ** 3.4 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: 419053 ****
Storage size: ** 0.1 GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 13907291 ****
Storage size: ** 3.56 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: 471184 ****
Storage size: ** 0.11 GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 5553013 ****
Storage size: ** 1.36 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: 499630 ****
Storage size: ** 0.13GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 3910370 ****
Storage size: ** 1 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: 104328****
Storage size: ** 0.02GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): 6870836 ****
Storage size: **1.7 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: 4349****
Storage size: ** 0.0008GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **6916312**
Storage size: **1.66 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **102965**
Storage size: **0.02 GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **7223084**
Storage size: **1.6 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **658812**
Storage size: **0.001 GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **7223084**
Storage size: **1.78 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **658812**
Storage size: **0.06 GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **6101991**
Storage size: **1.52 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **658812**
Storage size: **0.16 GB**

------
------
------
# 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**

---
## Realtimestatus statistics (Before delete)
**realtimestatus**
No. of documents (count): **7219954**
Storage size: **1.77 GB**

---
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**

---
## Realtimestatus statistics (after delete)
**realtimestatus**
No. of documents: **249274**
Storage size: **0.07 GB**
