linux下安装elasticsearch及ik分词器

linux下安装elasticsearch及ik分词器

安装版本

linux版本:centos7.5

es版本:elasticsearch-7.14.0-linux-x86_64.tar.gz

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

Ik版本:elasticsearch-analysis-ik-7.14.0

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

安装步骤

安装es不能使用root用户,需要创建非root用户运行ES。此处创建普通用户elastic

#添加用户

bash 复制代码
useradd elastic

#修改密码

bash 复制代码
passwd elastic(用户名)

然后输入密码

#赋权

bash 复制代码
chown -R elastic:elastic /usr/local/elastic/elasticsearch-7.14.0

后续安装及启动都需要以该用户进行操作。

通过远程管理工具,将压缩包拷贝到Linux服务器中,执行解压操作后修改配置文件

config目录下,修改elasticsearch使用内存大小-Xms1g -Xmx1g
bash 复制代码
vim jvm.options


config目录下elasticsearch.yml配置文件,增加以下配置:
yaml 复制代码
http.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
配置es自带jdk环境
bash 复制代码
vim /etc/profile
export ES_JAVA_HOME=指定为ES安装目录中jdk目录
source /etc/profile

我这里es自带的jdk是下面这个路径

bash 复制代码
export ES_JAVA_HOME=/usr/local/elastic/elasticsearch-7.14.0/jdk
启动

/usr/local/elastic/elasticsearch-7.14.0/bin目录下执行:

bash 复制代码
./elasticsearch -d

启动后,浏览器或者后台访问http://ip:9200,能够正常显示如下版本信息说明es安装成功。

启动后,配置用户

执行以下命令,按照提示依次输入elastic、apm_system、kibana、logstash_system、beats_system、remote_monitoring_user这6个用户的密码

bash 复制代码
./elasticsearch-setup-passwords interactive
安装ik分词器

将elasticsearch-analysis-ik-7.14.0.zip上传到/usr/local/elastic/elasticsearch-7.14.0/plugins目录下解压后,重启es即可。

相关推荐
AlfredZhao7 小时前
Docker 容器时区不对,`timedatectl` 不存在怎么办?
linux·timezone
Elasticsearch1 天前
3个信号、2个环境变量、0个采集器:使用 Python 和 Elastic 的托管 OTLP 端点实现 OpenTelemetry
elasticsearch
zzzzzz3102 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode2 天前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
A小辣椒3 天前
TShark:Wireshark CLI 功能
linux
Elasticsearch3 天前
如何通过 Claude Code 来写入 CSV 数据到 Elasticsearch
elasticsearch
A小辣椒4 天前
TShark:基础知识
linux
AlfredZhao4 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao4 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi