授予用户某个文件夹权限
https://www.jianshu.com/p/4860932a5ede
[root@localhost ~]# useradd es
[root@localhost ~]# passwd es
Changing password for user es.
New password: 123456
Retype new password:
[root@localhost ~]# chmod 777 /usr/local 【授予es⽤户/usr/local⽬录可读可写可执⾏权限】
[root@localhost ~]# su - es
[es@localhost ~]$
检查JDK版本(需要JDK1.8+)
[es@localhost ~]# java -version
openjdk version "1.8.0_222-ea"
OpenJDK Runtime Environment (build 1.8.0_222-ea-b03)
OpenJDK 64-Bit Server VM (build 25.222-b03, mixed mode)
将ES的压缩包上传⾄/usr/local ⽬录并解压
[es@localhost local]$ tar -zxvf elasticsearch-7.6.1-linuxx86_
64.tar.gz
查看配置⽂件
[es@localhost local]# cd elasticsearch-7.6.1/config/
[es@localhost config]# ls
elasticsearch.yml jvm.options log4j2.properties role_mapping.yml
roles.yml users users_roles
修改 jvm.options
Elasticsearch基于Lucene的,⽽Lucene底层是java实现,因此我们需要配置jvm参数
[es@localhost config]# vim jvm.options
# 默认配置如下
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms1g
-Xmx1g
修改 elasticsearch.yml
修改集群节点信息
# ---------------------------------- Cluster -----------------------
------------17
cluster.name: my-application
# ------------------------------------ Node ------------------------
------------23
node.name: node-1
# --------------------------------- Discovery ----------------------
------------72
cluster.initial_master_nodes: ["node-1"]
修改数据⽂件和⽇志⽂件存储⽬录路径(如果⽬录不存在则需创建
[root@localhost config]# vim elasticsearch.yml
# ---------------------------- Paths ------------------------------
path.data: /usr/local/elasticsearch-7.6.1/data
path.logs: /usr/local/elasticsearch-7.6.1/logs
修改绑定的ip,默认只允许本机访问,修改为0.0.0.0后则可以远程访问
# ---------------------------- Network -----------------------------
-
# 默认只允许本机访问,修改为0.0.0.0后则可以远程访问
network.host: 0.0.0.0
⾸先⽤root⽤户登录,然后修改配置⽂件:
vim /etc/security/limits.conf
添加下⾯的内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 4096
* hard nproc 4096
vm.max_map_count:限制⼀个进程可以拥有的VMA(虚拟内存区域)的数量
继续修改配置⽂件, vim /etc/sysctl.conf 添加下⾯内容:
vm.max_map_count=655360
修改完成之后在终端执⾏
##然后执⾏命令
sysctl -p
重新返回es用户
su es
进⼊elasticsearch/bin⽬录运⾏
[es@localhost elasticsearch-7.6.1]# cd /usr/local/elasticsearch-
7.6.1/bin
[es@localhost elasticsearch-7.6.1]# ./elasticsearch
es8启动成功后会有一个密码记录下来后面登录要用
还有run kibana 那个密钥30分钟也要用
样子大概是这样的
-> Elasticsearch security features have been automatically configured!
-> Authentication is enabled and cluster connections are encrypted.
-> Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
RGiwCn4abvxC4CYHNqvU
-> HTTP CA certificate SHA-256 fingerprint:
d19444a525f78eb2d2cc54dd176a5ba19d622d6f140e172c86efeaccdac3fd3b
-> Configure Kibana to use this cluster:
* Run Kibana and click the configuration link in the terminal when Kibana starts.
* Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
eyJ2ZXIiOiI4LjAuMCIsImFkciI6WyIxNzIuMTkuNTEuNjU6OTIwMCIsIjE5Mi4xNjguMzEuMTE6OTIwMCIsIjE5Mi4xNjguMTA2LjE6OTIwMCIsIjE5Mi4xNjguMjMuMTo5MjAwIl0sImZnciI6ImQxOTQ0NGE1MjVmNzhlYjJkMmNjNTRkZDE3NmE1YmExOWQ2MjJkNmYxNDBlMTcyYzg2ZWZlYWNjZGFjM2ZkM2IiLCJrZXkiOiJ6TGhPOTM0QlBfcEVPS3pnVlhocTpNUmg0TnFqcVJvNm45R1ZHSFNPRllnIn0=
-> Configure other nodes to join this cluster:
* On this node:
- Create an enrollment token with `bin/elasticsearch-create-enrollment-token -s node`.
- Uncomment the transport.host setting at the end of config/elasticsearch.yml.
- Restart Elasticsearch.
* On other nodes:
- Start Elasticsearch with `bin/elasticsearch --enrollment-token <token>`, using the enrollment token that you generated.
第三个--->是密码
第五个 -->是密钥
真tm麻烦,记录一下