Elasticsearch tutorial(三)

作者: smileJiuer | 来源:发表于2018-09-28 10:27 被阅读0次

Installation安装

You can skip installation completely by using our hosted Elasticsearch Service on ElasticCloud,which is available on AWS and GCP.You can try out the hosted service for free.

你可以通过使用ElasticCloud上我们持有的Elasticsearch服务来跳过所有安装步骤,该服务可在AWS(Amazon Web Services)亚马逊云服务和GCP(Google Cloud Platform)谷歌云平台免费获取。

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 founded 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):

Elasticsearch 基于Java 8及以上环境。明确而言,本文写作时推荐使用Oracle JDK版本1.8.0_131。Java的安装因平台不同而各有差异,此处不作详细说明。Oracle的推荐安装文档可以在Oracle网站上找到。所以呢,在安装Elasticsearch前,请先运行检查你的Java版本(然后按需安装或升级)

java -version

echo $JAVA_HOME

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.

java安装完成后,我们就可以下载运行Elasticsearch了。可以通过www.elastic.co/downloads这个链接获取所有历史版本和二进制文件。每个版本下,都可选择zip或tar压缩包,也提供DEB或RPM的包,亦或Windows的MSI安装包。

Installation example with tar

For simplicity, let’s use the tar file.

我们来用tar类型的压缩包做简单安装演示

Let’s download the Elasticsearch 6.4.0 tar as follows:

首先按照下面的命令下载6.4.0版本的Elasticsearch tar压缩包:

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

Then extract it as follows:

通过tar -xvf命令提取elasticsearch文件:

tar -xvf elasticsearch-6.4.0.tar.gz

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

接着会自动在你最近访问的目录下创建一堆文件和文件夹。我们通过cd 命令进入bin目录下:

cd elasticsearch-6.4.0/bin

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

现在就可以开始创建我们的节点和集群了:

./elasticsearch

Installation example with MSI Windows Installer

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.

对于Windows用户,我们推荐使用MSI安装包。安装包中包含图形用户界面(GUI),可以在安装过程中给予引导。

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

首先,从msi下载地址下载Elasticsearch 6.4.0MSI包

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

然后双击下载文件以登录GUI。首屏界面,选择部署目录

Elasticsearch MSI GUI首屏界面

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:

接着选择是作为服务运行还是按需手动启动。依照tar包的例子,选择不作为服务安装:

安装选项

For configuration, simply leave the default values:

可配置化地,不选择默认值:

手动配置

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

同样的,与tar文件保持一致,取消勾选列表所有项,不安装任何插件:

插件推荐,所有都不要勾选

After clicking the install button, Elasticsearch will be installed:

单击下安装按钮后,Elasticsearch就会安装上了:

安装成功页面

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

一般情况下,Elasticsearch 会安装在/PROGRAMFILES/ELastic/ELasticsearch目录下,进入这个路径下就可以找到bin文件路径:

with Command Prompt: 命令行:

cd %PROGRAMFILES%\Elastic\Elasticsearch\bin

with PowerShell: PowerShell:

cd $env:PROGRAMFILES\Elastic\Elasticsearch\bin


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

现在我们可以开始创建节点和集群了:

.\elasticsearch.exe

Successfully running node成功运行节点:

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

如果顺利安装完成,你将看到像下面一样的一堆信息:

安装完成后----一堆msg

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.

省去很多细节,我们已经看到在一个集群中已经创建了一个名为“6-bjhwl”(将在你的用例中成为一个特别的数据集)的节点且作为集群中的主干存在。现在不必探讨主干意味着什么,主要的是我们已经在一个集群里创建了一个节点。

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后通过命令行实现,具体如下:

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

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.

值得注意的,标记为http的行,其中包含有关节点可从.http访问的HTTP地址(192.168.8.112)和端口(9200)的信息。默认情况下,ELasticsearch使用9200的端口号来为REST API提供访问。需要的话,这个端口号是可以配置的。

相关文章

网友评论

    本文标题:Elasticsearch tutorial(三)

    本文链接:https://www.haomeiwen.com/subject/nrwdoftx.html