ElasticSearch5.2.2 安装(老版本)

https://www.elastic.co/downloads/elasticsearch
ElasticSearch是一个高可扩展的开源的全文搜索分析引擎。
它允许你快速的存储、搜索和分析大量数据。ElasticSearch通常作为后端程序,为需要复杂查询的应用提供服务。

检查 JDK版本
java -version  #确保是 1.7版本以上

下载解压并创建数据和log目录
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.2.tar.gz
tar -zxvf elasticsearch-5.2.2.tar.gz
cp -R /root/elasticsearch-5.2.2 /usr/local/elasticsearch

mkdir  -p /opt/elasticsearch/{data,logs}

配置es参数文件
vim /usr/local/elasticsearch/config/elasticsearch.yml
  http.port: 9200
  node.name: node-1
  cluster.name: es_cluster
  network.host: 172.31.107.59
  bootstrap.memory_lock: false
  bootstrap.system_call_filter: false
  path.data: /opt/elasticsearch/data
  path.logs: /opt/elasticsearch/logs


配置参数的冒号前后切记要加空格,否则会报错。
http://www.cnblogs.com/jiu0821/p/5624908.html

配置内存
vim /usr/local/elasticsearch/config/jvm.options
-Xms1024M
-Xmx1024M


配置环境变量
export ES_HOME=/usr/local/elasticsearch
source /etc/profile

添加独立用户---不要在root 用户下启动,不支持root  用户
groupadd elsearch
useradd elsearch -g elsearch
chown -R elsearch:elsearch /usr/local/elasticsearch
chown -R elsearch:elsearch /opt/elasticsearch

设置OS环境
vim /etc/security/limits.conf
 *  soft nofile 65536
 *  hard nofile 131072
 *  soft nproc 2048
 *  hard nproc4096

vim /etc/security/limits.d/90-nproc.conf
 *  soft nproc 2048

vim /etc/sysctl.conf
 vm.max_map_count=655360


最后执行 
sysctl -p

设置防火墙
iptables -I  INPUT -p tcp  --dport 9200 -j ACCEPT
iptables -I  INPUT -p tcp  --dport 9300 -j ACCEPT
service iptables save

.启动

复制代码
cd ../bin

//直接启动ElasticSearch
./elasticsearch 

//或者使用后台方式进行启动
./elasticsearch -d
复制代码

查看端口占用

netstat -anp|grep 9200 或lsof -i:9200 //看该进程是否正常运行

启动elasticsearch服务
sudo su elsearch
cd /usr/local/elasticsearch/bin
./elasticsearch -d -p pid

打开IE
http://172.31.107.59:9200/

{
  "name" : "node-1",
  "cluster_name" : "es_cluster",
  "cluster_uuid" : "_vUtFDlNQvS-QvEnADxk9A",
  "version" : {
    "number" : "5.2.2",
    "build_hash" : "f9d9b74",
    "build_date" : "2017-02-24T17:26:45.835Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.1"
  },
  "tagline" : "You Know, for Search"
}

参考:https://blog.csdn.net/zhaowenzhong/article/details/76041451
https://blog.csdn.net/zhaowenzhong/article/details/76041451

猜你喜欢

转载自www.cnblogs.com/micro-chen/p/11671736.html