Linux 安装 elasticsearch
2018-11-20 本文已影响7人
SlowGO
下载
https://www.elastic.co/downloads/elasticsearch
解压
创建es工作目录(具体目录根据自己环境确定)
mkdir -p /data/es/data
mkdir -p /data/es/logs
解压到 /data/es
创建组和用户
groupadd elsearch
useradd elsearch -g elsearch
授权:
chown -R elsearch:elsearch /data/es
切换用户:
su - elsearch
修改配置文件
config/elasticsearch.yml 中以下几项(修改前最好先备份一份):
path.data
path.log
network.host
启动
bin/elasticesrarch
启动遇到错误
ERROR: [1] bootstrap checks failed
[1]: 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
- 回到 elsearch 用户重新启动
测试
访问:
curl ip:9200
如果正常会输出:
{
"name" : "yoCykGf",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "LKjpHZtaTPmd6_5q-RnrGQ",
"version" : {
"number" : "6.5.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "816e6f6",
"build_date" : "2018-11-09T18:58:36.352602Z",
"build_snapshot" : false,
"lucene_version" : "7.5.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}