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