简介
Elasticsearch 是一个建立在全文搜索引擎 Apache Lucene(TM) 基础上的搜索引擎,可以说 Lucene 是当今最先进,最高效的全功能开源搜索引擎框架。
环境安装配置
下载
Docker安装
拉取镜像
[root@localhost network-scripts]# docker pull elasticsearch:7.12.1 7.12.1: Pulling from library/elasticsearch 7a0437f04f83: Pull complete ed4a47ec20b2: Pull complete 74e4f4b7e738: Pull complete ef2a2418a5f4: Pull complete 646dbf47f747: Pull complete 3ffbf21442fc: Pull complete e04f00c0d464: Pull complete Digest: sha256:622f854572780281bc85b5fde33be27e99670941ed8b7eea5ba4aaf533fa64ec Status: Downloaded newer image for elasticsearch:7.12.1 docker.io/library/elasticsearch:7.12.1
创建目录
[root@localhost service]# mkdir -p /home/service/elasticsearch [root@localhost elasticsearch]# mkdir -p{config,data,plugins}
创建临时容器
[root@localhost config]# docker run --name elasticsearch -d -e ES_JAVA_OPTS="-Xms128m -Xmx512m" -e "discovery.type=single-node" -p 9200:9200 -p 9300:9300 elasticsearch:7.12.1
复制配置文件
[root@localhost config]# docker cp elasticsearch:/usr/share/elasticsearch/config/elasticsearch.yml /home/service/elasticsearch/config
删除容器
[root@localhost config]# docker stop elasticsearch elasticsearch [root@localhost config]# docker rm elasticsearch elasticsearch
启动ES
[root@localhost config]# docker run -d \ --name elasticsearch \ -p 9200:9200 \ -p 9300:9300 \ -e "discovery.type=single-node" \ -e ES_JAVA_OPTS="-Xms64m -Xmx128m" \ -v /home/service/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /home/service/elasticsearch/data:/usr/share/elasticsearch/data \ -v /home/service/elasticsearch/plugins:/usr/share/elasticsearch/plugins \ elasticsearch:7.12.1
注意事项
一定要给目录授权,否则可能启动失败,自动退出
chmod 777 config&chmod 777 data&chmod 777 plugins