麒麟V10系统安装部署elasticsearch

官方下载地址 :Download ElasticSearch
示例使用版本为7.17.18,jDK1.8

一、上传tar包

elasticsearch-7.17.18-linux-x86_64.tar.gz

二、解压服务包

复制代码
tar -xzf elasticsearch-7.17.18-linux-x86_64.tar.gz

[root@localhost elasticsearch-7.17.18]# ll
总用量 652
drwxr-xr-x  2 elasticsearch elasticsearch   4096  2月  2  2024 bin
drwxr-xr-x  3 elasticsearch elasticsearch    240 12月 11 10:23 config
drwxrwxr-x  3 elasticsearch elasticsearch     19 12月 11 10:25 data
drwxr-xr-x  8 elasticsearch elasticsearch     96  2月  2  2024 jdk
drwxr-xr-x  3 elasticsearch elasticsearch   4096  2月  2  2024 lib
-rw-r--r--  1 elasticsearch elasticsearch   3860  2月  2  2024 LICENSE.txt
drwxr-xr-x  2 elasticsearch elasticsearch   4096 12月 11 10:33 logs
drwxr-xr-x 61 elasticsearch elasticsearch   4096  2月  2  2024 modules
-rw-r--r--  1 elasticsearch elasticsearch 642830  2月  2  2024 NOTICE.txt
drwxr-xr-x  2 elasticsearch elasticsearch      6  2月  2  2024 plugins
-rw-r--r--  1 elasticsearch elasticsearch   2710  2月  2  2024 README.asciidoc
[root@localhost elasticsearch-7.17.18]# 

三、修改配置文件

conf/elasticsearch.yml

注意配置修改:
path.data:数据目录
path.logs:日志文件目录
network.host:网络地址
http.port:通信端口

固定写法配置:

复制代码
xpack.ml.enabled: false
ingest.geoip.downloader.enabled: false
discovery.type: single-node

完整配置:

复制代码
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /usr/local/elasticsearch/data
#
# Path to log files:
#
path.logs: /usr/local/elasticsearch/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 0.0.0.0
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 19250
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#
# ---------------------------------- Security ----------------------------------
#
#                                 *** WARNING ***
#
# Elasticsearch security features are not enabled by default.
# These features are free, but require configuration changes to enable them.
# This means that users don't have to provide credentials and can get full access
# to the cluster. Network connections are also not encrypted.
#
# To protect your data, we strongly encourage you to enable the Elasticsearch security features. 
# Refer to the following documentation for instructions.
#
# https://www.elastic.co/guide/en/elasticsearch/reference/7.16/configuring-stack-security.html
xpack.ml.enabled: false
ingest.geoip.downloader.enabled: false
discovery.type: single-node

四、创建elasticsearch用户

elasticsearch不支持使用root用户启动,故而需要新增一个用户启动

复制代码
# 创建用户组
sudo groupadd elasticsearch
# 创建用户并加入用户组
sudo useradd -g elasticsearch elasticsearch
# 配置用户目录权限
sudo chown -R elasticsearch:elasticsearch /path/to/elasticsearch

五、注册service服务

创建elasticsearch.service

注意修改elasticsearch目录:/opt/service/elasticsearch/bin/elasticsearch

将编辑好的elasticsearch.service上传至/etc/systemd/system目录下

复制代码
[Unit]
Description=elasticsearch
After=network.target

[Service]
Type=forking
User=elasticsearch
Group=elasticsearch
ExecStart=/opt/service/elasticsearch/bin/elasticsearch -d 
PrivateTmp=true
LimitNOFILE=65535
LimitNPROC=4096
LimitMEMLOCK=infinity
TimeoutStopSec=0
KillSignal=SIGTERM
SendSIGKILL=no
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

注册并启动服务

复制代码
# 加载systemd配置
sudo systemctl daemon-reload

# 启动服务
sudo systemctl start elasticsearch

# 查看服务状态
sudo systemctl status elasticsearch

# 停止服务
sudo systemctl stop elasticsearch

# 重启服务
sudo systemctl restart elasticsearch

六、验证服务

浏览器访问:http://ip:19250

输出以下信息证明服务正常

复制代码
{
  "name": "localhost.localdomain",
  "cluster_name": "elasticsearch",
  "cluster_uuid": "1wMz0HsrQRWAHLAEv7pSdA",
  "version": {
    "number": "7.17.18",
    "build_flavor": "default",
    "build_type": "tar",
    "build_hash": "8682172c2130b9a411b1bd5ff37c9792367de6b0",
    "build_date": "2024-02-02T12:04:59.691750271Z",
    "build_snapshot": false,
    "lucene_version": "8.11.1",
    "minimum_wire_compatibility_version": "6.8.0",
    "minimum_index_compatibility_version": "6.0.0-beta1"
  },
  "tagline": "You Know, for Search"
}
相关推荐
天赐学c语言8 分钟前
Linux - 网络应用层协议HTTP
linux·c++·网络服务
JiMoKuangXiangQu23 分钟前
Linux 锁 (3) - semaphore
linux·semaphore
学不完的23 分钟前
Docker 的安全优化
运维·安全·docker·容器·eureka
老星*24 分钟前
1Panel:现代化开源Linux服务器运维管理面板
运维·服务器·开源
七七powerful26 分钟前
运维养龙虾--使用腾讯workbuddy部署ssh-mcp-server允许通过 MCP 协议远程执行 SSH 命令
运维·ssh·ssh-mcp
twc82928 分钟前
打造专属 MCP Server 测试自动化的私有化解决方案
运维·软件测试·人工智能·自动化·mcp server
顶点多余31 分钟前
Linux中进程间通信 ---管道篇
linux·运维·服务器
zzzsde33 分钟前
【Linux】进程控制(2):进程等待&&进程替换
linux·服务器·网络
实在智能RPA35 分钟前
实在 Agent 支持哪些企业业务场景的自动化?全行业智能自动化场景深度拆解
java·运维·自动化
longxibo38 分钟前
【Ubuntu datasophon1.2.1 二开之八:验证实时数据入湖】
大数据·linux·clickhouse·ubuntu·linq