linux部署es,以及配套的kibana和ik

部署 Elasticsearch(ES)、Kibana 和 IK 分词插件(Elasticsearch 用于支持中文分词),需要以下步骤

1. 部署 Elasticsearch

1.1 下载和安装 Elasticsearch
bash 复制代码
# 添加 Elasticsearch GPG 密钥
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

# 添加 Elasticsearch 软件包源
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'

# 更新并安装 Elasticsearch
sudo apt update
sudo apt install elasticsearch
1.2 配置 Elasticsearch

编辑 Elasticsearch 的配置文件 /etc/elasticsearch/elasticsearch.yml,确保以下设置:

yaml 复制代码
# 设置集群名称
cluster.name: my-elasticsearch-cluster

# 设置节点名称
node.name: node-1

# 设置监听地址,允许远程访问
network.host: 0.0.0.0

# 设置端口,默认为9200
http.port: 9200
1.3 启动 Elasticsearch 服务
bash 复制代码
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch  # 设置开机自启
1.4 验证 Elasticsearch 是否正常运行

访问 http://<服务器IP>:9200,应该能看到类似以下输出:

json 复制代码
{
  "name" : "node-1",
  "cluster_name" : "my-elasticsearch-cluster",
  "version" : {
    "number" : "7.x.x",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "xxxxxxx",
    "build_date" : "xxxxxxx",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

2. 部署 Kibana

2.1 下载和安装 Kibana
bash 复制代码
# 添加 Kibana 软件包源
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'

# 更新并安装 Kibana
sudo apt update
sudo apt install kibana
2.2 配置 Kibana

编辑 Kibana 的配置文件 /etc/kibana/kibana.yml,确保以下设置:

yaml 复制代码
# 设置 Elasticsearch 地址
elasticsearch.hosts: ["http://localhost:9200"]

# 设置 Kibana 的监听地址
server.host: "0.0.0.0"

# 设置 Kibana 端口,默认为5601
server.port: 5601
2.3 启动 Kibana 服务
bash 复制代码
sudo systemctl start kibana
sudo systemctl enable kibana  # 设置开机自启
2.4 验证 Kibana 是否正常运行

访问 http://<服务器IP>:5601,应该能看到 Kibana 的登录页面。

3. 部署 IK 分词插件

IK 分词插件用于 Elasticsearch 的中文分词支持。

3.1 下载 IK 分词插件

下载适配你 Elasticsearch 版本的 IK 分词插件,例如:

bash 复制代码
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.x.x/elasticsearch-analysis-ik-7.x.x.zip
3.2 安装 IK 分词插件
bash 复制代码
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install file:///path/to/elasticsearch-analysis-ik-7.x.x.zip
3.3 重启 Elasticsearch
bash 复制代码
sudo systemctl restart elasticsearch

结论

通过以上步骤,你已经成功部署了 Elasticsearch、Kibana 和 IK 分词插件。确保配置正确,可以在 Kibana 中配置索引模式和可视化来探索和分析 Elasticsearch 中的数据。

相关推荐
充电zcx13 小时前
Linux:4:开发工具详解
linux·运维·服务器
码农客栈17 小时前
linux 交叉编译tslib
linux
鱼月半17 小时前
两台电脑直连网络不通怎么办?
linux·网络协议
光电笑映18 小时前
网络通信基础:从协议分层到 Socket 编程预备
linux·运维·服务器·网络
酸菜。18 小时前
dw_apb_gpio总结
linux
wunaiqiezixin19 小时前
MIT 6.S081 file system 实验篇(lab9):Large files (moderate)
linux·unix·os·xv6·mit6.s081
GeW19 小时前
RHCE 考试通过率提升:核心考点、实验环境与排错技巧
linux
吴声子夜歌20 小时前
Shell编程实例——与解析相关的任务(二)
linux·运维·shell
mengge.cloud20 小时前
0917Docker 小白实验教程(理论+实操)
linux·服务器·网络·docker
Escalating_xu20 小时前
【内存管理发展史】从 8086 实模式到分页:CPU 如何把虚拟地址变成物理地址
linux·缓存