Elasticsearch Guide[7.15]翻译 Install Elasticsearch form archive on Linux or MacOS

Elasticsearch 的 .tar.gz 文件适用于 Linux 和 MacOS 操作系统。

这个包同时包含免费和收费特性。开始一个30天的实验尝试所有特性。

在 Download Elasticsearch 页能找到 Elasticsearch 最细的稳定版本。Past Release page 能找到其他版本。

Elasticsearch 绑定了一个来自 JDK 维护者(GPLv2+CE)的 Open JDK 的版本。如果使用你自己的 Java 版本,查看 JVM version requirements。

Download and install archive for Linux

Elasticsearch v7.15.0 的 Linux 文件可以按如下方式下载和安装:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-linux-x86_64.tar.gz.sha512 ①
shasum -a 512 -c elasticsearch-7.15.0-linux-x86_64.tar.gz.sha512 
tar -xzf elasticsearch-7.15.0-linux-x86_64.tar.gz
cd elasticsearch-7.15.0/  ②

① 使用 SHA 比较下载的 .tar.gz 文件和公共 checksum,正常应该输出 elasticsearch-{version}-linux-x86_64.tar.gz: OK
② 这个文件夹被认为是 $ES_HOME

Download and install archive for MacOS

(略)

Enabled automatic creation of system indices

一些商业特性会在 Elasticsearch 中自动创建索引。默认的,Elasticsearch 被配置成允许自动创建索引,并且不需要任何额外步骤。然而,如果你需要禁在 Elasticsearch 中自动创建索引,你必须在 elasticsearch.yml 中配置 action.auto_create_index 去允许商业特性创建如下索引:

action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*

如果你使用 Logstash 或 Beats ,那么你可能最需要在你的 action.auto_create_index 配置额外的索引名称,确切的值取决于您的本地配置。如果您不确定您的环境的正确值,您可以考虑将值设置为*,这将允许自动创建所有索引。

Running Elasticsearch from the command line

Elasticsearch 能像如下命令行所示启动:

./bin/elasticsearch

如果你有密码保护的 Elasticsearch keystore,你将会被提示输入 keystore’s 的密码。查看 Secure settings 获取更多细节。

默认的,Elasticsearch 会打印日志到 console(stdout)和 logs directory 文件夹中的<clustername>.log 文件。Elasticsearch 启动的时候会记录一些信息,但是一旦完成初始化,它将继续在 foreground 运行并且不会记录任何东西直到发生一些事情有值得记录的东西。当 Elasticsearch 运行的时候,你可以与它通过默认的 HTTP 端口 9200 进行交流。停止 Elasticsearch,键入 Ctrl -c

注意!All scripts packaged with Elasticsearch require a version of Bash that supports arrays and assume that Bash is available at /bin/bash. As such, Bash should be available at this path either directly or via a symbolic link.

Checking that Elasticsearch is Running

你可以通过发送一个 HTTP 请求到 localhost9200 端口测试你的 Elasticsearch node 是否在运行:

GET /

正常应该返回像如下的 response:

{
  "name" : "Cp8oag6",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA",
  "version" : {
    "number" : "7.15.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "f27399d",
    "build_date" : "2016-03-30T09:51:41.449Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "1.2.3",
    "minimum_index_compatibility_version" : "1.2.3"
  },
  "tagline" : "You Know, for Search"
}

可以在命令行中使用 -q--quiet 选项禁用日志打印到 stdout

Running as a daemon

运行 Elasticsearch 作为守护线程,在命令行指定 -d,并且使用 -p 选项在一个文件中记录 process ID。

./bin/elasticsearch -d -p pid

如果你有密码保护的 Elasticsearch keystore,你将会被提示输入 keystore’s 的密码。查看 Secure settings 获取更多细节。

日志信息可以在 $ES_HOME/logs/ 文件夹中找到。
关闭 Elasticsearch,kill 掉被记录在 pid 文件中的 process ID:

pkill -F pid

注意!Elasticsearch 的 .tar.gz 包不包含 systemd 模块。若想把 Elasticsearch 当做一个服务管理,使用 Debian 或 RPM 包替代它。

Configuring Elasticsearch on the command line

Elasticsearch 默认从 $ES_HOME/config/elasticsearch.yml 加载它的配置。Confirguring Elasticsearch 中解释了配置文件的格式。

一些配置可以在配置文件中指定,同样也能在命令行中使用 -E 语法如下:

./bin/elasticsearch -d -Ecluster.name=my_cluster -Enode.name=node_1

小贴士!一些集群范围的设置(像 cluster.name)应该加到 elasticsearch.yml 配置文件中,当一些 节点级设置例如 node.name 可以在命令行中指定。

Directory layout of archives

archive 发行版是完整自包含的。所有的文件夹,默认的包含在 archive 解压时创建的 $ES_HOME 中。

这是非常方便的因为在你使用 Elasticsearch 时候不需要创建任何文件夹,并且卸载 Elasticsearch 就像删除 $ES_HOME 文件夹一样简单。然而,明智的做法是改变默认的配置文件夹位置,数据文件夹,日志文件夹,这样你就不会删除重要数据了。

TypeDescriptionDefault LocationSetting
homeElasticsearch home directory or $ES_HOMEDirectory created by unpacking the archive
binBinary scripts including elasticsearch to start a node and elasticsearch-plugin to install plugins$ES_HOME/bin
confConfiguration files including elasticsearch.yml$ES_HOME/configES_PATH_CONF
dataThe location of the data files of each index / shard allocated on the node$ES_HOME/datapath.data
logsLog files location$ES_HOME/logspath.logs
pluginsPlugin files location.Each plugin will be contained in a subdirectory.$ES_HOME/plugins
repoShared file system repository location. Can hold multiple location. A file system repository can be placed in to any subdirectory of any directory specified here.Not configuredpath.repo

Next steps

(略)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值