Tool for Elasticsearch snapshot creation and rotation.
Project description
essnapshot
installation
globally used python >= 3.6
pip install essnapshot
python2 and python >= 3.6 installed at the same time
pip3 install essnapshot
current state
The goal is to deliver a snapshot rotation tool for elasticsearch snapshots. The functionality should be rather simple as most of it is already implemented in ES.
So I just stick to creating a repository, create snapshots within it and delete old ones.
I assume that most people will use cron
to call this script, so no daemon functionality
or similar will be implemented.
The tool is not built to monitor the successfull write to disk of your snapshots.
You have to monitor the STATE
of the snapshots yourself.
At the Moment only Python 3.6, 3.7 and 3.8 are supported. Support for older Python versions is not planned at the moment.
usage/configuration
At the moment the tool supports only one parameter (excecpt for help):
Usage: cli.py [options]
Options:
-h, --help show this help message and exit
-c FILE, --config=FILE
Path to configuration file. See example and
documentation at https://github.com/gricertg/essnapshot
You must provide a yaml
configuration file like this:
---
es_connections:
- host: 'localhost'
port: 9200
repository_name: 'essnapshot'
repository:
type: 'fs'
settings:
location: '/mnt/snapshot'
compress: 'true'
retention_time: '7d'
The parameters should be self explanatory (if you're familiar with ES).
A short help to get you started with the main parameters:
es_connections
A list(array) of hashes(dictionaries) to which ES can connect to.
To understand how this works see the Elasticsearch API documentation.
Each Host is a Dictionary
in the List
.
The Options per Host are the ones for Urllib3HttpConnection
s.
See Connection in the API documentation.
Here you can configre authentication too.
Please ensure that this configuration file can only be read by the user/container designated for the backup if you put any credentials in this configuration file (and please don't put it into a public git repository).
repository_name
This is the name of the repository which will be created and the snapshots created in.
repository
This represents the configuration of the ES repository. It's a representation of the JSON sent to ES and is described in the ES documentation in Register a snapshot repository.
retention_time
The maximum backup age before snapshots will be deleted.
execution
The script is intended to run at regular intervals via cron
. I recommend to created a
dedicated user for the snapshots and that only this user can access the configuration file.
A crontab entry for this user could look like this:
4 1 * * * essnapshot > /dev/null
STDOUT is suppressed. If any error occurs the error message will be sent via mail to the snapshot user (depending on your configuration of the system).
development
- the feature set should be kept small
- the project should have a high test coverage (there is still room to improve it!)
- try to hold on to styleguides and improve code quality
You need poetry and docker (for tests) installed.
Necessary improvements and development steps should be documentated as github issues.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file essnapshot-0.1.1.tar.gz
.
File metadata
- Download URL: essnapshot-0.1.1.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.2 Linux/5.15.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce20bb420eb1fd9659b2f6fb59e727d0c80e6ce313ab2d73025c89b7faf1d105 |
|
MD5 | 527e74cee8b3233050710e97e5029b2b |
|
BLAKE2b-256 | 8dc07066ba31fca51fbe53de00be8d1b8f76bd0922793f1b9cb9c185e366e525 |
File details
Details for the file essnapshot-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: essnapshot-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.2 Linux/5.15.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52b623f28be69d55762a77df4b6b34ddcd8d7df7c2aaba85ad09092806755886 |
|
MD5 | 641d4b5b550116ed02abdfba8ed82b5a |
|
BLAKE2b-256 | 4fe58bdb5e752342ff66e65de036ff5fc10fefe306cf6ca846fce700f987fead |