赞
踩
最大的坑:博主安装完 8.12.0 之后发现,IK分词器对应的版本还没有发行。。。。。。
以最新版本的 ES8.12.0 为基础
ES官网下载链接,选择你系统对应的下载包,注意版本
将文件上传到服务器,然后解压缩
tar -xvf elasticsearch-8.1.0-linux-x86_64.tar.gz
创建 Elasticsearch用户 并赋予 Elasticsearch安装目录 权限,这是 Elasticsearch 的一种安全措施(不能使用root
用户)
[root@glnode es]# useradd es
[root@glnode es]# passwd es
更改用户 es 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
修改文件夹权限
chown -R es:es /export/servers/elasticsearch-8.12.0
切换用户
su es
进入到对应的 config 目录,修改配置文件 elasticsearch.yml
[es@glnode07 elasticsearch-8.12.0]$ cd config/
[es@glnode07 config]$ vim elasticsearch.yml
网络配置修改:最初是全部注释掉的
开启 ES 的远程连接
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 0.0.0.0
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 9200
#
# For more information, consult the network module documentation.
然后启动就会报错。。。。。并且在对应平台报错误不同,看后面的常见问题部分进行对应配置修改,如果没有包含你的错误就去 google。
然后 加上 -d 参数,以后台方式启动
[es@glnode07 config]$ ./elasticsearch -d
新版的 ES 会自动生成用户和密码:用户名统一为 elastic,随机生成密码
通过下面命令可以修改密码
[es@glnode07 config]$ ./bin/elasticsearch-reset-password -u elastic -i
This tool will reset the password of the [elastic] user.
You will be prompted to enter the password.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:
Re-enter password for [elastic]:
Password for the [elastic] user successfully reset.
https://glnode07:9200/浏览器输入你的ip和9200端口,注意一定是https
第一次需要输入用户名和密码,看到如下页面说明成功
在 ES8 中默认配置是 https 访问,并且开启安全验证。可是我们自己做demo时并不想开启,过于麻烦。
xpack.security.enabled: false
xpack.security.http.ssl:
enabled: false
关于各个配置项含义可以查看官方文档
关闭服务是通过 jps 命令查看 ES 进程号,直接 kill -9 pid
重启之后,直接在服务器上 curl 命令即可
如果没有关闭 安全认证 或者 使用 https,这一步是会报错的
es 本身就提供了很多 RESTful 风格的接口,我们可以直接访问。
这里我是用 apipost 访问测试
若未关闭安全验证,这一步是会报错并提示你需要验证的
可以直接使用http访问,并且无需验证
修改 ES 文件夹的权限(需要用root用户)
chown -R es:es /usr/local/es
直接root执行下面命令,问题解决
sysctl -w vm.max_map_count=262144
实际上日志中显示 vm.max_map_count 默认设置为小。这最终导致了消息的级联问题。
这是由于修改远程登陆配置后默认以集群方式启动,所以需要修改为单节点启动
进入 elasticsearch.yml 文件修改配置,因为当前节点名默认为 node-1
cluster.initial_master_nodes: ["node-1"]
Kibana
是一个针对Elasticsearch
的开源分析及可视化平台
,使用Kibana可以查询、查看并与存储在ES索引的数据进行交互操作
,使用Kibana能执行高级的数据分析,并能以图表、表格和地图的形式查看数据。
官网下载链接,注意选择的版本一定要和 ES 相同版本,完全相同的版本号
同样上传到服务器,并且解压
[es@glnode07 servers]$ tar -zxvf kibana-8.12.0-linux-x86_64.tar.gz
然后修改权限
[root@glnode07 servers]# chown -R es:es /export/servers/kibana-8.12.0
配置允许远程连接
server.host: "0.0.0.0"
配置 ES 连接地址
elasticsearch.hosts: ["http://localhost:9200"]
使用以下命令可以在后台启动
[es@glnode07 bin]$ nohup ./kibana &
由于我们之前配置了,取消安全验证,所以启动后直接访问 http://glnode07:5601 即可
如果没有配置取消安全验证,会需要输入一个 token 和 code
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。