說明:本示例是在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地址和端口號