地址:https://www.elastic.co/cn/downloads/elasticsearch
$> wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.1-linux-x86_64.tar.gz
$> tar -zxvf elasticsearch-7.12.1-linux-x86_64.tar.gz
elasticsearch不能以root权限来运行,会出现这种错误:Exception in thread “main” java.lang.RuntimeException: don’t run elasticsearch as root。
因为安全问题elasticsearch 不让用root用户直接运行,所以要创建新用户解决办法:
(1)创建用户
root$> adduser nn
(2)设置密码(连续输入两遍)
root$> passwd 123456
(3)root 用户给新增的用户添加权限(root 用户创建的文件其他用户是无权操作的)
root$> chown -R nn /你的elasticsearch安装目录
# 切换用户
root$> su nn
# 启动ES
nn$> ./bin/elasticsearch
修改 elasticsearch.yml
nn$>vim elasticsearch-7.12.1/config/elasticsearch.yml
# 加入以下配置
network.bind_host: 0.0.0.0
network.publish_host: elasticsearch所在的主机的ip
http.port: 9200
然后修改文件 /etc/sysctl.conf ,添加下面这个配置
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vm.max_map_count = 655360
root$> sysctl -p
of [2]: max file descriptors [4096] for elasticsearch process is too low, in
解决:切换到root 用户
root$> vi /etc/security/limits.conf
//在文件末尾添加下面的参数值
* soft nofile 65536
* hard nofile 131072
the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
解决:修改elasticsearch.yml
$> vim elasticsearch-7.12.1/config/elasticsearch.yml
# 加入以下配置
cluster.initial_master_nodes: ["node-1", "node-2"]
# 检查防火墙是否开启
root$> systemctl status firewalld
# 关闭防火墙
root$> systemctl stop firewalld
Linux 下载:
root$ > wget https://artifacts.elastic.co/downloads/kibana/kibana-7.12.1-linux-x86_64.tar.gz
Linux 解压:
root$ > tar -zxvf kibana-7.12.1-linux-x86_64.tar.gz
root$> chown -R nn ./kibana-7.12.1-linux-x86_64
root$> su nn
nn$> vim kibana-7.12.1-linux-x86_64/config/kibana.yml
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://localhost:9200"] # 配置 ES 连接地址
nn$> ./kibana-7.12.1-linux-x86_64/bin/kibana