安装elaticsearch 以及elaticsearch-sql

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

https://blog.csdn.net/cb2474600377/article/details/78181974

https://www.cnblogs.com/zhi-leaf/p/8484337.html

要使用 Elasticsearch SQL 插件,您需要先确保您已经安装Elasticsearch 7.1.1 版本。然后,按照以下步骤进行操作: 1. 安装 Elasticsearch SQL 插件: - 打开终端或命令提示符窗口。 - 运行以下命令安装 Elasticsearch SQL 插件: ``` ./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/7.1.1.0/elasticsearch-sql-7.1.1.0.zip ``` - 安装完成后,重启 Elasticsearch 以使插件生效。 2. 使用 Elasticsearch SQL: - 打开终端或命令提示符窗口。 - 进入 Elasticsearch安装目录。 - 运行以下命令以启动 Elasticsearch SQL 查询: ``` ./bin/elasticsearch-sql-cli ``` - 您将进入 Elasticsearch SQL 的命令行界面。 - 现在,您可以开始使用 SQL 语法来查询 Elasticsearch 数据。 例如,您可以运行以下命令来执行一个简单的 SELECT 查询: ``` SELECT * FROM your_index_name WHERE your_field_name = 'your_value' ``` 注意:在上述查询中,`your_index_name` 是您要查询的索引名称,`your_field_name` 是您要查询的字段名称,`your_value` 是您要匹配的字段值。 这样,您就可以使用 Elasticsearch SQL 插件来执行 SQL 查询并检索 Elasticsearch 中的数据了。请记住,Elasticsearch SQL 插件提供了一种方便的方式来使用 SQL 语法进行查询,但它可能不适用于所有类型的查询,特别是复杂的查询。因此,在使用插件时,请确保您了解其使用限制和适用场景。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值