无法使用docker中的不同端口将kibana连接到elasticsearch

lrl1mhuk  于 2021-06-10  发布在  ElasticSearch
关注(0)|答案(1)|浏览(514)

我无法将kibana连接到正在docker的其他端口中运行的elasticsearch。这是我的docker文件:

version: '3.2'
services:
  elasticsearch_new_1:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
    container_name: elasticsearch_new_1
    environment:
      - node.name=kw-new
      - cluster.name=kw-new
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - elasticsearch_new_1:/usr/share/elasticsearch/data
    ports:
      - 9299:9200
      - 9399:9300
    networks:
      - elastic

  kibana_2:
    image: docker.elastic.co/kibana/kibana:7.6.2
    container_name: kibana_2
    environment:
      - SERVER_NAME=KW_Kibana
      - ELASTICSEARCH_HOSTS=http://elasticsearch_new_1:9299
    ports:
      - 5601:5601
    links:
      - elasticsearch_new_1
    networks:
      - elastic
    depends_on:
      - elasticsearch_new_1

volumes:
  es:
    driver: local
  db:
    driver: local
  elasticsearch_new_1:
    driver: local

networks:
  elastic:
    driver: bridge

当elasticsearch在端口9200中运行时,它运行良好。我尝试过创建kibana.yml,但它没有改变任何事情。在elasticsearch中,出现以下错误消息:

["java.lang.IllegalStateException: Received message from unsupported version: [1.0.0] minimal compatible version is: [6.8.0]",
        elasticsearch_new_1    | "at org.elasticsearch.transport.InboundMessage.ensureVersionCompatibility(InboundMessage.java:152) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.InboundMessage.access$000(InboundMessage.java:37) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.InboundMessage$Reader.deserialize(InboundMessage.java:70) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.InboundHandler.messageReceived(InboundHandler.java:114) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.InboundHandler.inboundMessage(InboundHandler.java:103) ~[elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.TcpTransport.inboundMessage(TcpTransport.java:667) [elasticsearch-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:62) [transport-netty4-client-7.6.2.jar:7.6.2]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:326) [netty-codec-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:300) [netty-codec-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:241) [netty-handler-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:600) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:554) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [netty-transport-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050) [netty-common-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.43.Final.jar:4.1.43.Final]",
    elasticsearch_new_1    | "at java.lang.Thread.run(Thread.java:830) [?:?]"] }

根据以下消息:当elasticsearch在9200端口运行时,kibana正在使用客户端1.0.0

["java.lang.IllegalStateException: Received message from unsupported version: [1.0.0] minimal compatible version is: [6.8.0]",

elasticsearch在localhost:9299
有人知道吗?
谢谢

qqrboqgw

qqrboqgw1#

我通过环境改变了elasticsearch的端口,我的意思是我已经改变了elasticsearch容器的端口号。以下是最重要的变化: http.port=9201-9301 在环境中 9201:9201 以及 9301:9301 在港口。
完整docker-compose.yml:

version: '3.2'
services:
  elasticsearch_new_1:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
    container_name: elasticsearch_new_1
    environment:
      - node.name=kw-new
      - cluster.name=kw-new
      - discovery.type=single-node
      - http.port=9201-9301
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - elasticsearch_new_1:/usr/share/elasticsearch/data
    ports:
      - 9201:9201
      - 9301:9301
    networks:
      - elastic

  kibana_2:
    image: docker.elastic.co/kibana/kibana:7.6.2
    container_name: kibana_2
    environment:
      - SERVER_NAME=KW_Kibana
      - ELASTICSEARCH_HOSTS=http://elasticsearch_new_1:9201
    ports:
      - 5601:5601
    links:
      - elasticsearch_new_1
    networks:
      - elastic
    depends_on:
      - elasticsearch_new_1

volumes:
  es:
    driver: local
  db:
    driver: local
  elasticsearch_new_1:
    driver: local

networks:
  elastic:
    driver: bridge

相关问题