docker 安装 elasticsearch 7.3.0

1:docker pull elasticsearch:7.3.0

如果报错可以用docker search elasticsearch

2:配置下es

创建目录/opt/data/es,然后创建2个子目录

[root@VM-0-12-centos es]# ls
conf  plugins

conf创建文件

内容如下:

elasticsearch.yml
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
cluster.initial_master_nodes: ["node-1"]

# ES-Head
http.cors.enabled: true  # 开启跨域
http.cors.allow-origin: "*"  # 允许跨域域名

[root@VM-0-12-centos conf]# ls
elasticsearch.yml
[root@VM-0-12-centos conf]# cat elasticsearch.yml
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
cluster.initial_master_nodes: ["node-1"]

# ES-Head
http.cors.enabled: true  # 开启跨域
http.cors.allow-origin: "*"  # 允许跨域域名

3:启动

docker run -di --name=ES-7.3.0 -p 9200:9200 -p 9300:9300  -v /opt/data/es/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /opt/data/es/plugins:/usr/share/elasticsearch/plugins elasticsearch:7.3.0 
 

4.测试

curl 127.0.0.1:9200
{
  "name" : "iZwz94zhiwnwqzf7b66yxqZ",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "ogMEZAA4Qcu_55ld9PLg7Q",
  "version" : {
    "number" : "7.3.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "de777fa",
    "build_date" : "2022-11-14T15:30:11.767338Z",
    "build_snapshot" : false,
    "lucene_version" : "8.1.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

猜你喜欢

转载自blog.csdn.net/wind520/article/details/127849432