本文共 4753 字,大约阅读时间需要 15 分钟。
In this tutorial, we will look at how we can install Elasticsearch on Ubuntu 18.04. Elasticsearch is an open-source distributed full-text search and analytics engine. It supports RESTful operations (GET, POST requests) and allows you to store, search, and analyze big volumes of data in real-time.
在本教程中,我们将研究如何在Ubuntu 18.04上安装Elasticsearch。 Elasticsearch是一个开源的分布式全文本搜索和分析引擎。 它支持RESTful操作(GET,POST请求),并允许您实时存储,搜索和分析大量数据。
Before installing Elasticsearch, we must first get its dependencies. The major dependency is OpenJDK 8 since this is an open-source Java application.
在安装Elasticsearch之前,我们必须首先获取其依赖项。 主要依赖项是OpenJDK 8,因为这是一个开源Java应用程序。
Let’s first update our system and install required packages so that apt
can download over https.
首先让我们更新系统并安装所需的软件包,以便apt
可以通过https下载。
sudo apt updatesudo apt install apt-transport-https
Now, install OpenJDK 8 (Recommended) using the package manager.
现在,使用包管理器安装OpenJDK 8 (推荐)。
sudo apt install openjdk-8-jdk
Otherwise, if you want to install the most recent version, you can .
否则,如果要安装最新版本,则可以 。
Now that we have our major dependencies installed, we must now download the latest version of Elasticsearch, found at the .
现在我们已经安装了主要的依赖项,我们现在必须下载最新版本的Elasticsearch,该版本位于 。
The latest version is 7.5.1 at the time of writing.
撰写本文时,最新版本为7.5.1 。
Let’s download the Debian package (.deb) for our system.
让我们为系统下载Debian软件包( .deb )。
Let’s use wget
to fetch it from the remote server.
让我们使用wget
从远程服务器获取它。
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.1-amd64.deb
We will install the Debian package using dpkg
package installer for Elasticsearch 7.5.1.
我们将使用Elasticsearch 7.5.1的 dpkg
软件包安装程序来安装Debian软件包。
dpkg -i elasticsearch-7.5.1-amd64.deb
A similar output indicates that your installation was successful!
类似的输出表明安装成功!
Now, let us configure Elasticsearch for it to work properly.
现在,让我们配置Elasticsearch使其正常工作。
In our first step of configuration, we shall set the IP address of our Server.
在第一步配置中,我们将设置服务器的IP地址。
The Elasticsearch configuration file is available at /etc/elasticsearch/elasticsearch.yml.
Elasticsearch配置文件位于/etc/elasticsearch/elasticsearch.yml 。
Open your favorite text editor and edit this file.
打开您喜欢的文本编辑器并编辑此文件。
sudo vi /etc/elasticsearch/elasticsearch.yml
Go to the Network Module.
转到网络模块。
By default, the Network host address is not set. Set it by uncommenting the corresponding line and setting it to the desired IP Address.
默认情况下,未设置网络主机地址。 通过取消注释相应的行并将其设置为所需的IP地址来进行设置。
After editing, your file will look like this:
编辑后,您的文件将如下所示:
Save changes and exit the editor.
保存更改并退出编辑器。
Now, we have finished our bare-bones setup of Elasticsearch. We now just need to start our server!
现在,我们已经完成了Elasticsearch的基本设置。 现在,我们只需要启动服务器!
Start and enable the Elasticsearch service using systemctl
:
使用systemctl
启动并启用Elasticsearch服务:
sudo systemctl enable elasticsearch.servicesudo systemctl start elasticsearch.service
Now that we have started our server, we can now send requests to the Server to verify that it is working properly.
现在我们已经启动了服务器,我们现在可以向服务器发送请求以验证其是否正常运行。
You can verify that Elasticsearch is running by sending an HTTP request to port 9200 to your Server address (Mine is 192.168.0.1)
您可以通过将端口9200的HTTP请求发送到您的服务器地址来验证Elasticsearch是否正在运行(我的是192.168.0.1)
curl -X GET "192.168.0.1:9200/"
We will get an output response from the Server. It will look similar to this:
我们将从服务器获得输出响应。 它看起来类似于:
{ "name" : "BEwpV2R", "cluster_name" : "elasticsearch", "cluster_uuid" : "T-3S34LRQFqDeIGwQgD1xw", "version" : { "number" : "7.5.1", "build_flavor" : "default", "build_type" : "deb", "build_hash" : "d7d56a7", "build_date" : "2020-01-03T22:55:32.697037Z", "build_snapshot" : false, "lucene_version" : "8.0.0", "minimum_wire_compatibility_version" : "7.3.0", "minimum_index_compatibility_version" : "7.3.0-beta1" }, "tagline" : "You Know, for Search"}
Now that our server is working properly, we have successfully configured our Elasticsearch service, and we are now ready to use it!
现在我们的服务器可以正常工作,我们已经成功配置了Elasticsearch服务,现在可以使用它了!
In this tutorial, we learned how we could setup and install Elasticsearch on our Ubuntu 18.04 machine in just a few simple steps.
在本教程中,我们学习了如何仅需几个简单步骤就可以在Ubuntu 18.04计算机上设置和安装Elasticsearch。
翻译自:
转载地址:http://eumzd.baihongyu.com/