本篇內(nèi)容介紹了“Docker部署elasticsearch的方法”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
創(chuàng)新互聯(lián)網(wǎng)站建設(shè)服務(wù)商,為中小企業(yè)提供成都做網(wǎng)站、網(wǎng)站建設(shè)服務(wù),網(wǎng)站設(shè)計(jì),網(wǎng)站托管等一站式綜合服務(wù)型公司,專業(yè)打造企業(yè)形象網(wǎng)站,讓您在眾多競爭對手中脫穎而出創(chuàng)新互聯(lián)。
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
這里建立文件夾后必須要授權(quán),否則容器沒寫入權(quán)限,啟動(dòng)失敗
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,啟動(dòng)容器
cd /opt/docker/elasticsearch && docker-compose up -d
4,驗(yàn)證(若沒啟動(dòng)成功,使用docker logs es01查看啟動(dòng)日志)
curl -X GET "localhost:9200/_cat/nodes?v&pretty"
詳細(xì)配置可查看官網(wǎng)文檔
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
詳細(xì)配置可查看官網(wǎng)文檔
https://github.com/medcl/elasticsearch-analysis-ik
“Docker部署elasticsearch的方法”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!