栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

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

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目录

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/707100.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号