下载

华为镜像

页面地址

https://mirrors.huaweicloud.com/kibana/7.6.2/

直接下载

wget https://mirrors.huaweicloud.com/kibana/7.6.2/kibana-7.6.2-linux-x86_64.tar.gz

解压

tar -zxvf kibana-7.6.2-linux-x86_64.tar.gz

配置

外部访问

修改 config/kibana.yml

server.host: "0.0.0.0"

汉化

修改 config/kibana.yml

i18n.locale: "zh-CN"

启动

cd kibana-7.6.2-linux-x86_64
bash bin/kibana

简单测试

# 创建索引
# number_of_replicas  备份数
# number_of_shards    分片数
PUT /sk
{
  "settings": {
    "number_of_replicas": 1,
    "number_of_shards": 1
  }
}

GET /sk

GET /sk/_settings

# 删除索引
DELETE /sk

# 分词器
## 最少切分
GET /_analyze
{
  "analyzer": "ik_smart",
  "text": "时空旅行者"
}
## 最细粒度划分
GET /_analyze
{
  "analyzer": "ik_max_word",
  "text": "时空旅行者"
}

# /索引名/_doc/文档id
PUT /test1/_doc/1
{
  "name": "时空",
  "age": "22"
}

GET /test1/_doc/1

# 设定类型
PUT /test2
{
  "mappings": {
    "properties": {
      "name":{
        "type": "text"
      },
      "age":{
        "type": "integer"
      },
      "birthday":{
        "type": "date"
      },
      "tags":{
        "type": "text"
      }
    }
  }
}
# 可新增 也可 更新 会清空原有数据
PUT /test2/_doc/1
{
  "name":"时空",
  "age":22,
  "birthday":"1999-07-10",
  "tags":["前端","后端","全栈","信安"]
}
GET /test2/_doc/1
# 仅更新 仅修改指定数据(推荐)
POST /test2/_update/1
{
  "doc":{
      "name":"时空旅行者"
  }
}
PUT /test2/_doc/2
{
  "name":"张三",
  "age":0,
  "birthday":"1900-01-01",
  "tags":["法外狂徒"]
}
GET /test2/_doc/1
# 模糊搜索
GET /test2/_search
{
  "query": {
    "match":{
      "name": {
        "query": "时空", 
        "fuzziness": "auto"
      }
    }
  }
}
# 查看索引文档数量
GET /_cat/indices/test2?format=json
# 获取索引默认信息
GET /test2
# 删除数据
DELETE /test2/_doc/1
DELETE /test2

# 查看 es 当前信息
GET /_cat/health
GET /_cat/indices

Docker-Compose

version: "3"
services:
  kibana:
    image: kibana:7.17.1
    #image: arm64v8/kibana:7.17.1
    container_name: kibana
    restart: always
    ports:
      - '5601:5601'
    volumes:
      - '/mnt/sk-w/Docker/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml'

配置文件

server.host: "0.0.0.0"
i18n.locale: "zh-CN"
elasticsearch.hosts: 
  - "http://es01:9200"
elasticsearch.username: "elastic"
elasticsearch.password: "123+AbC"