我是靠谱客的博主 务实发箍,最近开发中收集的这篇文章主要介绍Elasticsearch 入门之单机版安装部署,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

  • 下载安装包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.14.0-linux-x86_64.tar.gz
  • 解压&修改配置文件
tar -zxvf elasticsearch-7.14.0-linux-x86_64.tar.gz -C /home/soft
cp config/elasticsearch.yml config/elasticsearch.yml.bak
  • 修改系统配置

1、vim /etc/sysctl.conf

vm.max_map_count=655360

执行

sysctl -p

2、vim /etc/security/limits.conf

* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
  • vim elasticsearch.yml 添加以下内容
# ======================== 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-es-cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-es
#
# 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: /home/es/elasticsearch-7.14.0/data
#
# Path to log files:
#
path.logs: /home/es/elasticsearch-7.14.0/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
#
# 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: 192.168.41.137
#
# 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: 9200
#
# 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: ["192.168.41.137"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["192.168.41.137"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#是否启用节点上ES的XPACK安全功能,默认为true
xpack.security.enabled: false

#下面几项需要开始安全认证时打开,开启时访问页面需要输入用户名及密码,用户为:elastic
#xpack.security.enabled: true
#xpack.security.transport.ssl.enabled: true
#xpack.security.transport.ssl.verification_mode: certificate
#xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
#xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
  • 开启 Elasticsearch 安全功能
./bin/elasticsearch-certutil cert -out config/elastic-certificates.p12 -pass "123456"
./bin/elasticsearch-setup-passwords interactive
  • 启动es服务
./bin/elasticsearch -d
  • 验证是否启动成功
ps -ef| grep elasticsearch
#开启认证时
curl --user elastic:123456 192.168.0.36:9200
#未开启时
curl 192.168.0.36:9200

提示如下信息es则启动成功!

{
  "name" : "node-es",
  "cluster_name" : "my-es-cluster",
  "cluster_uuid" : "6ari_8AATSeZ0NB9XZyM-Q",
  "version" : {
    "number" : "7.14.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "dd5a0a2acaa2045ff9624f3729fc8a6f40835aa1",
    "build_date" : "2021-07-29T20:49:32.864135063Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

最后

以上就是务实发箍为你收集整理的Elasticsearch 入门之单机版安装部署的全部内容,希望文章能够帮你解决Elasticsearch 入门之单机版安装部署所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部