2017-03-04 100 views
0

我正嘗試使用docker容器創建彈性搜索安裝。 我只使用elastic.io提供商的圖像。彈性搜索+ LogStash無法連接

我在啓動logstash實例時遇到錯誤。

這裏是我的配置:

泊塢窗,compose.yml

 
version: '2' 
services: 
    elasticsearch1: 
    image: docker.elastic.co/elasticsearch/elasticsearch:5.2.2 
    container_name: elasticsearch1 
    environment: 
     - cluster.name=docker-cluster 
     - bootstrap.memory_lock=true 
     - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 
    ulimits: 
     memlock: 
     soft: -1 
     hard: -1 
     nofile: 
     soft: 65536 
     hard: 65536 
    mem_limit: 1g 
    cap_add: 
     - IPC_LOCK 
    volumes: 
     - esdata1:/usr/share/elasticsearch/data 
    networks: 
     - esnet 
    elasticsearch2: 
    image: docker.elastic.co/elasticsearch/elasticsearch:5.2.2 
    container_name: elasticsearch2 
    environment: 
     - cluster.name=docker-cluster 
     - bootstrap.memory_lock=true 
     - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 
     - "discovery.zen.ping.unicast.hosts=elasticsearch1" 
    ulimits: 
     memlock: 
     soft: -1 
     hard: -1 
     nofile: 
     soft: 65536 
     hard: 65536 
    mem_limit: 1g 
    cap_add: 
     - IPC_LOCK 
    volumes: 
     - esdata2:/usr/share/elasticsearch/data 
    networks: 
     - esnet 

    logstash: 
    image: docker.elastic.co/logstash/logstash:5.2.2 
    container_name: logstash 
    mem_limit: 1g 
    links: 
     - elasticsearch1:elasticsearch 
    volumes: 
     - ./logstash.yml:/usr/share/logstash/config/logstash.yml 

volumes: 
    esdata1: 
    driver: local 
    esdata2: 
    driver: local 

networks: 
    esnet: 
    driver: bridge 

的,現在我logstash.yml

 
node: 
    name: 'default logstash' 
http: 
    host: elasticsearch 
pipeline: 
    workers: 1 
    batch: 
    size: 12 
    delay: 5 
log: 
    level: 'debug' 

我不知道WY但logstash告訴我他無法連接到帶有此錯誤消息的ElasticSearch實例:

 
... 
[DEBUG][logstash.runner] *http.host: "elasticsearch" (default: "127.0.0.1") 
... 
[DEBUG][logstash.outputs.elasticsearch] config LogStash::Ouputs::ElasticSearch/@hosts = [http://localhost:9200] 
[INFO][logstash.ouputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>:removed>[], :added=>[logstash_system:[email protected]:9200/_xpack/monitoring/?system_id=logstash&system_api_version=2&interval=1s]}} 

有人可以告訴我爲什麼logstash使用不好的主機事件,如果他真的有我的設置?

謝謝。

問候

+0

您是否嘗試通過端口9200上的HTTP請求訪問elasticsearch節點? – Adonis

+0

Logstash似乎並未指向elasticsearh事件。不是溝通問題? –

回答

0

我找到了一個解決方案,通過一個logstash.conf文件替換我logstash.yml:

 

    input { 
     stdin { } 
     beats { 
     port => 5044 
     } 
    } 

    output { 
     elasticsearch { 
     hosts => [ 'elasticsearch' ] 
     user  => 'elastic' 
     password => 'changeme' 
     } 
    } 

最後,我改變我的搬運工,撰寫文件鏈接此文件CONF:

 

    volumes: 
     - ./logstash-pipeline/:/usr/share/logstash/pipeline/ 

+0

請讓我知道是否需要在Logstash端(版本5.6.5)安裝任何XPack以進行此類基本身份驗證。我將要使用的Elasticsearch服務器似乎以某種方式新增了這樣的基本認證,我現在應該在Logstash結束時使用這種認證。 – Loganathan