Elasticsearch 是一个分布式、RESTful 风格的搜索和数据分析引擎,能够解决不断涌现出的各种用例。作为 Elastic Stack 的核心,它集中存储您的数据,帮助您发现意料之中以及意料之外的情况。
1.下载地址:https://www.elastic.co/cn/downloads/past-releases/elasticsearch-6-6-2
#解压到指定目录
[hadoop@hadoop001 software] tar -xzvf elasticsearch-6.6.2.tar.gz -C /home/hadoop/app/
#修改配置文件
[hadoop@hadoop001 config]$ pwd
/home/hadoop/app/elasticsearch-6.6.2/config
[hadoop@hadoop001 config]$ vim elasticsearch.yml
#将一下配置添加到配置文件中
cluster.name: ruozedata-es-cluster
node.name: ruozedata-node1
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"
#配置环境变量
export ELASTICSEARCH_HOME=/home/hadoop/app/elasticsearch-6.6.2
export PATH=${ELASTICSEARCH_HOME}/bin:$PATH
#启动
[hadoop@hadoop001 config]$ elasticsearch
2.安装插件elasticsearch-head
下载地址在github上:https://github.com/mobz/elasticsearch-head
#创建存放目录
[hadoop@hadoop001 app]$ mkdir elasticsearch-head
#克隆
[hadoop@hadoop001 app]$ git clone https://github.com/mobz/elasticsearch-head.git
#安装nodejs,官网下载tar包,地址:https://nodejs.org/en/
[hadoop@hadoop001 app]$ wget https://npm.taobao.org/mirrors/node/v10.16.0/node-v10.16.0-linux-x64.tar.xz
[hadoop@hadoop001 app]$ xz -d node-v10.16.0-linux-x64.tar.xz
[hadoop@hadoop001 app]$ tar -xvf node-v10.16.0-linux-x64.tar
#配置环境变量
export NODEJS_HOME=/home/hadoop/software/node-v10.16.0-linux-x64
export PATH=${NODEJS_HOME}/bin:$PATH
#到elasticsearch-head的目录下
[hadoop@hadoop001 elasticsearch-head]$ pwd
/home/hadoop/app/elasticsearch-head
[hadoop@hadoop001 elasticsearch-head]$ npm install
#修改head插件的连接地址,vim _site/app.js 文件,其中xxxx 是 es所在服务器的ip
this.base_uri = this.config.base_uri ||
this.prefs.get("app-base_uri") || "http://xxxx:9200"
#启动
[hadoop@hadoop001 elasticsearch-head]$ npm run start
安装报错
npm ERR! [email protected] install:
node install.js
npm ERR! Exit status 1
npm install [email protected] --ignore-scripts
elasticsearch启动报错
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
调整vm.max_map_count的大小
sysctl -w vm.max_map_count=655360
#查看修改结果
sysctl -a|grep vm.max_map_count
#切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 131072
#永久设置大小
vim /etc/sysctl.conf
#配置文件添加
vm.max_map_count=655360
下载地址:https://www.elastic.co/downloads/past-releases/kibana-6-6-2
#解压到指定目录
[hadoop@hadoop001 software]$ tar -xzvf kibana-6.6.2-linux-x86_64.tar.gz -C /home/hadoop/app/
#conf目录下修改配置文件
[hadoop@hadoop001 config]$ pwd
/home/hadoop/app/kibana/config
[hadoop@hadoop001 config]$ vim kibana.yml
#添加以下配置
#Elasticsearch主机地址
elasticsearch.url: "http://hadoop001:9200"
## 允许远程访问
server.host: "0.0.0.0"
## Elasticsearch用户名 这里其实就是我在服务器启动Elasticsearch的用户名
elasticsearch.username: "admin"
## Elasticsearch鉴权密码 这里其实就是我在服务器启动Elasticsearch的密码
elasticsearch.password: "admin"
启动
[hadoop@hadoop001 bin]$ nohup ./kibana >/dev/null 2>&1 &
# github上对应的版本地址
https://github.com/NLPchina/elasticsearch-sql/
# 下载和ES版本相同的ES-SQL插件
https://github.com/NLPchina/elasticsearch-sql/releases/download/6.6.2.0/elasticsearch-sql-6.6.2.0.zip
离线安装es-sql
[hadoop@hadoop001 bin]$ elasticsearch-plugin install file:/home/hadoop/software/ELK/elasticsearch-sql-6.6.2.0.zip
在线安装es-sql
./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.6.2.0/elasticsearch-sql-6.6.2.0.zip
安装es-sql-site-standalone.zip
# 插件下载地址:https://github.com/NLPchina/elasticsearch-sql/releases/download/5.4.1.0/es-sql-site-standalone.zip
# 解压
unzip es-sql-site-standalone.zip -d ~/app/elasticsearch-6.6.2
# 安装
[hadoop@hadoop001 elasticsearch-6.6.2]$ cd site-server/
[hadoop@hadoop001 site-server]$ npm install express --save
#site_configuration可以修改启动服务的端口
[hadoop@hadoop001 site-server]$ vim site_configuration.json
{
"port":8088
}
# 启动
[hadoop@hadoop001 site-server]$ node node-server.js //不修改默认端口是8080
简单使用:https://juejin.im/post/5c122057518825353624bdb2#heading-0