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

nc: bad address 'elasticsearch' #3

Open
psifertex opened this issue May 3, 2018 · 17 comments
Open

nc: bad address 'elasticsearch' #3

psifertex opened this issue May 3, 2018 · 17 comments

Comments

@psifertex
Copy link

psifertex commented May 3, 2018

When trying to docker-compose run according to the initial instruction setup.

I even tried adding elasticsearch to /etc/hosts for 127.0.0.1, but that didn't help either. Looks like it's actually a setting from within one of the instances?

For reference, I took a fresh AWS EC Linux 2 instance and:

sudo yum update
sudo yum install git
sudo yum install docker
sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
git clone https://github.com/dutchcoders/slackarchive-docker
cd slackarchive-docker #STEP IS MISSING FROM INSTRUCTIONS
cp slackarchive/config.yaml.sample slackarchive/config.yaml
cp slackarchive-bot/config.yaml.sample slackarchive-bot/config.yaml
vi -p */config.yaml #made up random values for bot: token that matched api-token updated tokens to contain the xoxp legacy slack token, changed the password for MONGO_INITDB_ROOT_PASSWORD though it's not clear if it needs to be changed elsewhere? made up random values for cookies: authentication_key and encryption_key
sudo service docker start #not in instructions, but possibly OS specific
sudo docker network create slackarchive
sudo /usr/local/bin/docker-compose run --rm wait_f_dependencies #where error occurs
@nl5887
Copy link
Member

nl5887 commented May 3, 2018

hmm, did you miss the create network step?

@psifertex
Copy link
Author

psifertex commented May 3, 2018

No, though I did leave it out in my script above. Edited to fix. Here's what happens when I try again:

sudo docker network create slackarchive
Error response from daemon: network with name slackarchive already exists

@psifertex
Copy link
Author

Unfortunately no.

I haven't been able to make any more progress. I might try again tonight using Ubuntu in case there's some distribution differences that impact things.

@ch4se
Copy link

ch4se commented May 4, 2018

Cool, I sent an email 👍

@nl5887
Copy link
Member

nl5887 commented May 4, 2018

docker network create slackarchive running multiple time gives that error because it already exists, and you only have to run that command once.

What version of docker are you running, and could you send your docker ps output? Bad address elasticsearch Elasticsearch isn't starting correctly. What do the Elasticsearch logs say?

@paulwilton
Copy link

paulwilton commented May 5, 2018

also get same error
followed instructions word for word including creating the docker network
nc: bad address 'elasticsearch'

installed on ubuntu 16.04 with latest docker-ce

@paulwilton
Copy link

paulwilton commented May 5, 2018

looks like this error occurs as ES fails to start
...error in docker logs from the ES container

[2018-05-05T15:37:46,926][INFO ][o.e.n.Node               ] [] initializing ...
[2018-05-05T15:37:46,953][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.4.jar:5.6.4]
Caused by: java.lang.IllegalStateException: Failed to create node environment
	at org.elasticsearch.node.Node.<init>(Node.java:268) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.4.jar:5.6.4]
	... 6 more
Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]
	at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:?]
	at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_141]
	at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_141]
	at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_141]
	at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:221) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.4.jar:5.6.4]

@paulwilton
Copy link

paulwilton commented May 5, 2018

this is due to the local volume mapped to ./elasticsearch/data , being given root permissions
if I change permissions of that dir to local user (in this case 'ubuntu') it works..

however getting memory issues with ES after this..
I also needed to set this :

sudo sysctl -w vm.max_map_count=262144

@nl5887
Copy link
Member

nl5887 commented May 5, 2018

Exactly, those are common issues when running Elasticsearch containers. The owner needs to be set to UID 1000 (this is the docker default user) and vm.max_map_count needs to be increased.

@paulwilton
Copy link

paulwilton commented May 7, 2018

@psifertex the nc: bad address 'elasticsearch' is almost certainly because ES has failed to start.
if you look at the docker logs for the ES container:
docker logs slackarchive-docker_elasticsearch_1
you will see (if and) why it has failed
in my case this was due to a disk/directory permissions issue.. once I had fixed the disk perms so the ES instance was able to read/wite to the local dir mapped to the ES docker volume, this all worked fine

@psifertex
Copy link
Author

#  Out of Memory Error (os_linux.cpp:2651), pid=1, tid=0x00007fafae3c8700
#
# JRE version:  (8.0_141-b16) (build )
# Java VM: OpenJDK 64-Bit Server VM (25.141-b16 mixed mode linux-amd64 compressed oops)
# Core dump written. Default location: /usr/share/elasticsearch/core or core.1

@psifertex
Copy link
Author

The VM I created only had 1GB ram total. Oh, looking through the config:

      - "ES_JAVA_OPTS=-Xms2048m -Xmx2048m"

So yeah, that won't work. Apparently no swap by default either.

Any reason performance would really be an issue for an instance only logging one slack? I might just crank down the java heap size and try that.

(AWS does have dedicated ES instances I could pop up as well that appear to run with 1gb of ram but then I'd have to re-configure the config to use that)

@paulwilton
Copy link

yeah Elastic recommend 4Gb ram for ES 5.x but it will run on less, but 1Gb I think way too small, especially if you running mongo and other containers on same instance
I used a t2.medium (2 cpu , 4Gb ram) - and it runs perfectly fine

@psifertex
Copy link
Author

AWS itself has a t2.micro.elasticsearchwith only 1gb of ram, so it certainly should be doable.

@ch4se
Copy link

ch4se commented May 10, 2018

I'm getting this issue now as well... Also using 2cpu 4gb ram.

@aeron7
Copy link

aeron7 commented Jul 9, 2018

[INFO ][o.e.n.Node               ] [] initializing ...
[2018-07-08T23:57:14,106][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.4.jar:5.6.4]
Caused by: java.lang.IllegalStateException: Failed to create node environment
        at org.elasticsearch.node.Node.<init>(Node.java:268) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.4.jar:5.6.4]
        ... 6 more
Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]
        at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:?]
        at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_141]
        at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_141]
        at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_141]
        at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:221) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.4.jar:5.6.4]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.4.jar:5.6.4]
        ... 6 more

This is I am getting running docker logs slackarchivedocker_elasticsearch_1
Using Ubuntu Xenial 4x89 64 bit Cores with 4GB Memory in scaleway and banging head since whole night lol

@aeron7
Copy link

aeron7 commented Jul 9, 2018

Just solved it with chown -R 1000:1000 elasticsearch if anyone is stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants