Elasticsearch学习2-安装介绍

Posted Huazie

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch学习2-安装介绍相关的知识,希望对你有一定的参考价值。

安装

翻译原文请参考 Installation

Elasticsearch 至少需要 Java 8。特别是在本文中,建议您使用 Oracle JDK 版本 1.8.0_131。Java 安装因平台而异,因此我们不会在此详述这些细节。Oracle 推荐的安装文档可以在 Oracle 的网站上找到。可以这么说,在安装 Elasticsearch 之前,请先通过运行检查您的 Java 版本(然后根据需要进行相应的安装/升级):

Elasticsearch requires at least Java 8. Specifically as of this writing, it is recommended that you use the Oracle JDK version 1.8.0_131. Java installation varies from platform to platform so we won’t go into those details here. Oracle’s recommended installation documentation can be found on Oracle’s website. Suffice to say, before you install Elasticsearch, please check your Java version first by running (and then install/upgrade accordingly if needed) :

java -version
echo $JAVA_HOME

设置好 Java 后,我们就可以下载并运行 Elasticsearch。这些二进制文件 www.elastic.co/downloads 与过去发布的所有版本一起提供。对于每个版本,您可以在 zip 或 tar存档,DEB 或 RPM包,或 WindowsMSI安装包 之间进行选择。

Once we have Java set up, we can then download and run Elasticsearch. The binaries are available from www.elastic.co/downloads along with all the releases that have been made in the past. For each release, you have a choice among a zip or tar archive, a DEB or RPM package, or a Windows MSI installation package.

1. 使用 tar 安装示例

为简单起见,让我们使用tar文件。

For simplicity, let’s use the tar file.

让我们下载 Elasticsearch 6.0.1 tar,如下所示:

Let’s download the Elasticsearch 6.0.1 tar as follows:

curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.1.tar.gz

然后提取如下:

Then extract it as follows:

tar -xvf elasticsearch-6.0.1.tar.gz

然后它将在您的当前目录中创建一堆文件和文件夹。然后我们进入bin目录如下:

It will then create a bunch of files and folders in your current directory. We then go into the bin directory as follows:

cd elasticsearch-6.0.1/bin

现在我们准备启动我们的节点和单个集群:

And now we are ready to start our node and single cluster:

./elasticsearch

2. 使用 Homebrew 安装

在 macOS 上,Elasticsearch 也可以通过 Homebrew 安装:

On macOS, Elasticsearch can also be installed via Homebrew:

brew install elasticsearch

3. 使用 MSI Windows Installer 安装示例

对于 Windows 用户,我们建议使用 MSI 安装程序包。该软件包包含一个图形用户界面 (GUI),可指导您完成安装过程。

For Windows users, we recommend using the MSI Installer package. The package contains a graphical user interface (GUI) that guides you through the installation process.

首先,从 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.1.msi 下载 Elasticsearch 6.0.1 MSI 。

First, download the Elasticsearch 6.0.1 MSI from https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.1.msi.

然后双击下载的文件以启动 GUI。在第一个屏幕中,选择部署目录:

Then double-click the downloaded file to launch the GUI. Within the first screen, select the deployment directories:

然后根据需要选择是 作为服务安装 还是 手动启动 Elasticsearch。为了与 tar 示例保持一致,请选择不作为服务安装:

Then select whether to install as a service or start Elasticsearch manually as needed. To align with the tar example, choose not to install as a service:

对于配置,只需保留默认值:

For configuration, simply leave the default values:

同样,为了与 tar 示例保持一致,取消选中所有插件以不安装任何插件:

Again, to align with the tar example, uncheck all plugins to not install any plugins:

单击安装按钮后,将安装 Elasticsearch:

After clicking the install button, Elasticsearch will be installed:

默认情况下,Elasticsearch 将安装在%PROGRAMFILES%\\Elastic\\Elasticsearch. 导航到这里并进入 bin 目录,如下所示【当然我自己选择了自定义的目录】:

By default, Elasticsearch will be installed at %PROGRAMFILES%\\Elastic\\Elasticsearch. Navigate here and go into the bin directory as follows:

使用命令提示符:

with Command Prompt:

cd %PROGRAMFILES%\\Elastic\\Elasticsearch\\bin
# 我的目录
cd E:\\Software\\Elasticsearch\\6.0.1\\bin

使用 PowerShell:

with PowerShell:

cd $env:PROGRAMFILES\\Elastic\\Elasticsearch\\bin
# 我的目录
cd $env:E:\\Software\\Elasticsearch\\6.0.1\\bin

现在我们准备启动我们的节点和单个集群:

And now we are ready to start our node and single cluster:

.\\elasticsearch.exe

成功运行节点

如果安装一切顺利,您应该会看到如下所示的一堆消息:

If everything goes well with installation, you should see a bunch of messages that look like below:

无需过多详细介绍,我们可以看到名为 “6-bjhwl” 的节点(在您的情况下将是一组不同的字符【比如我的节点名为 huazie-node】)已启动并在单个集群中选择自己作为主节点。目前(我们)还不用担心主节点是什么意思。这里最重要的是我们已经在一个集群中启动了一个节点。

Without going too much into detail, we can see that our node named “6-bjhwl” (which will be a different set of characters in your case) has started and elected itself as a master in a single cluster. Don’t worry yet at the moment what master means. The main thing that is important here is that we have started one node within one cluster.

如前所述,我们可以覆盖集群或节点名称。这可以在启动 Elasticsearch 时从命令行完成,如下所示:

As mentioned previously, we can override either the cluster or node name. This can be done from the command line when starting Elasticsearch as follows:

./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name

另请注意标有 http 的行,其中包含有关我们的节点可访问的 HTTP 地址 ( 192.168.8.112) 和 端口 ( 9200) 的信息。默认情况下,Elasticsearch 使用端口 9200 来提供对其 REST API 的访问。如有必要,此端口是可配置的。

Also note the line marked http with information about the HTTP address (192.168.8.112) and port (9200) that our node is reachable from. By default, Elasticsearch uses port 9200 to provide access to its REST API. This port is configurable if necessary.

以上是关于Elasticsearch学习2-安装介绍的主要内容,如果未能解决你的问题,请参考以下文章

Elasticsearch入门学习:安装ES7.0.1

ElasticSearch学习

ElasticSearch入门学习笔记

介绍ElasticSearch与安装

Elasticsearch的安装及使用,这一篇就够了

elasticsearch学习笔记--原理介绍