elasticSearch2.4.1安裝筆記

1.Elasticsearch安裝

參考地址:https://www.elastic.co/guide/en/elasticsearch/reference/2.4/_installation.htmlhtml

  1.   下載地址:https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.4.1/elasticsearch-2.4.1.tar.gz
  2.   下載後解壓到指定的目錄
  3.   修改elasticsearch的配置文件(以集羣爲例)
vim /opt/elasticsearch-2.4.1/config/elasticsearch.yml
#(此配置文件中,開頭不能有空格,冒號後面要空一格)

cluster.name: shunyou-elasticsearch #(集羣中這個名字要一致)

node.name: node-1 #(集羣中,這個節點名每一個節點名稱惟一)

network.host: 192.168.0.1 #(綁定當前ip)

discovery.zen.ping.unicast.hosts: ["host1", "host2"] #(配置集羣中的主節點有哪些)

discovery.zen.minimum_master_nodes: 2 #(配置集羣中最小主節點數量[(total number of nodes / 2 + 1)])

discovery.zen.ping_timeout: 30s #(配置集羣中主節點被選舉或加入超時時間,更高的值確保更少的失敗機會)

  安裝插件:(推薦離線安裝,在線安裝網絡太慢)

    安裝elasticsearch-head插件:

  1. 從GitHub上下載:https://github.com/mobz/elasticsearch-head/archive/master.zip
  2. 下載上一步的文件到指定目錄
  3. 安裝elasticsearch-head插件:
  4. /opt/elasticsearch-2.4.1/bin/plugin install file:///opt/elasticsearch-head-master.zip
  5. 啓動elasticsearch(不能以root用戶啓動,須要創建相應的用戶):
  6. /opt/elasticsearch-2.4.1/bin/elasticsearch
  7. 或者
  8. /opt/elasticsearch-2.4.1/bin/elasticsearch -d (後臺守護進程的方式啓動)

瀏覽器訪問節點:node

http://192.168.0.204:9200/linux

http://192.168.0.204:9200/_plugin/head/git

http://192.168.0.204:9200/_cluster/health?pretty=truegithub

http://192.168.0.204:9200/_nodes/process?prettyjson

    安裝ik中文分詞器:        

  1. 從GitHub上下載:https://github.com/medcl/elasticsearch-analysis-ik/archive/v1.10.1.zip
  2. 利用maven進行mvn clean package後獲得                                                                   (若是你的es版本是2.4.1,就不用走下面步驟了,本人已經編譯打包好的文件,地址:https://raw.githubusercontent.com/hollowj/elasticsearch-analysis-ik/master/elasticsearch-analysis-ik-1.10.1.zip)
  3. ./target/releases/elasticsearch-analysis-ik-1.10.1.zip
  4. 打開elasticsearch根目錄:
  5. mkdir ./plugins/ik/
  6. 解壓maven編譯好的zip包到ik目錄下

    安裝 Marvel:

  1. 下載許可證和Marvel相關依賴

https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/license/2.4.1/license-2.4.1.zip vim

https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/marvel-agent/2.4.1/marvel-agent-2.4.1.zip 瀏覽器

https://download.elasticsearch.org/elasticsearch/marvel/marvel-2.4.1.tar.gzruby

  1. 下載上一步的三個文件到指定目錄
  2. 分別在elasticsearch和kibana中安裝:
  3. bin/plugin install file:///path/to/file/license-2.4.1.zip
  4. bin/plugin install file:///path/to/file/marvel-agent-2.4.1.zip
  5. bin/kibana plugin --install marvel --url file:///path/to/file/marvel-2.4.1.tar.gz
  6. 能夠申請一年的basic license:
  7. https://www.elastic.co/subscriptions 申請完畢會有郵件到你的郵箱點擊下載一個json格式的證書,
  8. 默認密碼是changeme

 

 

2. Logstash安裝:

參考地址:https://www.elastic.co/guide/en/logstash/2.4/installing-logstash.htmlbash

  1. 下載(https://www.elastic.co/downloads/past-releases/logstash-2-4-1https://download.elastic.co/logstash/logstash/logstash-2.4.1.tar.gz
  2. 下載後解壓到指定的目錄
  3. 安裝logstash-input-jdbc插件進行MySQL的數據同步到elasticsearch中:
  4. logstash-input-jdbc須要gem環境支持
  5. yum install ruby
  6. 參考http://gems.ruby-china.org/修改相應信息
  7.  從GitHub上下載:https://github.com/logstash-plugins/logstash-input-jdbc/archive/master.zip
  8. 解壓下載好的zip文件並cd logstash-input-jdbc
  9. gem build logstash-input-jdbc.gemspec
  10. /opt/logstash-2.4.1/bin/logstash-plugin install /path/to/logstash-output-kafka-1.0.0.gem
  11. bin/logstash-plugin list --verbose 查看logstash-input-jdbc是否安裝成功,版本是否對應GitHub上的版本(參考:https://www.elastic.co/guide/en/logstash/2.4/working-with-plugins.html
  12. 以非root系統帳號啓動Logstash(同上):
  13. 參考:https://www.elastic.co/guide/en/logstash/2.4/command-line-flags.html
  14. -e標誌直接從命令行啓動:
  15. bin/logstash -e 'input { stdin { } } output { stdout {} }'
  16. -f標誌從配置文件啓動:
  17. bin/logstash -f <path/to/file>  (.conf配置文件)

 

 

 

3.Kibana安裝:

  1. 參考地址:https://www.elastic.co/guide/en/kibana/4.6/setup.html                                     下載(https://www.elastic.co/downloads/past-releases/kibana-4-6-3):                                                                                                                                   https://download.elastic.co/kibana/kibana/kibana-4.6.3-linux-x86_64.tar.gz
  2. 下載後解壓到指定的目錄
  3. 修改配置文件訪問elasticsearch
  4. vim /opt/kibana-4.6.3-linux-x86_64/config/kibana.yml
       elasticsearch.url: "http://192.168.0.1:9200"   訪問集羣中任一節點
  5. 以非root系統帳號啓動kibana(同上):
  6. /opt/kibana-4.6.3-linux-x86_64/bin/kibana
  7. 瀏覽器訪問:http://192.168.0.1:5601/
相關文章
相關標籤/搜索