使用Elasticsearch和docker-compose进行开发时的写法

docker-compose.yml 的中文释义是 “Docker 组合配置文件”。

version: '2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.4.1
    environment:
      - xpack.security.enabled=false
      - http.host=0.0.0.0
      - http.cors.enabled=true
      - http.cors.allow-origin=*
      - http.cors.allow-methods=*
      - http.cors.allow-headers=*
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    volumes:
      - ./esdata/:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300
  elasticsearch-head:
    image: mobz/elasticsearch-head:5
    ports:
      - 9100:9100

可以基于上述内容添加另一个服务。可能会有一些不必要的http.cors问题存在…

http://localhost:9100上已经包含了Elasticsearch-head。

使用 Circle CI 进行启动

由于无法更改vm.max_map_count的设置并出现错误,
在environment中添加以下内容。

      - transport.host=localhost
      - bootstrap.system_call_filter=false