# Problem to set same path.data for Java client and elasticsearch service

**URL:** <https://discuss.elastic.co/t/problem-to-set-same-path-data-for-java-client-and-elasticsearch-service/12105>\
**Category:** Elasticsearch\
**Created:** [May 23, 2013, 10:15pm UTC](https://discuss.elastic.co/t/problem-to-set-same-path-data-for-java-client-and-elasticsearch-service/12105 "2013-05-23T22:15:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zoran\_Jeremic](https://avatars.discourse-cdn.com/v4/letter/z/7ba0ec/32.png) [@Zoran\_Jeremic](https://discuss.elastic.co/u/Zoran_Jeremic)\
**Post date:** [May 23, 2013, 10:15pm UTC](https://discuss.elastic.co/t/problem-to-set-same-path-data-for-java-client-and-elasticsearch-service/12105/1 "2013-05-23T22:15:14Z")

</div>

Hi,

I just started using elasticsearch in the java application and have a  
problem to configure path.data in elasticsearch.yml to point to the same  
location on my local PC. I created some simple inputs from the java  
application. I configured my client as given bellow:

ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();  
settings.put("path.home", "/home/zoran/elasticsearch");  
settings.put("cluster.name","elasticsearch");  
settings.put("node.name","movies");  
settings.put("index.number\_of\_replicas", 0);  
settings.put("index.number\_of\_shards", 1);

I'm trying to configure the same in elasticsearch server through the  
configuration file, so I can access data from the web browser restful  
client, but it fails to restart after I add  
path.data: /home/zoran/elasticsearch

I'm sure that there is not a problem in permission (it's 777). I have  
managed to make it start once, but it didn't point to the same directory as  
data inserted from the java application was available only from the java  
application.

Can you give me instructions what should I do here?

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:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 27, 2013, 6:25am UTC](https://discuss.elastic.co/t/problem-to-set-same-path-data-for-java-client-and-elasticsearch-service/12105/2 "2013-05-27T06:25:53Z")

</div>

Hey,

can you please paste the exception which occurs, I cannot imagine, that it  
just does not work.

Also see [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/setup/dir-layout/)  
Setting path.home might require some more directories to exist (with the  
correct permissions), please verify that.

--Alex

On Fri, May 24, 2013 at 12:15 AM, Zoran Jeremic [zoran.jeremic@gmail.com](mailto:zoran.jeremic@gmail.com)wrote:

> Hi,
> 
> I just started using elasticsearch in the java application and have a  
> problem to configure path.data in elasticsearch.yml to point to the same  
> location on my local PC. I created some simple inputs from the java  
> application. I configured my client as given bellow:
> 
> ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();  
> settings.put("path.home", "/home/zoran/elasticsearch");  
> settings.put("cluster.name","elasticsearch");  
> settings.put("node.name","movies");  
> settings.put("index.number\_of\_replicas", 0);  
> settings.put("index.number\_of\_shards", 1);
> 
> I'm trying to configure the same in elasticsearch server through the  
> configuration file, so I can access data from the web browser restful  
> client, but it fails to restart after I add  
> path.data: /home/zoran/elasticsearch
> 
> I'm sure that there is not a problem in permission (it's 777). I have  
> managed to make it start once, but it didn't point to the same directory as  
> data inserted from the java application was available only from the java  
> application.
> 
> Can you give me instructions what should I do here?
> 
> 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).

