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! Tip: If your account has been inactive for more than 180 days, the system will automatically delete your account!

oksgo

Administrator

管理成员
贡献: 25%
注册
10 16, 2023
消息
1,351
G
354 G

安装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配置为仅在本地主机上侦听。
如果需要连接的客户端也在同一主机上运行,则无需更改默认配置文件。
 
docker 安装和 直接安装的区别大么?我看docker安装后 耗用服务资源小很多
 
docker 安装和 直接安装的区别大么?我看docker安装后 耗用服务资源小很多
docker安装也可以。
 
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 或者更大值。
 
肯定可以,一般建议设定成一样大小的值 要么Xms64m -Xmx64m 要么 Xms128m -Xmx128m 要么 Xms256m -Xmx256m 或者更大值。
搞定,由1g 改为128m 内存占用由65%降到37%(y)
 

Elasticsearch 7.x​

 

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'
 

相似主题

PHP 8.1 是 PHP 语言的重大更新。它包含许多新功能,许多高级框架需要服务器上有 PHP 8.1 才能运行所有功能。在开始安装之前首先要注意的是,Debian 9上的 PHP 8.1在下面的存储库中不再可用。 如果您需要 8+ 版本,最好将发行版更新到Debian 11 (bullseye) 或至少Debian 10 (buster),否则在Debian 9 上您将不得不满足于...
0
14
0
第 1 部分:安装 Fail2ban 第 1 步:更新Debian 在安装 Fail2Ban 之前,您必须更新Debian操作系统。这可确保所有现有软件包都是最新的,并且您运行的是最新版本的软件。要更新系统,请在终端中运行以下命令: sudo apt update sudo apt upgrade 该命令 sudo apt update 从存储库中检索最新的软件包信息,并将sudo apt...
0
7
0
很长时间没写文章了,这几天我安装了最新的xf2.3b2,因为2.3版本对系统有了更高的要求,我升级了mysql、php,但因我的虚拟机配置一般,打算使用docker 配置elasticsearch 7.17.18,供xf enhanced search 使用。 下面是我使用docker 安装 elasticsearch 7.17.18(设置服务访问密码)...
9
255
0
在您的系统上,如果您安装了多个版本的 PHP(例如 PHP 8.1、8.0、7.4、7.3、7.2、7.1 和 5.6),则默认情况下只有一个版本作为 Apache2 中的 PHP 版本。但是,如果您需要使用特定版本的 PHP 来执行当前任务,则无需删除所有其他版本。您只需将 PHP 版本切换为 Apache 中的默认版本即可。 假设您在我们的Debian系统上安装了 PHP...
0
12
0
第 1 步:更新包存储库。 首先,您需要更新系统软件包以确保您拥有最新版本。打开终端并运行以下命令: 代码: 更新系统软件包有助于避免兼容性问题并确保您拥有最新的安全补丁。 步骤 2. 安装依赖项。 bpftool 需要多个依赖项才能正常工作。通过运行以下命令来安装它们: Bash 此命令将安装必要的软件包,包括用于克隆 bpftool 存储库的 Git、构建工具以及编译 bpftool...
0
6
0
后退
顶部