container to backup your elasticserch database's to Microsoft Azure Storare.
To work with Azure Repository, the Azure Repository plugin from the official ES Repository Plugin home page is to be installed on the machine running Elasticsearch.
Please refer to the following documentations related to usage and settings as provided by Elasticsearch.
$CONTAINER
- Container name in azure$AZURE_STORAGE_ACCOUNT
- Name of Azure Storare Account$AZURE_STORAGE_ACCESS_KEY
- Acess Key for Storage Account$ELASTICSEARCH_PORT
- Port to connect with elasticsearch. default 3306$ELASTICSEARCH_HOST
- Host where elasticsearch is running$FILENAME
- Name to file in Azure Storage. Default namedefault-date +"%Y-%m-%d_%H-%M"
output exampledefault-2015-08-03_17-58
$ONE_SHOOT
- If true the container make the backup and exit, else the container still running and schedule a job in crontab. default false a backup window.$DEBUG
- If true will give you the value of all variables in terminal. default to false
docker run ---rm --name elasticsearch-backup \
-e "ONE_SHOOT=true" \
-e "FILENAME=backup"
-e "AZURE_STORAGE_ACCOUNT=teste-azure"
-e "AZURE_STORAGE_ACCESS_KEY=ashdgashdgasdsa--dadcdsfsd/sdfd--"
-e "CONTAINER=sql-backup" \
-e "ELASTICSEARCH_HOST=test.elasticsearch.com" \
alvyl/docker-elasticsearch-backup-azure
This will upload to Azure Storare a file named default-2018-06-07_12-19-29.tar.gz
and after that the
container will stop.
docker build -t alvyl/docker-elasticsearch-backup-azure .
NOTE: This code is tested in v2.4 and version - 6.3
-
For elasticsearch 2.4 version we have to install elasticsearch driver. Run the following command from the elastic search installation folder.
sudo bin/plugin install cloud-azure
-
To enable Azure repositories, you have first to set your azure storage settings in elasticsearch.yml file
cloud: azure: storage: my_account: account: your_azure_storage_account key: your_azure_storage_key
-
For latest es version, please refer to the official documentations.