If user configure scheduler to run every month and expiry period is one year then, it creates a file with copy of all the expired notification histories (1 year old) and delete them from the Elastic Search database every month.
To configure scheduler for archiving Notification:
Procedure
- Create an NFS Shared folder (in any of the 3 ES clusters or any other server), and run below command in all machines:
yum install nfs-utils nfs-utils-lib
create the folder to be shared across cluster in any machine
Ex: mkdir /var/unixmen_share/
sudo chown -R elasticsearch:elasticsearch /var/unixmen_share
edit /etc/exports in the vm from where above folder will be shared
/var/unixmen_share/ <Cluster1 IP>(rw,sync,no_root_squash,no_all_squash)
/var/unixmen_share/ <Cluster 2(rw,sync,no_root_squash,no_all_squash)
service nfs start
Go to all cluster machines and run below command
mount -t nfs <nfs_server>:/var/unixmen_share/ /var/unixmen_share/
- All Elastic Search cluster nodes must have access to the shared folder to write data into folder.
- Verify group id and userid are same for elastic search across clusters, by invoking the below command
less /etc/passwd | grep elastic search
- Add repo in the eventstore.properties configuration file:
Stop cluster
add below in all cluster nodes /etc/elasticsearch/config/elasticsearch.yml
path.repo: ["/var/unixmen_share/"]
start the cluster
- Create a repo in cluster:
PUT http://<<Any ES Cluster IP>>:9200/_snapshot/<<repo_name>>
{
"type": "fs",
"settings": {
"location": "/var/unixmen_share/backup_location",
"compress": true
}
}
- Configure repo, time of expiry and scheduler time period in:
// Valid time units are "ns", "ms", "s", "m", "h".
POST http://<<EPS_Server>>:<<EPS port>>:9090/eps/refresh
{
"doc": {
"purging-scheduler-TimeInterval": "24h",
"purgingTimeLimit": "now-1y-0M-0d",
"esdb-repo": "smarts-repo"
}
}
- Restart Eventstore.
Note: If esdb-repo is not configured, then it will delete one year old notifications from esdb no backup will be taken.
- Check Snapshots are getting created using below API:
GET http://<<Any ES Cluster IP>>:9200/_cat/snapshots/ <<repo_name>>
- To delete snapshots from repo, run below REST API:
DELETE http://<<Any_ES_Cluster_IP>>:9200/_snapshot/<<repo_name>>/<<snapshot_name>>