安装ElasticSearch、Kibana

一、安装 ElasticSearch

1.1 安装 ES

text 复制代码
// 待补充
// aHR0cHM6Ly93d3cuYmlsaWJpbGkuY29tL3ZpZGVvL0JWMWI4NDExWjd3NT9zcG1faWRfZnJvbT0zMzMuNzg4LnBsYXllci5zd2l0Y2gmdmRfc291cmNlPTIwNWQxYTUyYzhmMmRlMDQ0MDM2ODk0OTEzZGQ3MzhjJnA9NQ==

1.2 创建自定义用户:

shell 复制代码
# 进入 ES 容器
docker exec -it es bash
# 创建用户
bin/elasticsearch-users useradd 用户名
# 角色赋权
bin/elasticsearch-users roles -a superuser 用户名
bin/elasticsearch-users roles -a kibana_system 用户名

1.3 安装中文分词器

1.3.1 ik 分词器 Github地址:https://github.com/infinilabs/analysis-ik
shell 复制代码
# 进入 ES 容器
docker exec -it es bash
# 安装
bin/elasticsearch-plugin install https://get.infini.cloud/elasticsearch/analysis-ik/8.16.0  # ik版本需与elasticsearch 版本好一致
1.3.2 ik 分词器没有与当前 ES一样的版本,怎么办?

ik 安装包地址:https://release.infinilabs.com/analysis-ik/stable/

shell 复制代码
# 下载安装包: elasticsearch-analysis-ik-8.15.3.zip
# 解压并重新命令为:analysis-ik
# 上传到 ES 容器 plugins 目录下
cd plugins/analysis-ik
vim plugin-descriptor.properties
# 修改版本:保持与 ES 版本一致
version=8.16.0
elasticsearch.version=8.16.0
# 重启 ES
1.3.3 测试

使用 Kibana 的 DevTools 中测试 ik_smart:

shell 复制代码
POST /_analyze
{
  "text":"我是一名go和php程序猿",
  "analyzer":"ik_smart"
}

结果:

shell 复制代码
{"tokens":[{"token":"我","start_offset":0,"end_offset":1,"type":"CN_CHAR","position":0},{"token":"是","start_offset":1,"end_offset":2,"type":"CN_CHAR","position":1},{"token":"一名","start_offset":2,"end_offset":4,"type":"CN_WORD","position":2},{"token":"go","start_offset":4,"end_offset":6,"type":"ENGLISH","position":3},{"token":"和","start_offset":6,"end_offset":7,"type":"CN_CHAR","position":4},{"token":"php","start_offset":7,"end_offset":10,"type":"ENGLISH","position":5},{"token":"程序","start_offset":10,"end_offset":12,"type":"CN_WORD","position":6},{"token":"猿","start_offset":12,"end_offset":13,"type":"CN_CHAR","position":7}]}

二、安装 Kibana

2.1 安装 Kibana(Windows版)

1、下载地址:https://www.elastic.co/cn/downloads/kibana

2、修改配置:

shell 复制代码
cd D:\kibana-8.15.3\config # 根据实际安装目录修改
vim kibana.yml

# 修改配置信息
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://ip:9200"]
elasticsearch.username: "jason" # 不可以是 elastic
elasticsearch.password: "123456"

三、 问题汇总

Q:FATAL Error: [config validation of [elasticsearch].username]: value of "elastic" is forbidden. This is a superuser account that cannot write to system indices that Kibana needs to function. Use a service account token instead.

A:界面会显示:Kibana server is not ready yet,这是因为 es 不允许使用 elastic 用户登录 kibana,参考 "安装 ElasticSearch->创建自定义用户"

相关推荐
margu_16812 小时前
【Elasticsearch】es7.2 跨集群迁移大量数据方法二
elasticsearch
恼书:-(空寄13 小时前
深入理解 Elasticsearch 写入与查询机制
大数据·elasticsearch·搜索引擎
Elastic 中国社区官方博客1 天前
快速 vs. 准确:衡量量化向量搜索的召回率
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索
1104.北光c°1 天前
深入浅出 Elasticsearch:从搜索框到精准排序的架构实战
java·开发语言·elasticsearch·缓存·架构·全文检索·es
IDIOT___IDIOT1 天前
关于 git 进行版本管理的时候 gitignore 写入忽略规则而不生效的问题
大数据·git·elasticsearch
不想看见4041 天前
Git 误删急救手册
大数据·git·elasticsearch
2401_891655811 天前
Git误操作急救手册大纲
大数据·elasticsearch·搜索引擎
贺小涛2 天前
Git代码提交规范和踩坑排水明沟
大数据·git·elasticsearch
逸Y 仙X2 天前
文章十一:ElasticSearch Dynamic Template详解
java·大数据·数据库·elasticsearch·搜索引擎·全文检索