Free and Open, Distributed, RESTful Search Engine.
https://www.elastic.co/products/elasticsearch
Elasticsearch is the distributed, RESTful search and analytics engine at the heart of the Elastic Stack. You can use Elasticsearch to store, search, and manage data for:
-
Logs
-
Metrics
-
A search backend
-
Application monitoring
-
Endpoint security
... and more!
To learn more about Elasticsearch’s features and capabilities, see our product page.
Get started
The simplest way to set up Elasticsearch is to create a managed deployment with Elasticsearch Service on Elastic Cloud.
If you prefer to install and manage Elasticsearch yourself, you can download the latest version from elastic.co/downloads/elasticsearch.
For more installation options, see the Elasticsearch installation documentation.
Upgrade
To upgrade from an earlier version of Elasticsearch, see the Elasticsearch upgrade documentation.
Build from source
Elasticsearch uses Gradle for its build system.
To build a distribution for your local OS and print its output location upon completion, run:
./gradlew localDistro
To build a distribution for another platform, run the related command:
./gradlew :distribution:archives:linux-tar:assemble ./gradlew :distribution:archives:darwin-tar:assemble ./gradlew :distribution:archives:windows-zip:assemble
To build distributions for all supported platforms, run:
./gradlew assemble
Distributions are output to distributions/archives.
To run the test suite, see TESTING.
Documentation
For the complete Elasticsearch documentation visit elastic.co.
For information about our documentation processes, see the docs README.
Contribute
For contribution guidelines, see CONTRIBUTING.
Questions? Problems? Suggestions?
-
To report a bug or request a feature, create a GitHub Issue. Please ensure someone else hasn’t created an issue for the same topic.
-
Need help using Elasticsearch? Reach out on the Elastic Forum or Slack. A fellow community member or Elastic engineer will be happy to help you out.
from https://github.com/elastic/elasticsearch
(https://github.com/elastic/elasticsearch-definitive-guide,
https://github.com/elasticsearch-cn/elasticsearch-definitive-guide)
------
elasticsearch 安装笔记
什么是 Elasticsearch
Elasticsearch是一个基于Lucene库的搜索引擎。它提供了一个分布式、支持多租户的全文搜索引擎,具有HTTP Web接口和无模式JSON文档。Elasticsearch是用Java开发的,并在Apache许可证下作为开源软件发布。官方客户端在Java、.NET(C#)、PHP、Python、Apache Groovy、Ruby和许多其他语言中都是可用的。根据DB-Engines的排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr,也是基于Lucene。
安装 JDK
Elasticsearch是java应用,故依赖JDK
yum install -y java-1.8.0-openjdk wget
安装 elasticsearch
下载 elasticsearch 并解压,这里创建一个软连接,方便以后切换版本
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.2.tar.gz |
若出现 shasum: command not found 报错信息,安装 perl-Digest-SHA 即可
yum install -y perl-Digest-SHA |
创建 elasticsearch 用户及组,为了安全考虑 elasticsearch 不能使用有 root 权限的用户进行启动
groupadd elasticsearch |
创建 elasticsearch 数据目录
mkdir -p /data/elasticsearch/{data,logs} |
授予 elasticsearch 用户目录访问权限
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch* |
动态调整内核的运行参数
echo 'vm.max_map_count=262144' > /usr/lib/sysctl.d/elasticsearch.conf |
修改相关配置
修改 elasticsearch 配置
# vi /usr/share/elasticsearch/config/elasticsearch.yml |
修改 JVM 配置
$ vi /usr/share/elasticsearch/config/jvm.options
-Xms4g
-Xmx4g
添加 systemd 进程守护文件
$ vi /usr/lib/systemd/system/elasticsearch.service |
设置防火墙
开启9200端口 |
启动 elasticsearch
设置开机自启
systemctl enable elasticsearch
运行 elasticsearch
systemctl start elasticsearch
参考文档
-----------------------------------------------------------------
Splainer 是开源的 Elatsticsearch 和 Solr 的沙箱,帮助理解搜索结果以及调整搜索设置、参数等因素。
GitHub地址:https://github.com/o19s/splainer
在线使用地址:http://splainer.io/
-------------------------------------------
安装ElasticSearch
由于本次模拟的是服务器不能连接互联网的情况,所以全部安装步骤皆使用 RPM 或 tar 包的方式安装。本文主要记录安装 Elastic Search 的过程。
安装 JRE
首先这套平台是基于 Java 的,所以 Java 运行环境当然是不能少。但因为这上面不涉及 Java 的开发,所以不需要装 JDK,装 JRE 就够了,还能省下一些磁盘空间。我这里选择 JRE8u161。
我这次选择使用 RPM 包安装。
sudo rpm -ivh jre-8u161-linux-x64.rpm |
安装完毕后,验证安装是否成功:
# 检验当前用户下是否安装成功 |
若都输出如下内容则说明安装成功:
java version "1.8.0_161" |
至此 Java 环境配置完成
安装 Elastic Search
安装过程
使用 RPM 包安装
直接使用 rpm 命令安装该 RPM 包
sudo rpm --install elasticsearch-6.2.2.rpm |
CentOS 7 使用 systemd 管理开机自启动项,而且安装过程已经配置好针对 systemd 的启动脚本,使用如下命令激活
sudo systemctl daemon-reload |
使用 tar.gz 包安装
首先新建一个名为 elk 的用户,用于运行 ELK 平台
useradd -m elk |
下载好 Elastic Search 的安装包,将其复制到 /opt 并解压,然后试运行
sudo cp elasticsearch-6.1.3.tar.gz /opt |
启动成功后,在另一终端使用 curl 尝试连接 Elastic Search
curl http://127.0.0.1:9200 |
若有如下返回,则说明 Elastic Search 启动成功
{ |
安装后的配置
系统配置文件修改
Elastic Search 需要调整文件描述符大于 65535、最大线程数大于 4096、以及 vm.max_map_count 大于 262144。所以修改操作系统配置文件以满足此要求。
在 /etc/security/limits.conf 插入如下内容
* hard nofile 65536 |
在 /etc/sysctl.conf 中插入如下内容
vm.max_map_count=262144 |
然后执行 sysctl -p,并重新登录,使配置生效。若配置成功,则可见 Elastic Search 启动过程中相关的警告信息将不再出现。
Elastic Search 配置文件修改
以下文件位置根据安装方法不同而不同
若使用 RPM 包方式安装,则文件位于 /etc/elasticsearch
若使用 tar 包方式安装,则文件位于解压出来的目录的 conf 文件夹中
修改
cluster.name
我们应当将集群名设置成一个能清晰地表明该集群的作用的名字,如logging-prod。修改
node.name
为每个 Elastic Search 节点起一个清晰易懂的名字绝不会是一件坏事。
节点名字可以是一个自定义的名字,如prod-data-2,也可以使用${HOSTNAME}来把本机的主机名作为该节点的节点名。其他详细配置
要想了解更多配置,可以参考 Elasticsearch Reference 的 Set up Elasticsearch 部分。
配置自动启动
如果使用 RPM 包方式安装,则此步可忽略。
若使用 tar 包方式安装,则进入 Elastic Search 的 bin 目录后运行
./elasticsearch -d -p ../logs/elasticsearch.pid |
使 Elastic Search 以 daemon 模式启动并监控启动过程。
No comments:
Post a Comment