docker安装elasticSearch的初步配置

拉取ElasticSearch镜像 此处以6.7.1版本为例子

docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.2

运行容器
把容器命名为es,-p 端口映射到宿主机,此处使用单例模式

docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.7.1

配置跨域

docker exec -it es /bin/bash
进入config/目录下修改elasticsearch.yml
vi config/elasticsearch.yml
# 加入跨域配置
http.cors.enabled: true
http.cors.allow-origin: "*"

退出镜像并重启镜像

docker restart es 

在宿主机浏览器输入 127.0.0.1:9200即可看到对应信息

{
  "name" : "zvVF2s0",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "LN9JZJQiTNC_jMmD9I_NQQ",
  "version" : {
    "number" : "6.7.1",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "2f32220",
    "build_date" : "2019-04-02T15:59:27.961366Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

你可能感兴趣的:(docker安装elasticSearch的初步配置)