当前位置:首页 > 服务端 > elasticsearch(一):安装与配置

elasticsearch(一):安装与配置

2022年09月16日 20:43:04服务端6

 

 

一、elastic search的安装与配置

1、安装Java 并且配置JAVA_HOME环境变量。

2、下载elasticsearch,下载地址:https://www.elastic.co/downloads/elasticsearch。博主下载时最新版为6.3.2,下面所有都是基于6.3.2进行的测试。选择下载zip文件,这样解压即可使用。

elasticsearch(一):安装与配置 _ JavaClub全栈架构师技术笔记

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

    从地址:https://nodejs.org/en/download/ 下载相应系统的msi,双击安装。

elasticsearch(一):安装与配置 _ JavaClub全栈架构师技术笔记

 

 

(2)、安装完成后在cmd里面执行node -v可以查看版本号,确认是否安装成功。

elasticsearch(一):安装与配置 _ JavaClub全栈架构师技术笔记

(3)、在cmd里面执行 npm install -g grunt-cli 安装grunt,安装完成后执行grunt -version查询版本号,确定是否成功。

elasticsearch(一):安装与配置 _ JavaClub全栈架构师技术笔记

(4)、下载elasticsearch-head插件,在https://github.com/mobz/elasticsearch-head中下载head插件,选择下载zip。

(5)、将其解压到elasticsearch的安装目录下面

elasticsearch(一):安装与配置 _ JavaClub全栈架构师技术笔记

(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串表示启动成功。

elasticsearch(一):安装与配置 _ JavaClub全栈架构师技术笔记

(4)、cmd进入elasticsearch-head插件的目录下面,执行以下命令  grunt server,显示如下这表示运行成功。

elasticsearch(一):安装与配置 _ JavaClub全栈架构师技术笔记

 

(5)、在浏览器访问 http:127.0.0.1:9100,就可以进行可视化查看。

 

作者:一条路上的咸鱼
来源链接:https://www.cnblogs.com/jack1995/p/9370770.html

版权声明:
1、JavaClub(https://www.javaclub.cn)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。


本文链接:https://www.javaclub.cn/server/42317.html

标签: Elasticsearch
分享给朋友:

“elasticsearch(一):安装与配置” 的相关文章

linux安装elasticsearch部署配置详细说明

    ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引...

CenterOS 7 安装Elasticsearch、Kibana

CenterOS 7 安装Elasticsearch、Kibana 环境准备 JDK1.8、Elasticsearch 7.10.0、Kibana 7.10.0 JDK1.8安装 yum install java-1.8.0-op...

Linux安装Elasticsearch

Linux安装Elasticsearch

本文介绍Linux环境如何安装Elasticsearch. 本文环境是在腾讯云服务器CentOS7.2搭建的,JDK1.8,elasticsearch-5.4.2。 1 安装JDK 网上教程很多,也可以参考本人教程之前写的Linux安装...

ElasticSearch 介绍、安装及简单使用

ElasticSearch 介绍、安装及简单使用

文章目录 介绍 基本概念 全文搜索(Full-text Search)...

ElasticSearch安装中文分词插件ik导致elasticsearch容器反复重启

问题:在docker容器的elasticsearch容器的plugin安装并解压了ik压缩包重启后查看elasticsearch状态一直是Restarting 解决办法:注意在解压ik的时候要在一个文件夹中,不能直接解压到plugin下面否则docker logs...

linux安装Elasticsearch详细步骤

linux安装Elasticsearch详细步骤

坑都已经踩好了 照着步骤一次成功  不多废话 走起 # ## 安装java运行环境 elasticsearch是用Java实现的 跑elasticsearch必须要有jre支持 所以必须先安装j...

elasticsearch 安装( 阿里云ECS )、远程访问、启动报错处理

elasticsearch 安装( 阿里云ECS )、远程访问、启动报错处理

附另 2 文章: elasticsearch-head 安装 kibana 安装   前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程。   1. 从网上下载到 linux 版...

ECK安装elasticsearch集群及es配置x-pack

目录   ECK安装elasticsearch集群 elasticsearch安装x-pack插件 Elasticsearch Springboot 开发 ECK安装elasticsearch集群 E...

elasticsearch的安装与使用

elasticsearch的安装与使用

安装 在官网上下载elasticsearch压缩包,这里是使用的是7.8.0版本的,使用的环境是windows系统. 官网:[https://www.elastic.co/cn/elasticsearch/] 解压缩之后直接启动即可(bin目录下的...

elasticsearch安装和常用命令 (一)

1.下载elasticsearch最新版7.9 https://www.elastic.co/cn/elasticsearch/ 需要安装jdk 11。 启动:D:\elasticsearch-7.9.0\bin\elasticsear...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。