一、下载

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.tar.gz

二、解压

tar -zxvf elasticsearch-6.5.4.tar.gz

三、创建新用户并附文件权限(root用户无法启动)

useradd suxiaodong

chown -R suxiaodong /usr/local/elasticsearch

后续操作均切换suxiaodong用户进行,su suxiaodong

四、修改远程访问配置(默认只允许本机访问)

 修改 Elasticsearch 安装目录中的config/elasticsearch.yml文件,去掉network.host的注释,将它的值改成0.0.0.0

五、启动

 ./bin/elasticsearch

后台方式启动: ./bin/elasticsearch  -d

访问http://47.94.145.253:9200/即可验证

 

六、常见问题

1、调整jvm内存参数:

vi config/jvm.options

-Xms128m

-Xmx128m

2、max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

解决:执行下面的命令:

sudo sysctl -w vm.max_map_count=262144
3、

[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [3882] for user [suxiaodong] is too low, increase to at least [4096]

解决:

sudo vim /etc/security/limits.conf

在limits.conf最下方加入下面4行

suxiaodong hard nofile 65536
suxiaodong soft nofile 65536
suxiaodong hard nproc 5000
suxiaodong soft nproc 5000

重启服务器

 七、head工具安装:

github地址:https://github.com/mobz/elasticsearch-head

推荐chrome插件方式安装