【扫盲】elasticsearch(一)— 安装篇

302 阅读1分钟

下载安装包到elasticsearch目录

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

解压安装包

tar -zxvf elasticsearch-6.6.2.tar.gz

设置外网访问权限

cd elasticsearch-6.6.2/config 
vi elasticsearch.yml

修改配置项为:network.host:0.0.0.0

image.png

修改系统环境变量vm.max_map_count

vi /etc/sysctl.conf

末尾添加如下内容(需要重启后生效):

vm.max_map_count=262144

image.png

修改jvm分配大小

cd elasticsearch-6.6.2/config 
vi jvm.options

修改如下内容(注意Xms和Xmx要设置为一样,一般建议为内存的二分之一):

image.png

修改最大文件描述符数量和用户最大线程数

vi /etc/security/limits.conf

修改以下内容(各项大于如下配置既可):

* soft nofile 65536 
* hard nofile 65536 
* soft nproc 4096 
* hard nproc 4096

image.png

启动(禁止root启动)

cd elasticsearch-6.6.2/bin 
./elasticsearch -d

检查是否启动成功

ps -ef|grep elasticsearch

image.png