1. 程式人生 > >elasticsearch(一):安裝與配置

elasticsearch(一):安裝與配置

一、elastic search的安裝與配置

1、安裝Java 並且配置JAVA_HOME環境變數。

2、下載elasticsearch,下載地址:https://www.elastic.co/downloads/elasticsearch。博主下載時最新版為6.3.2,下面所有都是基於6.3.2進行的測試。選擇下載zip檔案,這樣解壓即可使用。

3.解壓後修改配置檔案。進入到elasticsearch所在目錄下面的config下面,修改elasticsearch.yml檔案,修改內容如下:

(1)、在檔案結尾加入如下程式碼(key和值之間必須要有 空格)

http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true

(2)、在檔案中找到network.host,將其值改為 127.0.0.1或者本機ip。

(3)、取消 http.port 、cluster.name 、node.name 三個值前面的註釋(去掉 #)。

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 127.0.0.1
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true

4、將elasticsearch複製一份,修改elasticsearch.yml檔案內容。

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-2
#
# Add custom attributes to the node:
#
node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /path/to/data
#
# Path to log files:
#
path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 8200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"
node.data: true

5.安裝elasticsearch-head外掛,用於視覺化。

(1)、安裝node

(2)、安裝完成後在cmd裡面執行node -v可以檢視版本號,確認是否安裝成功。

(3)、在cmd裡面執行 npm install -g grunt-cli 安裝grunt,安裝完成後執行grunt -version查詢版本號,確定是否成功。

(5)、將其解壓到elasticsearch的安裝目錄下面

(6)、進入elasticsearch-head外掛目錄裡面,修改Gruntfile.js檔案,在對應的地方加上 hostname:'*'。

connect: {
			server: {
				options: {
					hostname:'*',
					port: 9100,
					base: '.',
					keepalive: true
				}
			}
		}

6、測試安裝是否成功。

(1)、進入elasticsearch目錄的bin目錄下面,點選elasticearch.bat檔案,進行啟動。

(2)、和第一步一樣啟動複製出來的另一個elasticsearch。

(3)、啟動完成後在瀏覽器訪問  http://127.0.0.1:9200,如果輸出一下json串表示啟動成功。

(4)、cmd進入elasticsearch-head外掛的目錄下面,執行以下命令  grunt server,顯示如下這表示執行成功。

(5)、在瀏覽器訪問 http:127.0.0.1:9100,就可以進行視覺化檢視。

相關推薦

elasticsearch安裝配置

一、elastic search的安裝與配置 1、安裝Java 並且配置JAVA_HOME環境變數。 2、下載elasticsearch,下載地址:https://www.elastic.co/downloads/elasticsearch。博主下載時最新版為6.3.2,下面所有都是基於6.3.2進行的測

Veeam Backup & Replication試用安裝配置

近期veeam 9.5出來了,嘗試安裝使用,找到老管網路日誌相關的文件,分享一下。 轉自老管網路日誌http://guanjianfeng.com/archives/1159347   ===================================================

MySQL學習資料庫安裝配置全程圖解

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

SmartGit 安裝及使用安裝配置

一、官網下載smartgit安裝包。 https://www.syntevo.com/smartgit/download/ 二、安裝smartgit,根據提示安裝即可。 三、啟動配置smartgit。 1、選擇非商業模式安裝,勾選第三個Non-commercial us

系列教程|IntelliJ IDEA安裝破解

之前經常聽人說IDEA效能如何優越,使用如何方便,今天心血來潮,準備從eclipse轉投IDEA的懷抱。安裝破解的時候,在網上搜索了許多教程,不經意間看到這位大佬(JaJian)的部落格,頁面優美、整潔,內容完備、清晰,一時之間引為天人。 所以,就決定以JaJian大佬的部落格作為初步學習IDE

Spring+SpringMVC+Mybatis整合系列Maven安裝配置

最近有專案要做,想著還是來寫一篇SSM搭建的文件吧!此搭建文件僅供參考! Spring+SpringMVC+Mybatis簡稱SSM,首先說明一下,由於搭建SSM的篇幅略長,如果放到一篇博文中,可能會給讀者感覺閱讀起來很吃力。其實,寫博文也需要解耦,長篇大論並

CentOS下torque叢集配置-torque安裝配置

一、Centos7系統的安裝及設定 1、給兩臺電腦安裝CentOS7.0,光碟啟動路徑修改為:/dev/cdrom 修改主機名稱 # hostnamectl set-hostname <host-name> 2、設定ip地址 # vi /etc/sysco

Houdini技術體系 基礎管線 HoudiniHoudini Engine的安裝

ins ice serve pro 並集 wid ima mage width Houdini 下載與安裝 在官網 https://www.sidefx.com/download/ 下載最新的Production Build 版本,當前是16.5版本,需要註冊帳號 P

ELK系列安裝elasticsearch + logstash + kibana

minimum 5.6 解壓 通過 stdout you targe 記錄 pat 因為公司使用ELK的緣故,這兩天嘗試在阿裏雲上安裝了下ELK,這裏做個筆記,有興趣的同學可以看下。 先大致介紹下ELK,ELK是三個組件的縮寫,分別是elasticsearch、logsta

Maven學習筆記-Maven安裝環境變數配置

一、下載Maven 官網地址:http://maven.apache.org/ 去官網上下載最新的maven. 然後解壓到安裝目錄中,這裡我直接解壓到D盤,如圖所示是maven安裝包的目錄結構。 二、安裝Maven 配置mave

postgresql熱備配置 postgresql安裝基礎配置

1、  安裝postgresql假定環境未Centos 6,已安裝gcc 3.6+:yum install https://download.postgresql.org/pub/repos/yum/9

ActiveAndroid 下載、配置建立

專案地址:https://github.com/pardom/ActiveAndroid ActiveAndroid是一個輕量級的ORM框架,用ActiveAndroid能夠更快速地對資料庫進行增刪改查的操作(不用寫SQL語句),每一個數據記錄都可以通過save()和de

R語言筆記RRstudio的安裝Windows

初學R語言,當然少不了這為程式設計設計的IDE:RStudio R的獲取與安裝 選擇download R for Windows,下載下來安裝即可(若是其他系統,按照要求安裝即可,這裡僅限於wi

Linux 環境部署記錄 - Jenkins安裝配置

版本 接下來 clas title col size pre 瀏覽器 jdk Jenkins安裝 為了兼容生產環境的jdk1.7版本,從官網得知,Jenkins必須是1.6之前的版本,因此下載jenkins-1.596.3-1.1.noarch.rpm到本地進行安裝: #移

從輸入url到頁面URLDNS

ava .cn 控制 tp服務器 兩種 網絡配置 占用 index 相對 瀏覽器引擎默認:webkit內核 一、輸入地址   當我們開始在瀏覽器中輸入網址的時候,現代瀏覽器就可以智能的匹配完整 url了,它會從歷史記錄,書簽等地方,找到已經輸入的字符串可能對應的 url,然

Storm筆記整理簡介設計思想

大數據 實時計算 Storm [TOC] 實時計算概述 有別於傳統的離線批處理操作(對很多數據的集合進行的操作),實時處理,說白就是針對一條一條的數據/記錄進行操作,所有的這些操作進行一個匯總(截止到目前為止的所有的統計總和)。 實時計算與離線計算比較 Bounded:有界 離線計算面臨

Android項目實戰 SpannableStringSpannableStringBuilder

append() 同時 uil 註意 1.5 查看 strong 尊重 bject 原文:Android項目實戰(一): SpannableString與SpannableStringBuilder前言: 曾經在一些APP中的一些類似“幫助”&ld

Hive---- Hive安裝配置

joins hist query mysqld onf pass chmod 客戶 主機 Hive安裝及配置 下載hive安裝包 此處以hive-0.13.1-cdh5.3.6版本的為例,包名為:hive-0.13.1-cdh5.3.6.tar.gz 解壓Hive到安裝目錄

Ansible詳解基礎安裝配置

note oom 管理 基礎 get 結合 conn float 模塊化 ansible 是一款輕量級自動化運維工具,由的 Python 語言開發,結合了多種自動化運維工具的特性,實現了批量系統配置,批量程序部署,批量命令執行等功能; ansible 是基於模塊化實現批量

webpack官方文檔分析安裝

目錄 單獨 https div script version clas .com 我們 一:安裝 1、首先要安裝Node.js->node.js下載 2、本地安裝   要安裝最新版本或特定版本,運行如下: npm install --save-dev webpack