第二十二章 Centos7下Docker安装Elasticsearch

一、查找Elasticsearch镜像

[root@staging ~]# docker search elasticsearch

二、拉取Elasticsearch镜像

[root@staging ~]# docker pull elasticsearch:7.14.2

三、编写配置文件

[root@staging ~]# mkdir -p /data2/elasticsearch/config
[root@staging config]# vim elasticsearch.yml 
cluster.name: "docker-cluster"
network.host: 0.0.0.0
[root@staging config]# chmod  -R 777 /data2/elasticsearch/

四、运行Elasticsearch

[root@staging ~]# docker run \
 -itd  \
 -p 9200:9200 \
 -p 9300:9300 \
 -v /data2/elasticsearch/data:/usr/share/elasticsearch/data \
 -v /data2/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
 -v /data2/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
 -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime \
 -e discovery.type=single-node \
 -e ES_JAVA_OPTS="-Xms64m -Xmx512m" \
 --restart always \
 --privileged=true \
 --name es \
 elasticsearch:7.14.2

五、验证Elasticsearch容器

[root@staging config]# docker ps
CONTAINER ID   IMAGE                  COMMAND                  CREATED         STATUS                PORTS                                                                                                                   NAMES
7e1f75c1dd67   elasticsearch:7.14.2   "/bin/tini -- /usr/l…"   7 seconds ago   Up 3 seconds          0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp                                    es

六、浏览器测试访问

输入IP+Port,本机192.168.2.18:9200,输入正确的用户名和修改过后的密码即可正常登陆。

第二十二章 Centos7下Docker安装Elasticsearch

上一篇:elasticsearch重启后,unassigned索引重新分片失败YELLO、RED恢复处理


下一篇:ELK平台学习笔记