Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.beta1 - Exception "path.home is not configured" when starting ES in transport and client mode #13155

Closed
stephanebastian opened this issue Aug 27, 2015 · 25 comments · Fixed by #13383

Comments

@stephanebastian
Copy link

Hi,
I just installed the new beta version 2.0.0-beta1 and ran some code that used to work with ES 1.7.0.
I got an exception where it complained that "path.home is not configured".
Is this something new? Why would I need to configure anything beside the cluster name in transport mode?

Thanks

Exception in thread "main" java.lang.IllegalStateException: path.home is not configured
    at org.elasticsearch.env.Environment.<init>(Environment.java:99)
    at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:97)
    at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:70)
    at org.elasticsearch.client.transport.TransportClient$Builder.build(TransportClient.java:114)
    at com.thesoftwarefactory.persistence.elasticsearch.DataConnection.open(DataConnection.java:62)
@stephanebastian stephanebastian changed the title Exception "path.home is not configured" when starting ES in transport and client mode 2.0.beta1 - Exception "path.home is not configured" when starting ES in transport and client mode Aug 28, 2015
@clintongormley
Copy link

Discussed this on FixItFriday. The client node is a real node, and should require everything that any other node requires. (Need to add docs for this).

The transport client should be light weight and shouldn't require any config etc. So let's not require path.home for the transport client, and not load any config by default. If the user needs to load a config file, then that should be explicitly specified.

@clintongormley clintongormley added help wanted adoptme and removed discuss labels Aug 28, 2015
@bleskes
Copy link
Contributor

bleskes commented Aug 28, 2015

as a temporary work around, if you are using the transport client, you can turn off config file loading by calling TransportClient.Builder#loadConfigSettings(false)

@bleskes
Copy link
Contributor

bleskes commented Aug 28, 2015

bleh, it turns out I was wrong. Disabling loading the config settings still results in the exception (we throw it before checking the settings). Sorry for the noise.

@kimchy
Copy link
Member

kimchy commented Sep 2, 2015

I chatted to @rjernst about it a bit, and he suggested something that I agree with. In the case of TransportClient, we can simply not bind or handle Environment. I like the simplicity of this approach, but we need to double check with our plugins to make sure that the ones that make sense in the context of a transport client will still work (/cc @jaymode).

There is a whole other question around Node(Client), but we should open a different issue where we properly define how things should work when "embedding" a Node.

@kimchy
Copy link
Member

kimchy commented Sep 2, 2015

@Andy-Peng service.bat should work unrelated to TransportClient, can you open a new issue with what fails for you in this context?

@rmuir
Copy link
Contributor

rmuir commented Sep 2, 2015

service.bat problems might be related to #13247

@clintongormley
Copy link

@rjernst are you working on this?

rjernst added a commit to rjernst/elasticsearch that referenced this issue Sep 8, 2015
Transport clients run embedded within external applications, so
elasticsearch should not be doing anything with the filesystem, as there
is not elasticsearch home.

This change makes a number of cleanups to the internal API for loading
settings and creating an environment. The loadFromConfig option was
removed, since it was always true except for tests. We now always
attempt to load settings from config a file when an environment is
created. The prepare methods were also simplified so there is now
prepareSettingsAndEnvironment which nodes use, and prepareSettings which
the transport client uses. I also attempted to improve the tests, but
there is a still a lot of follow up work to do there.

closes elastic#13155
@rjernst
Copy link
Member

rjernst commented Sep 8, 2015

@clintongormley I just opened a PR for this: #13383

@jaskmar
Copy link

jaskmar commented Sep 11, 2015

Is there any work around for this bug for now?
I have set .put("path.home", "/") but it is very, very ugly.

@sweetest
Copy link
Contributor

sweetest commented Nov 3, 2015

I'm still seeing this with elasticsearch 2.0.0, Mac OS Yosemite.

maven dependency

    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>2.0.0</version>
        <scope>compile</scope>
    </dependency>

code that triggers error

    node = NodeBuilder.nodeBuilder().data(true).settings(
            Settings.builder()
                    .put(ClusterName.SETTING, "test")
                    .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
                    .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
                    .put(EsExecutors.PROCESSORS, 1)
                    .put("index.store.type", "memory")
    ).build();

error stack trace

java.lang.IllegalStateException: path.home is not configured
at org.elasticsearch.env.Environment.<init>(Environment.java:99)
at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:82)
at org.elasticsearch.node.Node.<init>(Node.java:128)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)

@rjernst
Copy link
Member

rjernst commented Nov 3, 2015

@sweetest That is expected since you are starting a node. The PR that closed this removed the need for path.home to be specified for TransportClients. But any node needs to have path.home.

@jasontedor
Copy link
Member

NodeBuilder.nodeBuilder().data(true)

That's not building a client node, that's building a data node for which path.home must be configured (how else will the node know where to put its data?).

@jtal
Copy link

jtal commented Nov 6, 2015

how else will the node know where to put its data?

Doesnt it just use path.data to know where to put the data?

How does one set path.home? When I google it I just find this thread and the directory layout docs.

Also, I am trying to create a client node and get the same error.

