文档集合:
- elasticsearch文档
https://www.elastic.co/guide/cn/elasticsearch/guide/current/running-elasticsearch.html - kibana 安装文档
https://www.elastic.co/guide/en/kibana/4.6/setup-repositories.html
华为镜像
https://mirrors.huaweicloud.com/elasticsearch/7.8.0/
https://mirrors.huaweicloud.com/kibana/7.8.0/
java安装
java 14
下载:
链接: https://pan.baidu.com/s/1zewucsJdxchuhWloGPcc9Q 提取码: zvmc
rpm -ivh jdk14.0.2.rpm
vim /etc/profile
增加如下:
export JAVA_HOME=/usr/java/jdk-14.0.2
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
测试:
source /etc/profile
java -version
elasticsearch安装
下载elasticsearch
wget https://mirrors.huaweicloud.com/elasticsearch/7.8.0/elasticsearch-7.8.0-linux-x86_64.tar.gz
或者网盘下载:链接: https://pan.baidu.com/s/1Kev8OJjOM1sGAb-mIM09aw 提取码: h7ey
其他版本的话自行去官网下
创建用户:
adduser es
passwd es
tar xvzf elasticsearch-7.6.2-linux-x86_64.tar.gz
mv elasticsearch-7.6.2-linux-x86_64 /home/es
chown -R es /home/es elasticsearch-7.6.2-linux-x86_64
su es
cd ~/elasticsearch-7.6.2-linux-x86_64/bin
./elasticsear
wget https://mirrors.huaweicloud.com/kibana/7.8.0/kibana-7.8.0-x86_64.rpm
rpm -ivh kibana-7.8.0-x86_64.rpm
systemctl enable kibana.service
systemctl start kibana.service
vi /etc/kibana/kibana.yml
systemctl restart kibana.service
设置Kibana为中文
kibana默认是英文,在配置文件里可以配置为中文
找到il8n.locale节点,取消注释,将en,设置为 zh-CN
CentOS 8 安装 Kibana 7.8-程序旅途
保存退出,重启kibana服务
启动脚本
cd /etc/init.d
vim elasticsearch
#!/bin/bash
#chkconfig: 345 63 37
#description: elasticsearch
#processname: elasticsearch-7.8.0
export ES_HOME=/home/es/elasticsearch-7.8.0
case $1 in
start)
su es<<!
cd $ES_HOME
./bin/elasticsearch -d -p pid
exit
!
echo "elasticsearch is started"
;;
stop)
pid=`cat $ES_HOME/pid`
kill -9 $pid
echo "elasticsearch is stopped"
;;
restart)
pid=`cat $ES_HOME/pid`
kill -9 $pid
echo "elasticsearch is stopped"
sleep 1
su es<<!
cd $ES_HOME
./bin/elasticsearch -d -p pid
exit
!
echo "elasticsearch is started"
;;
*)
echo "start|stop|restart"
;;
esac
exit 0
注意上面用户和路径修改为你自己安装的路径
chmod +x elasticsearch
service elasticsearch start
ps -ef | grep elasticsearch
//开机启动
chkconfig --add elasticsearch
chkconfig elasticsearch on
跳坑记录
- sql无法用offset, limit 0,10也不行,所以sql只能用于固定数量的查询,不能用于列表
- 索引字段类型问题,text类型无法用于聚合查询,如果需要聚合查询,需要设置fileddata为true
curl -X PUT "localhost:9200/索引名/_mapping?pretty" -H 'Content-Type: application/json' -d'
{
"properties": {
"字段类型": {
"type": "text",
"fielddata": true
}
}
}
'