elasticsearch
需要运行在java1.8
版本以上
java -version
如果jdk
不存在或者版本达不到要求,请自行百度google
处理
下载elasticsearch
下载地址:https://www.elastic.co/cn/downloads/elasticsearc
linux
下,解压到制定文件夹
tar -zxvf elasticsearch-7.1.1-linux-x86_64.tar.gz
进入目录,然后运行
./bin/elasticsearch
异常处理
- 直接运行会执行失败,我们需要在
config/elasticsearch.yml
文件中增加配置信息
vi config/elasticsearch.yml
#注意配置后边留有一个空格
#node.name: node-1
#cluster.initial_master_nodes: ["node-1"]
xpack.ml.enabled: false
network.host: 0.0.0.0 //外网可访问
http.port: 8301
#memory
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#增加elasticsearch-head 跨域处理
http.cors.enabled: true
http.cors.allow-origin: "*"
- 如果提示 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
# 在 /etc/sysctl.conf文件最后添加一行
vm.max_map_count=262144
sysctl -p
- 如果提示 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
# 在config/elasticsearch.yml中增加如下配置
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
- 如果提示无法分配空间
xpack.ml.enabled: false #比较暴力
- 注意:如果在运行是提示 java.lang.RuntimeException: can not run elasticsearch as root
# 需自己创建用户组和用户
groupadd es
useradd -g es es
su es
./bin/elasticsearch