Dejavu 是一個 ElasticSearch 的 Web UI 工具,支持通過 JSON 和 CSV 文件導入數據,支持可視化定義 Mapping (字段映射)等。
相關描述在 https://github.com/appbaseio/dejavu/ 上都有詳細描述,這里只是做個簡單的記錄。
1、安裝 Docker 環境
這里就不細述了,網上有很多相關的資料。
也可以不使用 Docker ,會比較麻煩一點。
2、運行 ElasticSearch 服務
如果已經存在 ElasticSearch 服務,那么只需要確保其啟用了 CORS (跨域)設置即可。
啟用方式為,在 elasticsearch.yml 配置文件中添加以下幾行:
http.port: 9200
http.cors.allow-origin: 'http://localhost:1358'
http.cors.enabled: true
http.cors.allow-headers: X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization
http.cors.allow-credentials: true
如果不存在 ElasticSearch 服務的情況下,則可運行下面命令運行一個 ElasticSearch 的 docker 容器
ElasticSearch 2.x
docker run --name elasticsearch -p 9200:9200 -d elasticsearch:2 -Des.http.port=9200 -Des.http.cors.allow-origin="http://localhost:1358" -Des.http.cors.enabled=true -Des.http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -Des.http.cors.allow-credentials=true
ElasticsSarch 5.x
docker run --name elasticsearch -p 9200:9200 -d elasticsearch:5 -E http.port=9200 -E http.cors.allow-origin="http://localhost:1358" -E http.cors.enabled=true -E http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -E http.cors.allow-credentials=true
ElasticSearch 6.x
docker run -p 9200:9200 -d elasticsearch docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.4 -Ehttp.port=9200 -Ehttp.cors.enabled=true -Ehttp.cors.allow-origin=http://localhost:1358 -Ehttp.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -Ehttp.cors.allow-credentials=true
ElasticSearch 7.x
docker run -d --rm --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "http.cors.enabled=true" -e "http.cors.allow-origin=*" -e "http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization" -e "http.cors.allow-credentials=true" docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.1
安裝完成后可以使用下面命令創建一個新索引
curl -X PUT http://ip:9200/test
3、安裝運行 Dejavu 服務
使用 docker 安裝 Dejavu 服務
docker run -p 1358:1358 -d appbaseio/dejavu
安裝完成后可以使用瀏覽器打開 http://ip:1358 使用。


