安装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->创建自定义用户"

相关推荐
wdfk_prog24 分钟前
GitHub push 失败:如何扫描并清理 Git 历史中的大文件
git·elasticsearch·github
mqiqe1 小时前
AgentScope Java 2.0 技能仓库(Skill Repository)完全实战指南
java·开发语言·elasticsearch
wangchunyu1143 小时前
Elasticsearch 入门与实战:Spring Boot 3 + ES 8 从零搭建商品搜索服务
大数据·数据库·spring boot·elasticsearch
隔窗听雨眠3 小时前
ARM架构下Logstash与Elasticsearch集群部署完全指南:从环境适配到生产验证
arm开发·elasticsearch·架构
小芒果_014 小时前
git常用命令速查
大数据·git·elasticsearch
2501_930472445 小时前
腾讯云助手规范化Git提交记录
git·elasticsearch·腾讯云
zhougl9966 小时前
Elasticsearch 超全入门实战教程
大数据·elasticsearch·搜索引擎
Elasticsearch1 天前
别再来一个 Log4Shell:深入解析 Log4j 2 反序列化允许列表绕过
elasticsearch
Elasticsearch1 天前
从建议到修复的 4 个阶段:使用 Elastic Workflows 实现人在回路中的自动化
elasticsearch
鲨鱼辣钊1 天前
FastAPI筑基_Day15_Alembic数据库迁移实战
数据库·elasticsearch·fastapi