说明:本示例是在CentOs Linux7.4上运行,安装的es版本为6.8.0,对应es-sql版本6.8.0,es-head版本5.0.0,需要安装JDK
下载es安装包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.0.tar.gz
下载插件包
es-sql
es-sql-site-standalone.zip此包提供web服务
es-head
安装es,前期系统级别准备
#新建用户
useradd es
#创建密码
passwd es
#设置es的sudo权限
vim /etc/sudoers
#找到下面这一行
root ALL=(ALL) ALL
#增加这一行
es ALL=(ALL) ALL
#修改文件数和线程数
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
#修改sysctl.conf
vim /etc/sysctl.conf
vm.max_map_count=262144
#立即生效
sysctl -p
#解压已经下载的安装包
tar -xvf xxx.tar.gz -C /home/es
chown es:es xxx
chmod 755 xxx
安装es,配置文件设置
#找到elasticsearch.yml文件,并修改其中的参数
vim elasticsearch.yml
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#根据实际情况填写IP地址
network.host: xxx.xxx.xxx.xxx
#根据实际情况填写端口号
http.port: 9200
启动es之前,要保证系统安装了JDK
启动es
#使用es用户启动
nohup ./bin/elasticsearch >> es.log &
tail -f es.log
安装es-sql
#安装es-sql,记得相关的es操作要使用es用户
./bin/elasticsearch-plugin install file:///home/es/elasticsearch-sql-xxx.zip
#安装web服务
unzip es-sql-site-standalone.zip
cd site-server
#没有npm,需要用yum安装一下
npm install express --save
#启动web服务
node node-server.js &
#可以修改为es提供web服务的端口号,默认是8080
vim site_configuration.json
#要想使用此插件,需要修改es的配置文件,换句话说需要重启es
vim elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
浏览器访问:http://xxx.xxx.xxx.xxx:8080
红色方框内填入你要查询的es数据库的IP地址和端口号