# How to use local gateway

**URL:** <https://discuss.elastic.co/t/how-to-use-local-gateway/9316>\
**Category:** Elasticsearch\
**Created:** [October 11, 2012, 8:30am UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316 "2012-10-11T08:30:48Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![bing\_2](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@bing\_2](https://discuss.elastic.co/u/bing_2)\
**Post date:** [October 11, 2012, 8:30am UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/1 "2012-10-11T08:30:48Z")

</div>

I study local gateway for two days, but still don't know how to use it  
Can somebody explain it to me?  
My question is :  
1 where are data of local gateway put? how to generate data of gateway  
2 how can I simulate a case to recover cluster based on data of local  
gateway

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [October 15, 2012, 1:23pm UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/2 "2012-10-15T13:23:06Z")

</div>

Local gateway is the default, so you don't need to do anything special to  
use it.

By default, your data is stored in /var/lib/elasticsearch/, if you use the  
Debian package. You can change that by starting ES with something like  
-Des.default.path.data=/my/data/path. If you use the Debian package, you  
can simply change /etc/init.d/elasticsearch where it says:

# Elasticsearch data directory

DATA\_DIR=/var/lib/$NAME

Otherwise, you can add something like this to bin/elasticsearch.in.sh  
JAVA\_OPTS="$JAVA\_OPTS -Des.default.path.data=/my/data/path"

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Thursday, October 11, 2012 11:30:48 AM UTC+3, bing wrote:

> I study local gateway for two days, but still don't know how to use it  
> Can somebody explain it to me?  
> My question is :  
> 1 where are data of local gateway put? how to generate data of gateway  
> 2 how can I simulate a case to recover cluster based on data of local  
> gateway

--

---

<div class="post-metadata">

**Author:** ![Munna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/munna/32/1841_2.png) [@Munna](https://discuss.elastic.co/u/Munna)\
**Post date:** [March 14, 2013, 2:46pm UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/3 "2013-03-14T14:46:21Z")

</div>

So, you are saying that, the data directory is also the local gateway (aka backup) from where we can restore the node/cluster?

If it is true, if we lose the data dir for any reason, we lose the backup too.

Is my understanding correct?

Thanks,  
Lollypop

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [March 15, 2013, 1:05pm UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/4 "2013-03-15T13:05:27Z")

</div>

Hello,

On Thu, Mar 14, 2013 at 4:46 PM, lollypop [ahaduzzaman.munna@gmail.com](mailto:ahaduzzaman.munna@gmail.com)wrote:

> So, you are saying that, the data directory is also the local gateway (aka  
> backup) from where we can restore the node/cluster?

Yes.

> If it is true, if we lose the data dir for any reason, we lose the backup  
> too.
> 
> Is my understanding correct?

Yes. Although if you have replicas, the nodes holding those replicas will  
also have a copy of that data in their own data directory.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Munna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/munna/32/1841_2.png) [@Munna](https://discuss.elastic.co/u/Munna)\
**Post date:** [March 19, 2013, 4:07am UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/5 "2013-03-19T04:07:20Z")

</div>

Thanks Radu for the reply. Here are few thoughts of mine regarding backup and restore.  
When for a given shard all replicas are gone (multiple node failure scenario), we lose the data of that shard and for sure, elasticsearch cluster health will turn into red from green.  
So, we definitely need to have some sort of external backup of the data of each node.

A simple solution (considering AWS) would be attaching an EBS volume to each node automatically by cloudformation when the cluster spins up. Then do rsync from the data dir ( $ES\_HOME/data) to the EBS volume. "rsync" will have two steps. In first step, we do rsync without disabling flush. In second step, we disable flush and do rsync again. The idea is that, the first step may take a while and so we dont want to disable flush for that long time, rather we want to rsync whatever we can. In the second step, rsync should not take that long and therefore its ok to disable flush. Then we take some periodical snapshots, lets say nightly snapshot of these EBS volumes to S3.

As per AWS mechanism, if an EBS volume was attached to a node by cloudformation, the EBS volume will be destroyed if the node is terminated by some reason (e.g. autoscaling) which is actually great for not flooding our AWS account with unused EBS volumes. So, by autoscaling a new node will come up and in the similar fashion a new EBS volume will be attached to the node by cloudformation.

For restore, we will use these EBS nightly snapshots to tackle failure scenarios such as "all replicas are gone for a given shard", "the whole cluster is gone", "data center is destroyed", etc. The restoration process is pretty straightforward, so I am not going into detail for that.

Hope Elasticsearch will come up with a robust backup solution really soon.

Thanks again.  
Lollypop.

---

<div class="post-metadata">

**Author:** ![James\_Cook\_3](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@James\_Cook\_3](https://discuss.elastic.co/u/James_Cook_3)\
**Post date:** [March 30, 2013, 12:44pm UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/6 "2013-03-30T12:44:17Z")

</div>

Or we convince the ES team to not deprecate the S3 gateway because it provides a much needed service perfectly fine for some users. I've been using it as a backup solution since 2010.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 30, 2013, 12:46pm UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/7 "2013-03-30T12:46:24Z")

</div>

On Sat, 2013-03-30 at 05:44 -0700, James Cook wrote:

> Or we convince the ES team to not deprecate the S3 gateway because it  
> provides a much needed service perfectly fine for some users. I've  
> been using it as a backup solution since 2010.

If you like that, then you'll love this 😉

The backup solution that is coming will knock the socks off the existing  
S3 gateway. You'll be pleased we did it.

clint

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Munna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/munna/32/1841_2.png) [@Munna](https://discuss.elastic.co/u/Munna)\
**Post date:** [April 6, 2013, 4:07am UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/8 "2013-04-06T04:07:31Z")

</div>

When is it coming? Please share that with us. That will save us time, money from building ES backup and restore solution.

---

<div class="post-metadata">

**Author:** ![fonzo14](https://avatars.discourse-cdn.com/v4/letter/f/898d66/32.png) [@fonzo14](https://discuss.elastic.co/u/fonzo14)\
**Post date:** [April 7, 2013, 11:39am UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/9 "2013-04-07T11:39:13Z")

</div>

I'm very interested too to know more about the new backup solution (and the  
release date ;-)).

I have to set up a cluster soon and what bothers me the most is the "data  
backup/restore"

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![karmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karmi/32/44951_2.png) [@karmi](https://discuss.elastic.co/u/karmi)\
**Post date:** [April 8, 2013, 7:32am UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/10 "2013-04-08T07:32:23Z")

</div>

> A simple solution (considering AWS) would be attaching an EBS volume to  
> each  
> node automatically by cloudformation when the cluster spins up. (...) Then  
> we take some periodical snapshots, lets say nightly snapshot of these EBS  
> volumes to S3.

Just a note, with EBS volumes, it shouldn't be neccessary to disable flush,  
as you can do a "point-in-time" snapshot.

> As per AWS mechanism, if an EBS volume was attached to a node by  
> cloudformation, the EBS volume will be destroyed if the node is terminated  
> by some reason (e.g. autoscaling) which is actually great (...)

If you're OK with using EBS volumes for data persistence, it's surprising  
to describe this behaviour as "great"; It's precisely the fact that they  
survice instances which makes them attractive. You can create a snapshot  
periodically as a backup, and when you want to restore, you just create a  
volume from the snapshot. You can detach/attach the volume to different  
instance, etc.

Karel

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:42am UTC](https://discuss.elastic.co/t/how-to-use-local-gateway/9316/11 "2017-07-06T02:42:17Z")

</div>


