環境為centos 7,已經安裝了jdk7, jdk必須要安裝7及以上版本 1. 切換到非root用戶(目前的es不能使用root用戶) 1. 下載es並解壓: wget https://download.elasticsearch.org/elasticsearch/release/org/ela ...
環境為centos 7,已經安裝了jdk7, jdk必須要安裝7及以上版本
切換到非root用戶(目前的es不能使用root用戶)
下載es並解壓:
wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.2.1/elasticsearch-2.2.1.tar.gz tar -xvzf elasticsearch-2.2.1.tar.gz 我這裡是下載和解壓到當前用戶的home下麵
關閉防火牆
sudo systemctl stop firewalld.service
我用的是centos7所以用以上命令關閉,假如你用的是centos6可用以下命令
/etc/init.d/iptables stop //關閉防火牆服務 chkconfig –level 35 iptables off //永久關閉防火牆
運行
~/elasticsearch-2.2.1/bin/elasticsearch
以上命令是前端運行,關掉終端會結束進程,要後臺運行,並且把進程的pid列印到當前目錄的pid文件裡面,可以加參數運行如下
~/elasticsearch-2.2.1/bin/elasticsearch -d -p pid
檢查是否已經啟動
[hadoop@master ~]$ curl localhost:9200 { "name" : "Redeemer", "cluster_name" : "elasticsearch", "version" : { "number" : "2.2.1", "build_hash" : "d045fc29d1932bce18b2e65ab8b297fbf6cd41a1", "build_timestamp" : "2016-03-09T09:38:54Z", "build_snapshot" : false, "lucene_version" : "5.4.1" }, "tagline" : "You Know, for Search" }
註意:此時用外網或者區域網ip是不能訪問的,如果要訪問,按以下修改:
vim ~/elasticsearch-2.2.1/config/elasticsearch.yml 修改配置 network.host: 0.0.0.0
安裝head插件
插件安裝格式為:sudo bin/plugin install [org]/[user|component]/[version]
[hadoop@master ~]$ ~/elasticsearch-2.2.1/bin/plugin install mobz/elasticsearch-head -> Installing mobz/elasticsearch-head... Trying https://github.com/mobz/elasticsearch-head/archive/master.zip ... Downloading ...................................................................................................................................................... .................................................................................................................................................................. .................................................................................................................................................................. .................................................................................................................................................................. ........................DONE Verifying https://github.com/mobz/elasticsearch-head/archive/master.zip checksums if available ... NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify) Installed head into /home/hadoop/elasticsearch-2.2.1/plugins/head
關閉
- 在運行的時候如果加了-p參數,那es進程的pid會寫入參數指定的文件裡面,然後kill pid即可
還可以通過jps命令找到es的pid
[hadoop@master ~]$ jps 30462 Jps 23584 Elasticsearch