Configuring a File System Repository
To configure a file system repository
1. On each node in your external Elasticsearch cluster, update the path.repo property in elasticsearch.yml file to point to a shared directory.
Sample code to add the path.repo property is as follows:
path.repo: ["/shared/BACKUP"]
This allows external Elasticsearch to use the specified folder for backup repositories. Ensure the path is accessible and has the correct permissions for all nodes in the cluster.
2. After updating the elasticsearch.yml file, restart external Elasticsearch on each node for the changes to take effect.
3. Create the backup repository using the external Elasticsearch API.
A sample command to create the backup respository is as follows:
curl -si -X POST -H "content-type:application/json" -d '{"type": "fs", "settings": {"compress": "true", "location": "/shared/BACKUP/repo-name"}}' http://es-host:es-port/_snapshot/repo-name
In this command:
Replace
repo-name with the name you want to give to your backup repository. For example, myrepo.
Replace
es-host and
es-port with the hostname and port of your external Elasticsearch cluster.
"type": "fs" specifies that the repository type is a file system repository.
"compress": true indicates whether to compress the backup files or not. Set to
true if you want compression.
"location" specifies the path where the backups are stored. Replace
repo-name with the name of your repository.
External Elasticsearch creates a backup repository with the specified settings. The backup repository is used as the backup destination for creating
API Gateway backups. For more information about creating cloud storage repositories, see
Elasticsearch documentation.
4. Optional. Run the following command to list all the backup repositories and verify whether the repository you created appears in the list:
curl -s -X GET http://es-host:es-port/_snapshot/_all
In this command, replace es-host and es-port with the hostname and port of your external Elasticsearch cluster.
5. Optional. Run the following command to delete a repository:
curl -si -X DELETE http://es-host:es-port/_snapshot/repo-name
In this command, replace es-host and es-port with the hostname and port of your external Elasticsearch cluster. Replace repo-name with the name of your repository.