Application Data Cleaning
Application data includes application information, application grouping, application roles, worksheet information, worksheet data, and so on. In order to ensure data security, the deletion of important data in the system is logical deletion. However, with the increase of deleted data, in addition to occupying disk storage space, it may also have some impact on database performance. Therefore, HAP provides application data cleaning service to physically delete the deleted data regularly according to the set rules.
-
Download mirror
- Internet Access Available
- Internet Access Unavailable
docker pull nocoly/hap-dataclean-app:1.0.0https://pdpublic.nocoly.com/offline/hap-dataclean-app-linux-amd64-1.0.0.tar.gz
#Execute the following after downloading it to the server:
docker load -i hap-dataclean-app-linux-amd64-1.0.0.tar.gz -
Docker Swarm initialization (skip this step if already initialized)
docker swarm init -
Create the
dataclean.yamlfile in any directory with the following contents:version: '3'
services:
app:
image: nocoly/hap-dataclean-app:1.0.0
volumes:
- ./appsettings.json:/app/Config/appsettings.json -
Create the
appsettings.jsonconfiguration file in the directory where thedataclean.yamlfile is located, with the following contents:{
"WorksheetConnStr": "mongodb://127.0.0.1:27017/mdworksheet",
"MD_WSService1": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSService2": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSService3": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSService4": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSService5": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSService6": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSService7": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSService8": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSService9": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSService10": "mongodb://127.0.0.1:27017/mdwsrows",
"MD_WSLogService1": "mongodb://127.0.0.1:27017/mdworksheetlog",
"ApkConnStr": "mongodb://127.0.0.1:27017/mdapps",
"AppRoleConnStr": "mongodb://127.0.0.1:27017/mdapproles",
"MD.Worksheet.DbName": "mdworksheet",
"MD.WorksheetRow.DbName": "mdwsrows",
"DeleteDay": 60,
"DeleteRowByNomal": 0,
"DelateRowDay": 60,
"DelateRowTotal": 10000,
"Corn": "0 0 2 * * ? "
}Configuration Notes:
mongodb://127.0.0.1:27017Replaced with the actual MongoDB connection addressDeleteDayDelete data from X day(s) agoDeleteRowByNomalWhether to clean up deleted row records when the worksheet is in normal status (0: No cleaning, 1: Cleaning)DelateRowDayWhen DeleteRowByNomal=1, delete row records from X days ago; when DeleteRowByNomal=0, the configuration is invalid.DelateRowTotalWhen DeleteRowByNomal=1, delete data only when the total number of worksheet row records is greater than X; when DeleteRowByNomal=0, the configuration is invalid.CornTimed execution of the corn expression. See https://51tools.info/cron/ ,0 0 2 * * ?means execute at 2:00 every day.
-
Start data cleaning service and execute it in the directory where
dataclean.yamlis locateddocker stack deploy -c dataclean.yaml datacleanThe execution logs of timed tasks can be viewed with
docker logs $(docker ps | grep dataclean | awk '{print $1}').If you need to remove the service, execute
docker stack rm dataclean.