docker 安裝 es kibana
阿新 • • 發佈:2018-12-16
安裝Elasticsearch
安裝
docker run -it --name elasticsearch -d -p 9200:9200 -p 9300:9300 elasticsearch:5.6.11
其中啟動失敗。es預設啟動分配地址記憶體2G,而導致失敗資訊:OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory. # An error report file with more information is saved as: # /tmp/hs_err_pid1.log解決:vi config/jvm.options-Xms512m -Xmx512m docker run -it --name elasticsearch -d -p 9200:9200 -p 9300:9300 -v $PWD/congfig/jvm.options:/usr/share/elasticsearch/config/jvm.options elasticsearch:5.6.11
驗證
> curl http://localhost:9200 { "name": "OwHPNzY", "cluster_name": "elasticsearch", "cluster_uuid": "WeiDMjJARv2DHMcCrQgS6g", "version": { "number": "5.6.4", "build_hash": "8bbedf5", "build_date": "2017-10-31T18:55:38.105Z", "build_snapshot": false, "lucene_version": "6.6.1" }, "tagline": "You Know, for Search" }
安裝Kibana
安裝
docker run -it -d -e ELASTICSEARCH_URL=http://127.0.0.1:9200 --name kibana -p 5601:5601 kibana:5.6.11
驗證
image
安裝Elasticsearch-head
v5.x以後不支援plugin需要獨立部署
安裝
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start
驗證
image
直接配置elasticsearch服務有跨域問題,所以加了nginx代理
nginx 服務配置
server {
listen 9201;
server_name localhost;
location / {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers Origin,X-Requested-With,Content-Type,Accept;
add_header Access-Control-Allow-Methods GET,POST,PUT,PATCH,OPTIONS,DELETE;
add_header Cache-Control no-store;
proxy_pass http://127.0.0.1:9200;
}
}
安裝中文分詞器
#進入容器內 docker attach 容器Id
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases