dylanmei / docker-cerebro

A Docker build for Cerebro, an Elasticsearch web admin tool
0 stars 2 forks source link

Problem with accessing local elastic-search #1

Open Mxas opened 6 years ago

Mxas commented 6 years ago

maybe someone can comment or help: having a problem with local elastic-search installation. can not access elastic“search form docker-cerebro. May be my elastic search configuration problem...

Error connecting to [http://localhost:9200]

play.api.UnexpectedException: Unexpected exception[ConnectException: Connection refused: localhost/127.0.0.1:9200]
    at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:251)
    at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:180)
    at play.core.server.AkkaHttpServer$$anonfun$13$$anonfun$apply$1.applyOrElse(AkkaHttpServer.scala:251)
    at play.core.server.AkkaHttpServer$$anonfun$13$$anonfun$apply$1.applyOrElse(AkkaHttpServer.scala:250)
    at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:346)
Caused by: java.net.ConnectException: Connection refused: localhost/127.0.0.1:9200
    at play.shaded.ahc.org.asynchttpclient.netty.channel.NettyConnectListener.onFailure(NettyConnectListener.java:168)
    at play.shaded.ahc.org.asynchttpclient.netty.request.NettyChannelConnector$1.onFailure(NettyChannelConnector.java:103)
    at play.shaded.ahc.org.asynchttpclient.netty.SimpleChannelFutureListener.operationComplete(SimpleChannelFutureListener.java:28)
    at play.shaded.ahc.org.asynchttpclient.netty.SimpleChannelFutureListener.operationComplete(SimpleChannelFutureListener.java:20)
    at play.shaded.ahc.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:507)
Caused by: play.shaded.ahc.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:9200
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at play.shaded.ahc.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:259)
    at play.shaded.ahc.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:291)
    at play.shaded.ahc.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634)
Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at play.shaded.ahc.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:259)
    at play.shaded.ahc.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:291)
    at play.shaded.ahc.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634)

interesting thing is that if I lunch this application not from docker everything works fine

dylanmei commented 6 years ago

To the Cerebro container, address http//:localhost:9200 resolves to something else than if Cerebro was running together with Elasticsearch on your host machine. You need an address for your Elasticsearch that the container can resolve.

Docker Compose is such a nice tool because everything its running is on the same network.

version: "2"

services:
  elasticsearch:
    image: elasticsearch
    ports:
    - 9200:9200
  cerebro:
    image: dylanmei/cerebro
    ports:
    - 9000:9000
    command:
    - bin/cerebro
    - -Dhosts.0.host=http://elasticsearch:9200
Damaer commented 1 year ago

I have meet the same problem,have you solved it?