Debian 10 安装 Elasticsearch 7.x

Tutorial/教程 Debian 10 安装 Elasticsearch 7.x

Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • 很荣幸 游客 的到来!开始前请阅读 社区规则 确保您顺利的熟悉本社区。注册用户可以提交资源,如果您有已发布资源的新版本,您可以随时更新版本!

    文件链接损坏,请在文件下方留言,我们将会及时更新来自备份服务器的新链接。提示:如果您的账户超过180天处于非活动状态,系统将自动删除您的账户!

  • 我们拥有多账户检测系统,对于重复注册我们将采取严厉措施!

    We have a multi account detection system, and we will take strict measures against duplicate registrations!

oksgo

Administrator

管理成员
贡献: 23%
注册
10 16, 2023
消息
1,175

安装Java​

Elasticsearch是一个Java应用程序,因此第一步是安装Java。

首先运行更新列表并安装更新
代码:
sudo apt-get update
sudo apt-get upgrade

然后以 root 或具有 sudo privileges 命令的用户身份运行以下命令以安装OpenJDK软件包:
代码:
sudo apt install default-jdk

通过输入下述指令来验证Java是否已安装:
代码:
java -version

输出应类似如下所示:
openjdk version "11.0.6" 2020-01-14OpenJDK Runtime Environment (build 11.0.6+10-post-Debian-1deb10u1)OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Debian-1deb10u1, mixed mode, sharing)

安装Elasticsearch​

在标准的Debian 10存储库中没有Elasticsearch。我们将从Elasticsearch APT存储库安装它。
使用以下wget命令导入存储库的公钥:
代码:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg

运行成功后没有输出,但来自此存储库的软件包已被视为受信任的软件包。

需要安装前置包:
代码:
sudo apt-get install apt-transport-https

通过运行以下命令将Elasticsearch存储库添加到系统中:
代码:
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list

随后安装Elasticsearch引擎:
代码:
sudo apt-get update && sudo apt-get install elasticsearch

安装过程完成后,启动并启用该服务
代码:
sudo systemctl enable elasticsearch.service --now

要验证Elasticsearch是否正在运行,请用于curl将HTTP请求发送到本地主机上的端口9200:
代码:
curl -X GET "localhost:9200/"

(提示command not found的请自行安装sudo apt install curl)

