Elasticsearch学习笔记(初学) 1(linux)

Elasticsearch学习笔记(初学) 1(linux),第1张

Elasticsearch学习笔记(初学) 1(linux)

官方网址 : https://www.elastic.co/guide/en/elasticsearch/reference/7.16/rpm.html#rpm-repohttps://www.elastic.co/guide/en/elasticsearch/reference/7.16/rpm.html#rpm-repo

清华镜像: 

Index of /elasticstack/yum/elastic-7.x/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

ik分词

Releases · medcl/elasticsearch-analysis-ik · GitHubThe IK Analysis plugin integrates Lucene IK analyzer into elasticsearch, support customized dictionary. - Releases · medcl/elasticsearch-analysis-ikhttps://github.com/medcl/elasticsearch-analysis-ik/releases

 第一步 : 

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

第二步:

在/etc/yum.repos.d/ 目录创建 elasticsearch.repo

[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elasticstack/yum/elastic-7.x/
gpgcheck=0
enabled=1

 yum list | grep elasticsearch 查看安装版本

yum install elasticsearch-7.16.1

 第三步修改配置文件 /etc/elasticsearch/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-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
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: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- 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: 192.168.0.1
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: 9200
http.port: 9200
http.cors.enabled : true
http.cors.allow-origin : "*"
#
# 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"]
discovery.seed_hosts: ["121.196.351.102"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
cluster.initial_master_nodes: ["node-1"]
#
# 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

 然后运行 , 开启并查看状态

systemctl enable --now elasticsearch

systemctl start elasticsearch

systemctl status elasticsearch

 如果访问url无法响应可能是防火墙问题 , 可能是安全组问题

当报错如下 说明重装没有卸载干净 , 手动删除/var/lib/elasticsearch下面的node文件夹就好了

cannot downgrade a node from version [7.xx.x] to version [7.xx.x]

下面安装ik分词器

下载地址: https://github.com/medcl/elasticsearch-analysis-ikhttps://github.com/medcl/elasticsearch-analysis-ik

查看安装es的位置  我的centos8在  /usr/share/elasticsearch

运行命令   rpm -ql elasticsearch  查看

解压下载的ik到plugins目录

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5705660.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存