ElasticSearch是一個高可擴展的開源的全文搜索分析引擎。
它容許你快速的存儲、搜索和分析大量數據。ElasticSearch一般做爲後端程序,爲須要複雜查詢的應用提供服務。javaElasticsearch是一個基於Lucene的開源分佈式搜索引擎,具備分佈式多用戶能力。Elasticsearch是用java開發,提供Restful接口,可以達到實時搜索、高性能計算;同時Elasticsearch的橫向擴展能力很是強,不須要重啓服務,基本上達到了零配置。node
安裝JDK7及以上版本(這裏再也不講述JDK安裝步驟)bootstrap
下載ElasticSearch安裝包,點擊 獲取elasticsearch-2.1.1.tar.gz安裝包後端
運行下面命令將安裝包移動到 /opt 目錄,而後轉到 opt 目錄安全
mv elasticsearch-2.1.1.tar.gz /opt cd /opt解壓安裝包,而後重命名爲 elasticsearchapp
tar zxvf elasticsearch-2.1.1.tar.gz mv elasticsearch-2.1.1 elasticsearch進入elasticsearch/bin下運行elasticsearch腳本啓動elasticsearch
cd elasticsearch/bin ./elasticsearch
若是是用root帳號啓動,會報如下錯誤分佈式
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root. at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35) Refer to the log for complete error details.這是出於系統安全考慮設置的條件。因爲ElasticSearch能夠接收用戶輸入的腳本而且執行,爲了系統安全考慮,
建議建立一個單獨的用戶用來運行ElasticSearch性能建立elsearch用戶組及elsearch用戶ui
groupadd elsearch useradd elsearch -g elsearch -p elasticsearch更改elasticsearch文件夾及內部文件的所屬用戶及組爲elsearch:elsearch
cd /opt chown -R elsearch:elsearch elasticsearch切換到elsearch用戶再啓動
su elsearch cd elasticsearch/bin ./elasticsearch啓動後打印信息以下
[2015-12-30 10:15:44,876][WARN ][bootstrap ] unable to install syscall filter: prctl(PR_GET_NO_NEW_PRIVS): Invalid argument [2015-12-30 10:15:45,175][INFO ][node ] [Grim Hunter] version[2.1.1], pid[26383], build[40e2c53/2015-12-15T13:05:55Z] [2015-12-30 10:15:45,176][INFO ][node ] [Grim Hunter] initializing ... [2015-12-30 10:15:45,243][INFO ][plugins ] [Grim Hunter] loaded [], sites [] [2015-12-30 10:15:45,272][INFO ][env ] [Grim Hunter] using [1] data paths, mounts [[/ (/dev/mapper/vg_yong-lv_root)]], net usable_space [33.3gb], net total_space [49gb], spins? [no], types [ext4] [2015-12-30 10:15:47,318][INFO ][node ] [Grim Hunter] initialized [2015-12-30 10:15:47,318][INFO ][node ] [Grim Hunter] starting ... [2015-12-30 10:15:47,388][INFO ][discovery ] [Grim Hunter] elasticsearch/fnXUCLOQQBiC1aR7hhB82Q [2015-12-30 10:15:50,442][INFO ][cluster.service ] [Grim Hunter] new_master {Grim Hunter}{fnXUCLOQQBiC1aR7hhB82Q}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received) [2015-12-30 10:15:50,491][INFO ][node ] [Grim Hunter] started [2015-12-30 10:15:50,526][INFO ][gateway ] [Grim Hunter] recovered [0] indices into cluster_state
./elasticsearch -d