--  
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:** ![Zoran\_Jeremic](https://avatars.discourse-cdn.com/v4/letter/z/7ba0ec/32.png) [@Zoran\_Jeremic](https://discuss.elastic.co/u/Zoran_Jeremic)\
**Post date:** [May 27, 2013, 7:05pm UTC](https://discuss.elastic.co/t/problem-to-set-same-path-data-for-java-client-and-elasticsearch-service/12105/3 "2013-05-27T19:05:06Z")

</div>

Hi Alexander,

Thank you for your email. Here is the whole method I'm using to get the  
elasticsearch node:

ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();  
ElasticSearchConfig  
elasticSearchConfig=Settings.getInstance().config.elastiSearchConfig;  
String homePath=elasticSearchConfig.homePath; //homePath is set  
to /home/zoran/elasticsearch  
settings.put("cluster.name", elasticSearchConfig.clusterName);  
settings.put("path.conf", homePath);  
settings.put("path.data", homePath + "/data");  
settings.put("path.work", homePath + "/work");  
settings.put("path.logs", homePath + "/logs") ;  
settings.put("index.number\_of\_replicas",  
elasticSearchConfig.replicasNumber);  
settings.put("index.number\_of\_shards",  
elasticSearchConfig.shardsNumber);  
settings.build();

```
    Node node =

```

NodeBuilder.nodeBuilder().settings(settings).local(true).build().start();  
return node;

After I ran the java application and inserted couple of the documents, the  
data directory was created in elasticsearch directory which was empty  
before.  
As sudo I added 777 permissions on /home/zoran/elasticsearch and all  
subdirectories.  
Furthermore, in /etc/elasticsearch/elasticsearch.yml I uncommented line:

path.data: /home/zoran/elasticsearch/data

after elasticsearch restart I had

- Stopping Elasticsearch  
Server [ OK  
]
- Starting Elasticsearch  
Server [fail]

There is no exception I can paste here. In elasticsearch.log this is the  
whole log I have:

[2013-05-27 09:35:51,035][INFO][node] [movies]  
{0.90.0}[2107]: initializing ...  
[2013-05-27 09:35:51,040][INFO][plugins] [movies] loaded  
, sites   
[2013-05-27 09:35:52,885][INFO][node] [movies]  
{0.90.0}[2107]: initialized  
[2013-05-27 09:35:52,885][INFO][node] [movies]  
{0.90.0}[2107]: starting ...  
[2013-05-27 09:35:52,972][INFO][transport] [movies]  
bound\_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish\_address {inet[/  
192.168.0.23:9300]}  
[2013-05-27 09:35:55,994][INFO][cluster.service] [movies]  
new\_master [movies][gHSsdNzqSU-0BZH\_8C5HEQ][inet[/192.168.0.23:9300]],  
reason: zen-disco-join (elected\_as\_master)  
[2013-05-27 09:35:56,016][INFO][discovery] [movies]  
elasticsearch/gHSsdNzqSU-0BZH\_8C5HEQ  
[2013-05-27 09:35:56,028][INFO][http] [movies]  
bound\_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish\_address {inet[/  
192.168.0.23:9200]}  
[2013-05-27 09:35:56,028][INFO][node] [movies]  
{0.90.0}[2107]: started  
[2013-05-27 09:35:56,642][INFO][gateway] [movies]  
recovered [1] indices into cluster\_state  
[2013-05-27 11:49:31,244][INFO][node] [movies]  
{0.90.0}[2107]: stopping ...  
[2013-05-27 11:49:31,290][INFO][node] [movies]  
{0.90.0}[2107]: stopped  
[2013-05-27 11:49:31,290][INFO][node] [movies]  
{0.90.0}[2107]: closing ...  
[2013-05-27 11:49:31,299][INFO][node] [movies]  
{0.90.0}[2107]: closed

Do you have any idea, what could be the problem?

Thanks

On Sun, May 26, 2013 at 11:25 PM, Alexander Reelsen [alr@spinscale.de](mailto:alr@spinscale.de)wrote:

> Hey,
> 
> can you please paste the exception which occurs, I cannot imagine, that it  
> just does not work.
> 
> Also see [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/setup/dir-layout/)  
> Setting path.home might require some more directories to exist (with the  
> correct permissions), please verify that.
> 
> --Alex
> 
> On Fri, May 24, 2013 at 12:15 AM, Zoran Jeremic [zoran.jeremic@gmail.com](mailto:zoran.jeremic@gmail.com)wrote:
> 
> > Hi,
> > 
> > I just started using elasticsearch in the java application and have a  
> > problem to configure path.data in elasticsearch.yml to point to the same  
> > location on my local PC. I created some simple inputs from the java  
> > application. I configured my client as given bellow:
> > 
> > ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();  
> > settings.put("path.home", "/home/zoran/elasticsearch");  
> > settings.put("cluster.name","elasticsearch");  
> > settings.put("node.name","movies");  
> > settings.put("index.number\_of\_replicas", 0);  
> > settings.put("index.number\_of\_shards", 1);
> > 
> > I'm trying to configure the same in elasticsearch server through the  
> > configuration file, so I can access data from the web browser restful  
> > client, but it fails to restart after I add  
> > path.data: /home/zoran/elasticsearch
> > 
> > I'm sure that there is not a problem in permission (it's 777). I have  
> > managed to make it start once, but it didn't point to the same directory as  
> > data inserted from the java application was available only from the java  
> > application.
> > 
> > Can you give me instructions what should I do here?
> > 
> > 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).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/J2aeOjHuMk8/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/J2aeOjHuMk8/unsubscribe?hl=en-US)  
> .  
> To unsubscribe from this group and all its topics, 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).

--

* * *

Zoran Jeremic, PhD  
Postdoctoral Fellow

Ryerson University, Toronto  
Tel: +1 604 92 89 944  
E-mail: [zoran.jeremic@gmail.com](mailto:zoran.jeremic@gmail.com) [zoran.jeremic@va.mod.gov.rs](mailto:zoran.jeremic@va.mod.gov.rs)  
Homepage: [http://zoranjeremic.org](http://zoranjeremic.org)

* * *

--  
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:34am UTC](https://discuss.elastic.co/t/problem-to-set-same-path-data-for-java-client-and-elasticsearch-service/12105/4 "2017-07-06T02:34:30Z")

</div>