nodeBuilder()
.settings(Settings.settingsBuilder().put("http.enabled", false))
.client(true)
.node();

Note: I am also trying to upgrade from 1.7.1 to 2.0.0.

@jasontedor
Copy link
Member

Doesnt it just use path.data to know where to put the data?

Yes, and by default that is ${path.home}/data.

Also, I am trying to create a client node and get the same error.

Are you sure that you're using the released version of Elasticsearch 2.0.0?

Note: I am also trying to upgrade from 1.7.1 to 2.0.0.

Can you give a small reproduction?

@hudsonb
Copy link

hudsonb commented Nov 6, 2015

I am having the same issue when creating a Node(Client):

NodeBuilder.nodeBuilder()
                    .settings(Settings.builder()
                                      .put("discovery.zen.ping.multicase.enabled")
                                      .put("discovery.zen.ping.unicast.hosts", hosts)
                                      .put("cluster.name", cluster)
                                      .put("node.name", nodeName)
                                      .build())
                    .client(true)
                    .node();

Results in "path.home is not configured"

@rjernst
Copy link
Member

rjernst commented Nov 6, 2015

Adding path.home when building a node would be done like this:

NodeBuilder.nodeBuilder()
    .settings(Settings.builder()
        .put("path.home", "/path/to/elasticsearch/home/dir")
    .node();

@jtal
Copy link

jtal commented Nov 6, 2015

Yes I'm fairly sure but is there a way I can have the client report what version it is from within the app?

Also, looking at the 2.0.0 source code constructor for Node (line 128) this happens:

    Environment tmpEnv = InternalSettingsPreparer.prepareEnvironment(pSettings, null);

Then Environment constructor requires path.home (line 96):

    if (settings.get("path.home") != null) {
        homeFile = PathUtils.get(cleanPath(settings.get("path.home")));
    } else {
        throw new IllegalStateException("path.home is not configured");
    }

Am I still misunderstanding something? If not, what should I set path.home to when I'm not storing data and how does one set path.home since its not in the client node doc example.

https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/node-client.html

Thank you.

Server:

10:01:27-jtal~/pkg/elasticsearch-2.0.0$ ps aux | grep elasticsearch
jtal 18858  0.0  0.0  15940   944 pts/7    S+   10:01   0:00 grep --color=auto elasticsearch
jtal 20994  0.5  1.0 6751776 340708 pts/10 Sl   Nov05   8:13 /home/jtal/pkg/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/home/jtal/pkg/elasticsearch-2.0.0 -cp /home/jtal/pkg/elasticsearch-2.0.0/lib/elasticsearch-2.0.0.jar:/home/jtal/pkg/elasticsearch-2.0.0/lib/* org.elasticsearch.bootstrap.Elasticsearch start -d

10:01:36-jtal~/pkg/elasticsearch-2.0.0$ sha1sum ~/pkg/elasticsearch-2.0.0.zip
13255b26a4d47d557a69fc85c24c117a1d9a33a5  /home/jtal/pkg/elasticsearch-2.0.0.zip

Client:

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  javaWs,
  "org.pac4j" % "play-pac4j_java" % "1.3.0",
  "org.pac4j" % "pac4j-cas" % "1.7.0",
  "org.elasticsearch" % "elasticsearch" % "2.0.0"
)

@dadoonet
Copy link
Member

dadoonet commented Nov 6, 2015

Yes the doc needs to be fix.

@rjernst
Copy link
Member

rjernst commented Nov 6, 2015

what should I set path.home to when I'm not storing data

Set it to any directory. If you are explicitly setting other dirs like path.logs, then nothing should be written to it.

@hrahal
Copy link

hrahal commented Nov 12, 2015

sudo chown -R elasticsearch:elasticsearch /var/lib/elasticsearch/

worked for me on ES 2.0.0

@zy840055899
Copy link

唉,还是没解决~

@jeyendranbalakrishnan
Copy link

Is there any fix for this? I am using the release version of elasticsearch 2.0.0 on my laptop, both for the running es server, and for the dependency in my source code where I use es as a client.
I set
path.home: ${ES_HOME}
in my src/main/resources/elasticsearch.yml config file, and set
ES_HOME=/path/to/my/es/install
in my environment.
But running my client code on the laptop still gives the same "path.home is not configured" exception.
Funnily. I don't have a path.home setting in my running server config file (${ES_HOME}/config/elasticsearch.yml.
However, this does not prevent the server from starting up and running properly, responding correctly to curl commands.

@selfchanger
Copy link

path.home is not configured
i also have this problem,for details see #15660
can someone help me?

@jianyuanzh
Copy link

I am new to ES, and I also faced this problem, any suggested solutions?

@selfchanger
Copy link

solution:
add "-Des.path.home=D:\elasticsearch-2.1.0" in your VM options,
see http://blog.csdn.net/jianjun200607/article/details/49821813#reply

EdgeCaseBerg added a commit to EdgeCaseBerg/elasticsearch-examples that referenced this issue Feb 9, 2016
The need for path.home to be configured is meh, it's documented in the
open issue on ES here:

	elastic/elasticsearch#13155

for now using UUID class to create a unique directory to store data in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.