elasticsearch kibana安装和配置


elasticsearch kibana安装和配置

================================

?Copyright 蕃薯耀 2021-02-20

https://www.cnblogs.com/fanshuyao/

一、kibana安装
1、解压kibana

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

2、修改文件夹名称和移动位置

mv kibana-6.8.13-linux-x86_64 /java/kibana6

3、修改配置文件

vi /java/kibana6/config/kibana.yml

修改内容:

server.port: 5601
server.host: "192.168.170.11"
elasticsearch.hosts: ["http://192.168.170.11:9200"]
elasticsearch.username: "user"
elasticsearch.password: "123456"
i18n.locale: "zh-CN"

二、kibana设置环境变量

1、配置kibana运行的环境变量,简化命令,设置后不用拼写完整路径:

vi /etc/profile

2、在文件的最后加上:

KIBANA_HOME=/java/kibana6/
PATH=$PATH:$KIBANA_HOME/bin
export KIBANA_HOME PATH

3、让环境变量配置立即生效:

source /etc/profile

三、启动kibana

/java/kibana6/bin/kibana

后台启动:

nohup /java/kibana6/bin/kibana >/dev/null &

查看进程:

ps -ef | grep kibana

设置了环境变量可直接:

kibana


启动成功:
log [01:33:52.710] [info][migrations] Finished in 527ms.
log [01:33:52.713] [info][listening] Server running at http://192.168.170.11:5601
log [01:33:52.971] [info][status][plugin:spaces@6.8.13] Status changed from yellow to green - Ready

四、访问验证
浏览器打开:

http://192.168.170.11:5601

五、开发者工具使用:
1、查询

GET .kibana_1/_search

2、插入数据

POST /mykibana/_doc
{
"id": 1001,
"name":"张三",
"birth": "2021-02-05",
"age": 15,
"score": 80.6
}

查询插入的数据

GET /mykibana/_search
POST /stu/_doc/1001
{
"id": 1001,
"name":"张三",
"birth": "2021-02-05",
"age": 15,
"score": 80.6,
"remark":"这是一个爱好乒乓球运动的学生,同时也喜欢玩电竞游戏和打橄榄球"
}
PUT /stu/_doc/1002
{
"id": 1002,
"name":"李四",
"birth": "2021-02-05",
"age": 16,
"score": 83.6,
"remark":"这是一个爱好极限冒险运动的学生,同时也喜欢玩王者荣耀"
}
PUT /stu/_doc/1003
{
"id": 1003,
"name":"王五",
"birth": "2021-02-05",
"age": 16,
"score": 70.6,
"remark":"这是一个爱好购物的学生,同时也喜欢睡懒觉,也不爱学习"
}
PUT /stu/_doc/1004
{
"id": 1003,
"name":"小红",
"birth": "2021-02-05",
"age": 14,
"score": 90.6,
"remark":"这是一个爱学习的学生,班里成绩最好的学生,当选为班长,爱好运动和吃东西"
}
PUT /stu/_doc/1005
{
"id": 1003,
"name":"小明",
"birth": "2021-02-05",
"age": 15,
"score": 88,
"remark":"这是一个成绩不好的学生,班里成绩最差的学生,平时好吃懒做,不爱运动,喜欢闹事,需要调整状态"
}

查看属性:

GET /stu/_mapping
{
"stu" : {
"mappings" : {
"_doc" : {
"properties" : {
"age" : {
"type" : "long"
},
"birth" : {
"type" : "date"
},
"id" : {
"type" : "long"
},
"name" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"remark" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"score" : {
"type" : "float"
}
}
}
}
}
}
GET /stu/_search

分析词

GET _analyze
{
"text": "this is a word"
}

GET _analyze
{
"text": "这是一个乒乓球比赛运动会,不相关人员禁止入内"
}

=============================================================

Linux操作命令:

u 撤销上一步的操作
Ctrl+r 恢复上一步被撤销的操作

(如果文章对您有所帮助,欢迎捐赠,^_^)

================================

?Copyright 蕃薯耀 2021-02-20

https://www.cnblogs.com/fanshuyao/