1.前言
因为spring-boot-starter-data-elasticsearch中使用的es客户端版本不是所有的本只有,所以我们此次安装它所依赖的其中一个版本7.6.2.
1.linux上安装
1.1.下载elasticsearch和kibana
下载地址:官方历史版本下载地址
kibana下载和上面的相同,选择软件为kibana,版本为7.6.2,点击下载linux版本,完成后将两个tar包上传到linux上去,例如上传到路径:/opt/elk/
1.2.配置elasticsearch并启动
1.2.1.解压tar
cd /opt/elk/
tar -zxvf elasticsearch-7.6.2-linux-x86_64.tar.gz
1.2.2.修改elasticsearch.yml
cd /opt/elk/elasticsearch-7.6.2
vi elasticsearch.yml
修改内容为:
cluster.name: es-cluster
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
transport.tcp.port: 9300
http.port: 9200
network.host: 0.0.0.0
# es存放数据和log的path
path.data: /pub/es/data
path.logs: /pub/es/logs
http.max_content_length: 1024mb
# 集群中的单播,单节点可以不配置
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.zen.ping_timeout: 10s
discovery.zen.fd.ping_timeout: 10000s
# 开启用户名密码模式
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
1.2.3.修改limit.conf文件
vi /etc/security/limit.conf
在文件末尾添加:
* soft nofile 65536
* hard nofile 65536
1.2.4.修改sysctl.conf文件
vi /etc/sysctl.conf
在文件末尾添加:
vm.max_map_count=655360
添加完成后执行:
sysctl -p
1.2.5.启动es
注意:启动elastic的时候不能使用root用户,并且需要给path.data和path.logs路径下启动elastic的用户的所有权。
cd /opt/elk/elasticsearch-7.6.2
./bin/elasticsearch -d
1.2.6.初始化用户及密码
./bin/elasticsearch-setup-passwords interactive
1.2.7.验证elasticsearch
1.3.配置kibana并启动
1.3.1.解压tar
tar -zxvf kibana-7.6.2-linux-x86_64.tar.gz
1.3.2.修改kibana.yml
cd kibana解压目录/config
vi kibana.yml
配置文件修改为:
server.port: 5601
server.host: ”0.0.0.0”
# 安装的elastic的host:port
elasticsearch.hosts: [“http://localhost:9200”]
# 1.2.6设置的elastic用户名
elasticsearch.username: “******”
# 1.2.6设置的密码
elasticsearch.password: ”******”
1.3.3.启动kibana
cd kibana解压目录
nohup ./bin/kibana &
1.3.4.验证kibana
http:localhost:5601
输入elastic用户名密码,登录进去则成功