Elasticsearch安裝


1. 下載安裝包

下載elasticsearch:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz

https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticsearch/2.4.2/elasticsearch-2.4.2.rpm

https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.4.2/elasticsearch-2.4.2.tar.gz

下載ES-Hadoop:
https://www.elastic.co/downloads/hadoop

tar -zxvf elasticsearch-5.1.1.tar.gz
cd $ES_HOME/

vi config/elasticsearch.yml

cluster.name: my-application
node.name: node-1
network.host: 192.168.17.50
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.17.50"]
discovery.zen.minimum_master_nodes: 3

啟動elasticsearch

./bin/elasticsearch

以后台方式啟動elasticsearch

./bin/elasticsearch -d -p pid
kill `cat pid`

訪問測試一下:

curl http://192.168.17.50:9200

返回如下信息:安裝成功

{
  "name" : "SfD5sIh",
  "cluster_name" : "my-application",
  "cluster_uuid" : "cbvv-D-JS0WM5RWZypjNmw",
  "version" : {
    "number" : "5.1.1",
    "build_hash" : "5395e21",
    "build_date" : "2016-12-06T12:36:15.409Z",
    "build_snapshot" : false,
    "lucene_version" : "6.3.0"
  },
  "tagline" : "You Know, for Search"
}

處理啟動報錯一:

[2017-01-12T15:55:55,433][INFO ][o.e.b.BootstrapCheck     ] [SfD5sIh] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

  • 臨時提高了vm.max_map_count的大小,此操作需要root權限:
sudo  sysctl -w vm.max_map_count=262144
sysctl -a|grep vm.max_map_count
  • 永久修改vm.max_map_count:

解決:切換到root用戶修改配置sysctl.conf

vi /etc/sysctl.conf 
添加下面配置:
vm.max_map_count=655360
並執行命令:
sysctl -p
然后,重新啟動elasticsearch,即可啟動成功。

處理啟動報錯二:

2017-01-12T16:12:22,404][INFO ][o.e.b.BootstrapCheck     ] [SfD5sIh] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
initial heap size [536870912] not equal to maximum heap size [1073741824]; this can cause resize pauses and prevents mlockall from locking the entire heap

解決方法:
vi config/jvm.options

###-Xms 和 -Xmx需要配置的相等,不然無法啟動成功。
-Xms1024m
-Xmx1024m

參考官方資料地址:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM