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
Export the hostname as environment variable #9474
Conversation
Hi @AndreKR Thanks for the PR. The only bit I'm not sure about is adding it to the config file, because using the hostname there can be problematic if you run more than one ES instance on the same node. Perhaps it should be added to the reference docs instead, with the appropriate warning: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/setup-configuration.html#node-name |
Done. |
@@ -33,6 +33,9 @@ FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO ( | |||
) | |||
) | |||
|
|||
set HOSTNAME= | |||
for /f "delims=" %%a in ('hostname') do @set HOSTNAME=%%a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please set instructions in uppercase to stick with the rest of the file?
Also, I'm not sure this works on older Windows like XP. Do you think you can get it work on it? That would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndreKR Thanks for your contribution. I made some comments. Can you also please squash all the commits together? Thanks. |
f64e09c
to
8e0d753
Compare
Done. |
I just tested on Windows XP and unfortunately it does not work and prevents Elasticsearch from starting. I think it can be fixed like this:
What do you think? Does it work on your platforms? |
2d91501
to
3a4d3d9
Compare
Ok, I looked into the issue and indeed on Windows XP it didn't work, even though on Windows 2000 and Windows 7 it did. The actual problem were the missing quotes, with them it works on all three platforms. I pushed the change (and rebased the branch). |
@tlrx please could you take a look |
@AndreKR it takes some time but be sure that I'd like to merge this pull request :) Have you considered using %COMPUTERNAME% variable instead of hostname? Do you think it's better? |
By using %COMPUTERNAME%, are you trying to solve a specific problem or just considering it as a cleaner approach? Honestly, I hadn't considered that, because I implemented the Linux variant first and then just looked into a parallel approach for Windows. |
Just a cleaner approach since
Copying it into Thanks for making this change! I'll test it again and merge the pr. |
3a4d3d9
to
c107f0b
Compare
Changed. |
Export the hostname as environment variable
I should have done this while merging #9474.
In elastic#9474, we exported the hostname in the bin/elasticsearch scripts so that it could be used as a variable in the elasticsearch.yml file but did not do the same for plugin manager. When using the hostname variable in elasticsearch.yml and trying to use the plugin manager, initialization will fail because the property could not be resolved. This change will allow the hostname to be resolved in the same manner as the service scripts. Closes elastic#10902
In elastic#9474, we exported the hostname in the bin/elasticsearch scripts so that it could be used as a variable in the elasticsearch.yml file but did not do the same for plugin manager. When using the hostname variable in elasticsearch.yml and trying to use the plugin manager, initialization will fail because the property could not be resolved. This change will allow the hostname to be resolved in the same manner as the service scripts. Closes elastic#10902
In #9474, we exported the hostname in the bin/elasticsearch scripts so that it could be used as a variable in the elasticsearch.yml file but did not do the same for plugin manager. When using the hostname variable in elasticsearch.yml and trying to use the plugin manager, initialization will fail because the property could not be resolved. This change will allow the hostname to be resolved in the same manner as the service scripts. Closes #10902
awesome thanks for fixing! |
and provide an example on how to use it in the config
Closes #8470