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

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

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

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

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

(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,就可以进行可视化查看。

原文地址:https://www.cnblogs.com/jack1995/p/9370770.html

时间: 2024-10-08 20:25:11

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

elk(Elasticsearch 2.0.0, Logstash 2.0.0, Kibana4.2.0) redis centos6.6安装与配置

本次安装的相关环境:Centos_x64_6.6  redis2.8.23  Elasticsearch 2.0.0, Logstash 2.0.0,  Kibana4.2.0 软件下载地址: redis: http://redis.io/download Elasticsearch: wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticse

ElasticSearch安装和配置head、bigdesk、IkAnalyzer

ElasticSearch的安装 http://www.elasticsearch.org/下载最新的ElastiSearch版本. 解压下载文件. cd到${esroot}/bin/,执行elasticsearch启动. 使用curl -XPOST localhost:9200/_shutdown关闭ES. ElasticSearch的基本配置(这部分配置可以不理会,取默认值) 编辑文件${esroot}/conf/elasticsearcy.yml cluster.name:集群名称,es可

elasticsearch的安装配置以及初步使用

elasticsearch 是一个全文搜索引擎,支持分布式.搜索速度非常快速. 本文主要进行了 elasticsearch  的安装 配置 以及初步的使用功能: -- 下载 放到 /data/soft 目录 wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.1.0/elasticsearch-2.1.0.tar.gz--

ELK学习记录二 :elasticsearch、logstash及kibana的安装与配置

注意事项: 1.ELK版本要求5.X以上,本人使用版本:elasticsearch-6.0.0.kibana-6.0.0-linux-x86_64.logstash-6.0.0.tar 2.Elasticsearch5.x版本必须基于jdk1.8,安装环境必须使用jdk1.8 3.本人使用linux操作系统的centos6.5版本作为测试环境,其他环境命令有差异,请注意 4.本教程适合完全离线安装 5.ELK及jdk安装包下载路径:https://pan.baidu.com/s/1KAPtSt4

ElasticSearch搜索引擎安装配置拼音插件pinyin

一.pinyin插件安装 1.首先前往GitHub下载安装包(注意版本与ElasticSearch对应,若无对应版本,解压后修改pom.xml文件中的elasticsearch.version,建议查看修改一下版本号),上传至/home/目录,并解压至当前目录,如下图所示: 1 vim /home/elasticsearch-analysis-pinyin-6.3.2/pom.xml 2.然后切换至解压目录进行编译(若无安装Maven工具,首先安装Maven才能编译,具体参考Linux安装Mav

elasticsearch在centos7上的安装与配置教程

ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎.设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便. 安装ElasticSearch前需要先安装配置好JDK 安装 Elasticsearch Elasticsearch的安装很简单,下载下来解压即可,这里使用wget下载,当然

Elasticsearch进阶篇(一)~head插件的安装与配置

1.安装node.js 1.1.通过官网下载二进制安装包 https://nodejs.org/en/download/ 选择对应的版本,右键复制下载链接,进入linux目录,切换到要安装目录的磁盘.这里我们软件安装在/usr/local目录下,执行如下命令下载安装包 cd /usr/local/ wget https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz 下载完之后可以在磁盘目录看到已经下载完成的压缩包 1.2.解压

Elasticsearch单机安装_集群搭建_索引基本操作_Head插件安装与基本操作_ik分词器配置_logstash实现数据同步_教程

一.Elasticsearch单机安装 1.将es安装包传到服务器上 这是安装包 这里我是用的是WinSCP上传工具,上传到/home/plugins文件下. 进入Xshell,验证一下是否上传成功. 2.创建es目录 mkdir -p /usr/local/es(es1,es2,es3暂时不要安装,确保第一步es下面目录是空的,由于已经安装过,这三个文件留着了) 2.解压文件至 es 目录 tar -zxvf /home/plugins/elasticsearch-2.4.5.tar.gz -

Shield 安装与配置

https://www.elastic.co/guide/en/shield/shield-1.3/introduction.html  一.简介 Shield是Elasticsearch的一个插件,它能够很容易的保证你的Elasticsearch集群的安全性. Shield的功能: 1.用户认证 2.SSL/TLS的加密身份验证 3.审计 二.安装 我使用的shield-1.3的版本 安装Elasticsearch集群 Shield是需要licese的,我们只有在offline机器上安装使用