一、安装jdk,至少须要jdk1.8版本node
二、下载elasticsearch 安装包vim
cd /usr/local/src ###若是没有安装wget 请安装(yum -y install wget) wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz
三、解压 elasticsearchbash
##建立目录,存放es安装位置 mkdir /usr/local/es ##解压elasticsearch安装包 tar -xvf elasticsearch-6.2.2.tar.gz -C /usr/local/es/
四、修改解压后的目录名称网络
cd /usr/local/es/ mv elasticsearch-6.2.2/ node-1
五、建立用户组和用户(elasticsearch不能用root用户启动)cors
##建立用户组 groupadd elasticsearch ##建立用户es 指定到elasticsearch用户组 并设置用户es的密码为es useradd es -g elasticsearch -p es ##给用户es受权可操做的目录 chown -R es:elasticsearch /usr/local/es
六、建立elasticsearch 的数据存放目录datajvm
su es mkdir /usr/local/es/node-1/data
七、编辑elasticsearch.yml文件elasticsearch
cd /usr/local/es/node-1/config/ vi elasticsearch.yml
##集群名称 cluster.name: es-cluster ##节点名称 node.name: node-1 ##网络监听地址 network.host: 192.168.56.101 http.port: 9200 ##使用head等插件监控集群信息,须要打开如下配置项 http.cors.enabled: true http.cors.allow-origin: "*" http.cors.allow-credentials: true
八、修改jvm.options插件
-Xms512m -Xmx512m
九、修改用户可用的最大线程数配置线程
##切换到root用户,编辑limits.conf 添加相似以下内容 su root ##编辑文件 vim /etc/security/limits.conf 编辑为以下内容 * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
十、编辑 vi /etc/sysctl.conf code
vm.max_map_count=655360
编辑完成后执行命令:
sysctl -p
十一、切换回es用户启动elasticsearch
su es cd /usr/local/es/node-1/bin ./elasticsearch
启动成功就是以上界面
若是要后台启动 在启动的时候后面加 -d参数便可
./elasticsearch -d