本篇内容介绍了“Docker部署elasticsearch的方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
1,建立es容器挂载目录
mkdir -p /opt/docker/elasticsearch/data mkdir -p /opt/docker/elasticsearch/plugins mkdir -p /opt/docker/elasticsearch/logs chmod 777 /opt/docker/elasticsearch/data /opt/docker/elasticsearch/logs
这里建立文件夹后必须要授权,否则容器没写入权限,启动失败
2,建立/opt/docker/elasticsearch/docker-compose.yml
version: '2' services: elasticsearch: image: elasticsearch:7.12.0 container_name: es01 environment: - "discovery.type=single-node" - "ES_JAVA_OPTS=-Xmx256m -Xms256m" volumes: - /opt/docker/elasticsearch/data:/usr/share/elasticsearch/data:rw - /opt/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins - /opt/docker/elasticsearch/logs:/usr/share/elasticsearch/logs ports: - "9200:9200" - "9300:9300" networks: - elk networks: elk: driver: bridge
3,启动容器
cd /opt/docker/elasticsearch && docker-compose up -d
4,验证(若没启动成功,使用docker logs es01查看启动日志)
curl -X GET "localhost:9200/_cat/nodes?v&pretty"
详细配置可查看官网文档
https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docker.html
5,加入中文分词ik
cd /opt/docker/elasticsearch/ wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.0/elasticsearch-analysis-ik-7.12.0.zip unzip elasticsearch-analysis-ik-7.12.0.zip -d plugins/ik docker restart es01
详细配置可查看官网文档
https://github.com/medcl/elasticsearch-analysis-ik
“Docker部署elasticsearch的方法”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。