ElasticSearch-SQL 5.5 安装及配置

elasticSearch-sql是提供es的类SQL查询的相关接口,支持大部分的SQL语句的查询的插件,

官方网址:https://github.com/NLPchina/elasticsearch-sql

安装环境:

elasticsearch 5.5.0

jdk1.8 

centos 7

1.安装es-sql依赖node npm

es-sql 5.x版本以后,安装需要依赖node 和 npm ,先安装node和npm,安装后在检查node及npm的安装,命令如下:

  1. yum -y install nodejs npm

  2. node -v 

  3. npm -v

2.切换到es的安装目录,执行下面命令(不同版本对应不同的es-sql),安装es-sql插件,安装完后plugin文件下可以看到

./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.5.0.0/elasticsearch-sql-5.5.0.1.zip

3.安装es-sql的前端

下载安装包:sudo wget https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.1.0/es-sql-site-standalone.zip

解压: sudo unzip es-sql-site-standalone.zip

赋权限给centos用户:sudo chown -R centos:centos site-server/

进入site-server文件夹执行命令:npm install express --save

可以修改site_configuration.json中启动端口

4.重启es,然后启动es-sql前端

node node-server.js &

5.浏览器访问es-sql前端安装服务器,例如:http://10.144.130.119:8080

6.安装完后的执行SQL语句,遇到的异常以及修改办法。

问题1:"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST /_sql</pre>\n</body>\n</html>

---这个是因为help左边栏(上图红框)中默认是es-sql的端口号,需要修改为es的对外请求端口号9200

在查这个问题时,服务器上执行SQL也报错,拒绝连接

这样是因为es的配置文件elasticsearch.yml中指定了network的host仅一个外网访问,加上127.0.0.1就可以,多个用,分隔

 问题2:上述修改完后,报Error:Error occured! response is not avalible.

 Error:Error occured! response is not avalible.Provisional headers are shown

---es的配置文件elasticsearch.yml中增加配置

http.cors.enabled: true
http.cors.allow-credentials: true
http.cors.allow-origin: "/.*/"
http.cors.allow-headers: WWW-Authenticate,X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization

报错原因是测试服务器中的配置,将allow-origin进行了限制访问

 

另外如果安装了x-pack权限验证,需要关掉

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值