Skip to main content

Backup

  • Before backing up, pay attention to the current disk capacity usage. The remaining space needs to be twice the used space or more to avoid disk shortage caused by backup.
  • The following directory uses the time point 20221111184140 as an example, format: year, month, day, hour, minute, second
  • The host uses the default data directory /data/hap/ (can be viewed through cat /etc/pdcaptain.json or cat service.sh | grep installDir= in the manager root directory)

dump method

Non-stop service operation is possible

docker exec -it $(docker ps | grep -E 'hdp' | awk '{print $1}') bash -c 'source /entrypoint.sh && backup mysql mongodb file'

The default backup file will be generated in the /data/hap/script/volume/data/backup/20221111184140/ directory. If you need to modify the backup file storage path, you can add a new mount in the docker-compose.yaml app service, as follows:

volumes:
- /backup/:/data/backup/

At this time, the backup file will be generated in the /backup/ directory of the host machine.

backup/
└── 20221201193829
├── backupFile.log
├── backupMongodb.log
├── backupMysql.log
├── file
│   ├──...
├── mongodb
│   ├──...
└── mysql
├── ...

In the backup directory, execute tar -zcvf 20221111184140.tar.gz ./20221201193829 to compress the dumped files.

File copy method

Under the /data/hap/script/volume/data/ directory, the mysql, mongodb, storage, kafka, zookeeper, and redis folders all need to be backed up.

Stop the HDP service and execute the following command to complete data packaging:

mkdir -p /backup && cd /data/hap/script/volume/data/ && tar -zcvf /backup/20221111184140.tar.gz ./mysql ./mongodb ./storage ./kafka ./zookeeper ./redis