# elasticBackup **Repository Path**: FormatFa/elastic-backup ## Basic Information - **Project Name**: elasticBackup - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-16 - **Last Updated**: 2024-07-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Elasticsearch and Kibana backup,include: - kibana all dashboards and relate visulization - kibana roles and elasticsearch user - elasticsearch watcher -prefix="" backup file sampler: - dashboard.ndjson ``` "attributes":{"fieldFormatMap":"{\"@timestamp\":{\"id\":\"date\",\"params\":{\"parsedUrl\":{\"origin\":\"https://*****\",\"pathname\":\"/app/management\",\"basePath\":\"\"}}},\"activemq.broker.memory.broker.pct\":{\"id\":\"percent\",\"params\":{\"parsedUrl\":{\"origin\":\"https://*****\",\"pathname\":\"/app/dashboards\",\"basePath\":\"\"}}},\"activemq.broker.memory.store.pct\":{\"id\":\"percent\" ... ``` - role.json ``` [{"name":"apm_system","metadata":{"_reserved":true},"transient_ ... ``` - watches.json ``` {"took":10,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0, ... ``` - user.json ``` {"enterprise_search":{"username":"enterprise_search","roles":["en ... ``` command line usage: - backup `python elastic_backup.py -es=https://xxx -kibana=https://xxx -u=elastic -p=Vsp9XhmCGOq7SRcVXNg4VhUh` python elastic_backup.py -es=qq -kibana=xx -u=xx -p=xx -prefix= backup to dir=es_backup - restore - dashboard.ndjson can directly import in kibana - other `python elastic_restore.py -es=https://localhost:9200 -kibana=http://localhost:5601 -u=elastic -p=z3UVORWUwq7=5FA+4Him -f es_backup/2024-05-09_watches.json -t watcher` `python elastic_restore.py -es=https://localhost:9200 -kibana=http://localhost:5601 -u=elastic -p=z3UVORWUwq7=5FA+4Him -f es_backup/2024-05-09_role.json -t role` ` python elastic_restore.py -es=https://localhost:9200 -kibana=http://localhost:5601 -u=elastic -p=z3UVORWUwq7=5FA+4Him -f es_backup/2024-05-09_user.json -t user` docker: 备份: ` docker run -e PROGRAM=elastic_backup -v localdir:/mybackup --rm elasticbackup:1.0 -es=https://es -kibana=https://xx -u=backupuser -p=seito123 -o=/mybackup ` - 恢复role ` docker run -e PROGRAM=elastic_restore --network myelastic -v localdir:/mybackup --rm elasticbackup:1.0 -es=https://es01:9200 -kibana=http://kibana:5601 -u=elastic -p=seito123 -t role -f /mybackup/2024-07-18_role.json ` - 恢复user ` docker run -e PROGRAM=elastic_restore --network myelastic -v localdir:/mybackup --rm elasticbackup:1.0 -es=https://es01:9200 -kibana=http://kibana:5601 -u=elastic -p=seito123 -t user -f /mybackup/2024-07-18_user.json ` ` docker run -e PROGRAM=elastic_restore --network myelastic -v localdir:/mybackup --rm elasticbackup:1.0 -es=https://es01:9200 -kibana=https://localhost:5601 -u=elastic -p=seito123 -t watcher -f /mybackup/2024-07-18_watches.json `