1. 程式人生 > >elasticsearch2.3.3搭建及外掛安裝

elasticsearch2.3.3搭建及外掛安裝

小弟大學剛畢業,進公司後需要使用elasticsearch做全文檢索,所以我手動搭建了elasticsearch叢集(測試)並安裝了相關外掛支援我開發使用。

當然我也是參考了網上很多大神的部落格~~~~~~

下面介紹一下我的elasticsearch的安裝情況

elasticsearch-2.3.3叢集及外掛安裝

環境

虛擬機器VMware vSphere 6.5

機器

192.168.16.131

192.168.16.132

192.168.16.131

配置

磁碟20G

記憶體2g

Cpu1核

安裝包

elasticsearch-2.3.3.tar.gz

kibana-4.5.2-linux-x64.tar.gz

elasticsearch-analysis-ik-1.9.3.zip

elasticsearch-jdbc-2.3.3.0-dist.zip

marvel-2.3.3.tar.gz

安裝elasticsearch

1. 下載elasticsearch-2.3.3.tar.gz

2. 上傳elasticsearch-2.3.3.tar.gz

3. 解壓tar zxvf elasticsearch-2.3.3.tar.gz

4. 移動解壓目錄,修改屬組屬主

mv elasticsearch-2.3.3 /home/el ;chown -R el:el /home/el/elasticsearch-2.3.3

5. 安裝Head

mkdir/home/el/elasticsearch-2.3.3/plugins/head

mkdir/home/el/elasticsearch-2.3.3/plugins/kopf

下載的zip解壓,然後將解壓後的資料夾內所有的檔案copy到上面建立的目錄

6. 修改ES配置檔案

1. elasticsearch

在啟動檔案中加入如下配置配置Open檔案數和記憶體bin/elasticsearch)(本次沒有設定)

ES_HEAP_SIZE=4g

MAX_OPEN_FILES=65535

2. elasticsearch.yml

進入config下修改elasticsearch.yml

# Use a descriptive name for your cluster:

cluster.name:my-application

# ------------------------------------ Node------------------------------------

# Use a descriptive name for the node:

node.name: node-3

# Add custom attributes to the node:

# node.rack: r1

# ----------------------------------- Paths------------------------------------

# Path to directory where to store the data(separate multiple locations by comma):

path.data: /home/el/data

# Path to log files:

path.logs: /home/el/logs

# ----------------------------------Network -----------------------------------

# Set the bind address to a specific IP(IPv4 or IPv6):

network.host:192.168.16.131

# Set a custom port for HTTP:

http.port: 9200

# For more information, see thedocumentation at:

#<http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>

# ---------------------------------Discovery ----------------------------------

# Pass an initial list of hosts to performdiscovery when new node is started:

# The default list of hosts is["127.0.0.1", "[::1]"]

discovery.zen.ping.unicast.hosts:["es1", "es2","es3"]

# Prevent the "split brain" byconfiguring the majority of nodes (total number of nodes / 2 + 1):

discovery.zen.minimum_master_nodes:2

# For more information, see thedocumentation at:

# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>

7. 安裝ik

1.       在目錄./elasticsearch-2.3.3/plugins下建立目錄ik

2.       下載和上傳elasticsearch-analysis-ik-1.9.3.zip

3.       將elasticsearch-analysis-ik-1.9.3.zip解壓到ik目錄

4.       cd 到./elasticsearch-2.3.3/plugins/ik目錄

  unzip elasticsearch-analysis-ik-1.9.3.zip

8. 192.168.16.132和192.168.16.133同上(改一下引數配置)

9. elasticsearch開啟和關閉

開啟elasticsearch

./elasticsearch-2.3.3/bin/elasticsearch

關閉elasticsearch

ps -ef | grep elasticsearch

Kill -9 *****

安裝Kibana

1. 下載kibana-4.5.2-linux-x64.tar.gz

2. 上傳kibana-4.5.2-linux-x64.tar.gz

3. 解壓tar zxvfkibana-4.5.2-linux-x64.tar.gz

4. 移動解壓目錄,修改屬組屬主

mv kibana-4.5.2-linux-x64 /home/el ;chown -R el:el /home/el/kibana-4.5.2-linux-x64

5. 安裝Marvel

首先先要安裝在elasticsearch上安裝license和mavel-agent

elasticsearch-2.3.3/bin/plugin install license

elasticsearch-2.3.3/bin/plugin install marvel-agent

使用Kibana安裝最新版本的marvel:

./kibana-4.5.2-linux-x64/bin/kibana plugin—install elasticsearch/marvel/latest

mavel不是免費外掛,需要註冊使用,官網註冊能夠使用一年

刪除

kibana-4.5.2-linux-x64/installedPlugins/marvel下的所有檔案

6.安裝sense

1.下載sense安裝包。

2. 上傳sense-2.0.0-beta7-tar.gz

3. 在kibana/bin目錄下執行命令安裝sense

./kibanainstall –i sense –ufile:下載sense的檔案目錄

6.修改配置檔案

kibana.yml

./kibana-4.5.2-linux-x64/config/kibana.yml

server.port: 5601

elasticsearch.url:"http://192.168.16.131:9200"(其他配置可自配置)

7. 192.168.16.132和192.168.16.133同上(改一下引數配置)

8. Kibana的啟動和關閉

開啟Kibana

./kibana-4.5.2-linux-x64/bin/kibana

關閉Kibana

fuser -n tcp 5601

Kill -9 *****

安裝安裝elasticsearch-jdbc

(同步mysql資料庫)

1. 下載elasticsearch-jdbc-2.3.3.0-dist.zip

2. 上傳elasticsearch-jdbc-2.3.3.0-dist.zip

3. 解壓tar zxvfelasticsearch-jdbc-2.3.3.0-dist.zip

4. 移動解壓目錄,修改屬組屬主

mv elasticsearch-jdbc-2.3.3.0 /home/el ;chown -R el:el/home/el/elasticsearch-jdbc-2.3.3.0

有不對的地方希望各位大神批評指正,小弟謝過大家!!!