您的当前位置:首页>全部文章>文章详情

【Elasticsearch】linux安装Elasticsearch及ik分词器

CrazyPanda发表于:2024-08-15 18:52:13浏览:248次TAG: #Elasticsearch

1. 资料准备

环境:docker创建的宝塔lnmp

es下载地址https://www.elastic.co/cn/downloads/past-releases#elasticsearch

ik下载地址https://release.infinilabs.com/analysis-ik/stable/

es和ik下载对应的版本,这里我下载的版本都是8.13.4

2. 安装elasticsearch

由于我是宝塔部署的环境,所以直接将es解压到了/www/elasticsearch目录,

解压完成后,在elasticsearch目录创建data文件夹,全部文件如下

[es@b7cad506ef39 elasticsearch]$ ll
total 2248
-rw-r--r--  1 es es    3860 Mar 22 11:34 LICENSE.txt
-rw-r--r--  1 es es 2251484 Mar 22 11:37 NOTICE.txt
-rw-r--r--  1 es es    9070 Mar 22 11:34 README.asciidoc
drwxr-xr-x  2 es es    4096 Mar 22 11:43 bin
drwxr-xr-x  4 es es    4096 Aug 19 18:41 config
drwxr-xr-x  5 es es    4096 Aug 20 09:26 data
drwxr-xr-x  8 es es    4096 Mar 22 11:43 jdk
drwxr-xr-x  5 es es    4096 Mar 22 11:43 lib
drwxr-xr-x  2 es es    4096 Aug 20 09:11 logs
drwxr-xr-x 81 es es    4096 Mar 22 11:43 modules
drwxr-xr-x  3 es es    4096 Aug 19 18:38 plugins

3. 配置elasticsearch

然后修改elasticsearch配置信息/www/elasticsearch/config/elasticsearch.yml

# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /www/elasticsearch/data
#
# Path to log files:
#
path.logs: /www/elasticsearch/logs

es升级到v8.x版本之后,自带有安全配置,把安全配置全部改为false,使用http才能访问成功

xpack.security.enabled: false

xpack.security.enrollment.enabled: false

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: false
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: false
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later

 

由于是虚拟环境,需要配置一下占用内存大小限制,修改/www/elasticsearch/config/jvm.options文件,将其改为512m

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms512m
-Xmx512m

4. 创建操作用户

es不允许root账号启动,创建其他用户密码。

[root@b7cad506ef39 elasticsearch]# adduser es
[root@b7cad506ef39 elasticsearch]# passwd es
Changing password for user es.
New password: 
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: 
passwd: all authentication tokens updated successfully.

授权es用户文件夹操作权限

[root@b7cad506ef39 elasticsearch]# chown es /www/elasticsearch -R
[root@b7cad506ef39 elasticsearch]# chown -R es:es /www/elasticsearch

5. 安装分词器ik

在elasticsearch安装目录plugins里,新建ik文件夹,将ik文件解压到ik文件夹里面,解压后文件如下

[es@b7cad506ef39 ik]$ ll
total 1548
-rw-r--r-- 1 es es 335042 Mar 29 11:52 commons-codec-1.11.jar
-rw-r--r-- 1 es es  61829 Mar 29 11:52 commons-logging-1.2.jar
drwxr-xr-x 2 es es   4096 Mar 12 15:12 config
-rw-r--r-- 1 es es   8172 Mar 29 11:53 elasticsearch-analysis-ik-8.13.0.jar
-rw-r--r-- 1 es es 780321 Mar 29 11:52 httpclient-4.5.13.jar
-rw-r--r-- 1 es es 328593 Mar 29 11:52 httpcore-4.4.13.jar
-rw-r--r-- 1 es es  47931 Mar 29 11:53 ik-core-1.0.jar
-rw-r--r-- 1 es es   1802 Mar 29 11:51 plugin-descriptor.properties
-rw-r--r-- 1 es es    125 Mar 29 11:51 plugin-security.policy

6.启动es

切换es用户,启动elasticsearch

[root@b7cad506ef39 elasticsearch]# su es
[es@b7cad506ef39 elasticsearch]$ ./bin/elasticsearch -d

启动成功后,使用apipost测试,显示如下信息表示访问成功

猜你喜欢

【数据库】MongoDB特点
MongoDB是一个基于分布式文件存储的开源数据库系统,其中主要特点包括:高性能:MongoDB提供高性能的数据插入和查询操作。高扩展性:MongoDB支持自动分片,可以横向扩展数据库的大小。易于使用:MongoDB支持多种编程语言,并提供简单易用的查询语言。五模式:MongoDB是无模式的,意味着它不要求数据结构严格遵守预定义的模式。复制集:MongoDB提供复制集功能,可以保证数据的高可用性。内置分析功能:MongoDB提供内置的数据分析功能,可以帮助开发者分析数据库性能。以下是一个简单的M
发表于:2024-06-20 浏览:228 TAG:
【ElasticSearch】ElasticSearch | ES常用查询命令汇总
原文链接https://zhuanlan.zhihu.com/p/651152005今天和大家分享ES中的查询命令。相信大家对SQL查询很熟悉,但是你知道如何在ES中实现SQL的select、where、group by等功能吗?下面分享一些ES中常用的查询命令,希望对你有所帮助。1.实现select功能:_source1.1 选择需要的字段GET dws_person_info/_search {    "_source":&nbs
发表于:2024-07-29 浏览:242 TAG:
【Elasticsearch】linux安装Elasticsearch及ik分词器
1. 资料准备环境:docker创建的宝塔lnmpes下载地址https://www.elastic.co/cn/downloads/past-releases#elasticsearchik下载地址https://release.infinilabs.com/analysis-ik/stable/ es和ik下载对应的版本,这里我下载的版本都是8.13.42. 安装elasticsearch由于我是宝塔部署的环境,所以直接将es解压到了/www/elasticsearch目录,解压完成后,在e
发表于:2024-08-15 浏览:249 TAG: #Elasticsearch
【ElasticSearch】Elasticsearch 操作语法全解
一个开源的分布式搜索引擎,可以用来实现搜索、日志统计、分析、系统监控等功能
发表于:2024-07-29 浏览:281 TAG: #Elasticsearch
【ElasticSearch】Elaticsearch8.9.0安装配置集群
下载安装包从官网下载8.9.0安装包# elasticsearch-8.9.0-x86_64.rpm  filebeat-8.9.0-x86_64.rpm  kibana-8.9.0-x86_64.rpm安装系统环境查看# cat /etc/redhat-release  Rocky Linux release 9.3 (Blue Onyx) # uname
发表于:2024-08-06 浏览:239 TAG: #Elasticsearch
【ElasticSearch】Elasticsearch常用工具清单
一、基础类工具1、Head插件  ES集群状态查看、索引数据查看、ES DSL实现(增、删、改、查),比较适用json串的格式化  参考地址:http://mobz.github.io/elasticsearch-head/2、kibana工具  除了支持各种数据的可视化之外,最重要的是:支持Dev Tool进行RESTFUL API增删改查操作。  ——比Postman工具和curl都方便很多。  参考地址:https://www.elasti
发表于:2024-07-29 浏览:263 TAG: