1.安装elaticsearch
下载elaticsearch,我这里用的5.1.2的版本:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.2.tar.gz
创建一个ela用户,配置好data目录和logs目录,一般解压至opt文件夹下直接解压即可,修改配置文件。
# ---------------------------------- Cluster -----------------------------------
cluster.name: my-application
# ------------------------------------ Node ------------------------------------
node.name: node-1
# ----------------------------------- Paths ------------------------------------
path.data: /data/es-data
path.logs: /var/log/elasticsearch
# ----------------------------------- Memory -----------------------------------
#bootstrap.memory_lock: true
# ---------------------------------- Network -----------------------------------
network.host: 0.0.0.0
http.port: 9200
# --------------------------------- Discovery ----------------------------------
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
# ---------------------------------- Gateway -----------------------------------
#gateway.recover_after_nodes: 3
# ---------------------------------- Various -----------------------------------
#action.destructive_requires_name: true
node.master: true
node.data: true
http.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"
添加/etc/security/limits.conf配置
* soft nofile 65536
* hard nofile 65536
添加vi /etc/sysctl.conf 配置
vm.max_map_count=262144
启动elasticsearch:/opt/elasticsearch-5.1.2/bin/elasticsearch -d
测试是否安装成功:http://IP:9200
2.安装elaticsearch-sql
在https://github.com/NLPchina/elasticsearch-sql上查找
./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/5.1.2.0/elasticsearch-sql-5.1.2.0.zip
在es 5.X后,需要下载 es-sql的extract site ,并解压启动。
下载地址如下:https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.1.0/es-sql-site-standalone.zip,然后切换到解压文件目录中的site-server中。执行如下安装命令:
yum -y install nodejs npm
cd site-server
npm install express --save
启动服务
node node-server.js &
然后输入https://ip:8080即可访问(改端口可以在site-server/site_configuration.json中修改)。
参考文档:
https://blog.csdn.net/zerokissingthefire/article/details/100104607
https://www.cnblogs.com/kangoroo/p/7273493.html
https://www.elastic.co/cn/what-is/elasticsearch-sql