Elasticsearch tutorial(三)

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提供访问。需要的话,这个端口号是可以配置的。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 160,999评论 4 368
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 68,102评论 1 302
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 110,709评论 0 250
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,439评论 0 217
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,846评论 3 294
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,881评论 1 224
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 32,062评论 2 317
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,783评论 0 205
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,517评论 1 248
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,762评论 2 253
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,241评论 1 264
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,568评论 3 260
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,236评论 3 241
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,145评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,941评论 0 201
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,965评论 2 283
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,802评论 2 275