按照官方文档所示 在Centos8 LXC容器中部署kibani服务器
https://www.elastic.co/guide/cn/kibana/current/rpm.html
导入 Elastic PGP 密钥
下载并安装签名公钥:
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
从 RPM 仓库安装
在 /etc/yum.repos.d/
目录下新建一个 kibana.repo
文件,包含如下内容:
[kibana-6.x] name=Kibana repository for 6.x packages baseurl=https://artifacts.elastic.co/packages/6.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md
然后使用yum命令更新yum仓库,并安装Kibana
yum update yum install kibana
安装好之后,
使用 systemd
运行 Kibana
配置 Kibana 开机自动启动,执行以下命令:
sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable kibana.service
Kibana 启动和停止命令如下:
sudo systemctl start kibana.service sudo systemctl stop kibana.service
RPM 文件目录
在 RPM 包中,会把配置文件、日志和数据目录放在如下位置:
类型 | 描述 | 默认位置 | 设置 |
---|---|---|---|
home | Kibana home 目录或 $KIBANA_HOME 。 |
/usr/share/kibana |
|
bin | 二进制脚本,包括 kibana 启动 Kibana server 和 kibana-plugin 安装插件。 |
/usr/share/kibana/bin |
|
config | 配置文件,包括 kibana.yml 。 |
/etc/kibana |
|
data | Kibana 和其插件写入磁盘的数据文件位置。 | /var/lib/kibana |
|
optimize | 编译过的源码。某些管理操作(如,插件安装)导致运行时重新编译源码。 | /usr/share/kibana/optimize |
|
plugins | 插件文件位置。每一个插件都有一个单独的二级目录。 | /usr/share/kibana/plugins |
安装好之后修改config文件,在/etc/kibana下面的kibana.yml文件
修改server.host项将
server.host: "localhost" 改为 server.host: "192.168.20.16"
否则kibana默认只允许localhost访问,外部无法连接kibana
改完之后启动发现,一直报错
"message":"Unable to revive connection: http://192.168.20.16:9200/"} "message":"No living connections"}
连接后提示Kibana server is not ready yet
看起来像少了点什么东西
然后又去查了一遍官方文档,原来是需要一个索引工具Elasticsearch配合进行使用的
然后下面我们安装Elasticsearch
可以根据以下官方文档连接进行安装部署
https://www.elastic.co/guide/cn/elasticsearch/guide/current/running-elasticsearch.html https://www.elastic.co/guide/en/elasticsearch/reference/7.13/rpm.html#rpm
导入 Elasticsearch PGP 密钥
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
从 RPM 仓库安装
在 /etc/yum.repos.d/
目录下新建一个 elasticsearch.repo 文件,包含如下内容:
[elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md
然后安装elasticsearch,并启用开机自启,并运行
yum install --enablerepo=elasticsearch elasticsearch systemctl enable elasticsearch.service systemctl start elasticsearch.service
然后检查elasticsearch是否正常运行
curl -i 127.0.0.1:9200
如果回显以下内容,基本上就运行正常了
[root@Kibana yum.repos.d]# curl -i 127.0.0.1:9200 HTTP/1.1 200 OK Warning: 299 Elasticsearch-7.13.2-4d960a0733be83dd2543ca018aa4ddc42e956800 "Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security." content-type: application/json; charset=UTF-8 content-length: 535 { "name" : "Kibana", "cluster_name" : "elasticsearch", "cluster_uuid" : "9i2erLOjQkq2pvkygpmnag", "version" : { "number" : "7.13.2", "build_flavor" : "default", "build_type" : "rpm", "build_hash" : "4d960a0733be83dd2543ca018aa4ddc42e956800", "build_date" : "2021-06-10T21:01:55.251515791Z", "build_snapshot" : false, "lucene_version" : "8.8.2", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }
然后再打开你的Kibana
就可以正常访问啦