输出将如下所示:
代码:
{
"name" : "debian10.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "yCOOHdvYR8mHRs5mNXQdDQ",
"version" : {
"number" : "7.17.6",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "aa751e09be0a5072e8570670309b1f12348f023b",
"build_date" : "2020-02-29T00:15:25.529771Z",
"build_snapshot" : false,
"lucene_version" : "8.4.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}

服务可能需要5到10秒才能启动。如果看到curl: (7) Failed to connect to localhost port 9200: Connection refused,请等待几秒钟后重试。

要查看Elasticsearch服务记录的消息,请使用以下命令:
代码:
sudo journalctl -u elasticsearch


至此。Elasticsearch已成功安装在您的Debian服务器上。

配置Elasticsearch

Elasticsearch数据存储在/var/lib/elasticsearch目录中。
主要配置文件则位于/etc/elasticsearch中。
还可以在/etc/default/elasticsearch文件中配置Java启动选项。

默认情况下,Elasticsearch配置为仅在本地主机上侦听。
如果需要连接的客户端也在同一主机上运行,则无需更改默认配置文件。
 
ElasticSearch 安装好修改下使用内存,默认安装完应该是Xms4G -Xmx4G 没有大量内存用户建议设置小一些,Xms256m-Xmx256m 等,根据自身服务器空间设定合理的范围。然后重启ElasticSearch等待生效即可。
 
最后编辑:
ElasticSearch 安装好修改下使用内存,默认安装完应该是Xms4G -Xmx4G 没有大量用户建议设置小一些,Xms64m -Xmx256m 等,根据自身服务器空间设定合理的范围。然后重启ElasticSearch等待生效即可。
我安装的ElasticSearch 8 可以设置成Xms64m -Xmx256m 这么小么?
 
我安装的ElasticSearch 8 可以设置成Xms64m -Xmx256m 这么小么?
肯定可以,一般建议设定成一样大小的值 要么Xms64m -Xmx64m 要么 Xms128m -Xmx128m 要么 Xms256m -Xmx256m 或者更大值。
 

Install Java​

Elasticsearch is a Java application, so the first step is to install Java.

First run the update list and install the updates
代码:
***

Then run the following command as root or a user with sudo privileges to install the OpenJDK package:
代码:
***

Verify that Java is installed by typing:
代码:
***

The output should look similar to the following:
openjdk version "11.0.6" 2020-01-14OpenJDK Runtime Environment (build 11.0.6+10-post-Debian-1deb10u1)OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Debian-1deb10u1, mixed mode , sharing)

Install Elasticsearch​

There is no Elasticsearch in the standard Debian 10 repository. We will install it from the Elasticsearch APT repository.
Import the repository’s public key using the following wget command:
代码:
***

There is no output after running successfully, but packages from this repository have been considered trusted packages.

Need to install the pre-package:
代码:
***

Add the Elasticsearch repository to your system by running:
代码:
***

Then install the Elasticsearch engine:
代码:
***

After the installation process is complete, start and enable the service
代码:
***

To verify that Elasticsearch is running, use curl to send an HTTP request to port 9200 on localhost:
代码:
***

(If it says command not found, please install it yourself using sudo apt install curl)

The output will look like this:
代码:
***

The service may take 5 to 10 seconds to start. If you see curl: (7) Failed to connect to localhost port 9200: Connection refused, wait a few seconds and try again.

To view the messages logged by the Elasticsearch service, use the following command:
代码:
***


At this point. Elasticsearch has been successfully installed on your Debian server.

Configure Elasticsearch
Elasticsearch data is stored in the /var/lib/elasticsearch directory.
The main configuration files are located in /etc/elasticsearch.
You can also configure Java startup options in the /etc/default/elasticsearch file.

By default, Elasticsearch is configured to listen only on localhost.
If the client that needs to connect is also running on the same host, there is no need to change the default configuration file.
tankyou for post :)
 
请问elasticsearch8有吗😋😋
直接添加 8的存储库替换7的:
代码:
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" > /etc/apt/sources.list.d/elastic-8.x.list'
 

相似主题

很长时间没写文章了,这几天我安装了最新的xf2.3b2,因为2.3版本对系统有了更高的要求,我升级了mysql、php,但因我的虚拟机配置一般,打算使用docker 配置elasticsearch 7.17.18,供xf enhanced search 使用。 下面是我使用docker 安装 elasticsearch 7.17.18(设置服务访问密码)...
9
245
0
安装BBR,其实是一个升级内核和添加BBR功能的过程。 首先使用root用户登录服务器,然后在终端执行以下命令:
2
63
0
  • 置顶
一、XenForo 安装教程 1. 环境准备 1.1. 检查服务器配置确保你的服务器满足 XenForo 的系统要求: 操作系统:Linux(推荐),Windows 或 Mac OS 也可以使用。 Web 服务器:Apache 2.4 或 Nginx 1.18 及以上版本。 PHP:支持 PHP 7.4 至 PHP 8.2(推荐 PHP 8.0 或 8.1)。...
0
21
0
前言 以下未列出的系统/架构请尝试 支持系统: Ubuntu 18+, Debian 8+, Centos 7+, Fedora 33+, Almalinux 8.5+, OracleLinux 8+, RockyLinux 8+, AstraLinux CE, Arch 半支持系统: FreeBSD(前提已执行pkg install -y curl bash),Armbian 支持架构:...
0
75
0
在 XenForo 中,文件的哈希值用于确保文件的完整性,特别是在安装或升级 XenForo 时,系统会检查文件的哈希值是否与官方提供的哈希值一致。如果你手动修改了 XenForo 的文件,系统可能会检测到文件的哈希值与原来的不匹配,进而可能导致警告或功能问题。 要修改 XenForo 文件的哈希值,通常需要更新 XenForo 的文件校验数据。以下是一些方法和步骤: 1.绕过哈希值校验...
0
8
0
后退
顶部