1、Elasticsearch

1.1、elasticsearch的简介

ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是第二流行的企业搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。

1.2、下载地址:https://www.elastic.co/cn/downloads/elasticsearch,到此网页上下开elasticsearch安装包。

1.3、将下载的.tar包解压到目录/application下。创建软链接es文件。详情如下图所示:

1.4、关于JDK,此安装包里包含有JDK,不用再系统上重新安装其他的版本的JDK。

1.5、将此JDK放到系统变量文件/etc/profile中,在文件最后插入如下配置,详情如下:

#set java environment

export JAVA_HOME=/application/es/jdk

export JRE_HOME=${JAVA_HOME}/jre

export CLASSPATH=.:${JAVA_HOME}/lib/dt.JAVA_HOME/lib/tools.jar:${JRE_HOME}/lib

export PATH=${JAVA_HOME}/bin:${PATH}

1.6、使用source命令,使配置生效

source /etc/profile

1.7、配置elasticsearch的配置文件

[root@harlan_ansible ~]# vim /application/es/config/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-harlan #配置集群的名称
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: harlan_ansible #本节点的名称,此主机的名称
#
# 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: /application/es/to/data #日志存放地址
#
# Path to log files:
#
path.logs: /application/es/to/logs #elasticsearch的本地日志
#
# ----------------------------------- 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 #任意IP都可以访问elasticsearch
#
# Set a custom port for HTTP:
#
http.port: 9200 #elasticsearch的访问端口
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["harlan_ansible"] #开启集群的节点
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes:
#
# 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: "*"

1.8、通过上述配置后,还需要配置启动elasticsearch服务的用户和权限。因为elasticsearch的服务不能使用root用户进行启动。所以需要创建es帐号,并且更改/application/es的所属用户和组。

1.8.1 创建用户es

useradd es

1.8.2 更改/application/es的所属用户和组

chown -R es.es /application/es
chown -R es.es /application/elasticsearch-7.3.

1.9、切换到es帐户,启动elasticsearch服务

[es@harlan_ansible]$ su es
[es@harlan_ansible root]$ /application/es/bin/elasticsearch -d

1.10、查看服务是否已启动

1.11、由上图可知,elasticsearch服务已经启动。

测试:通过浏览器进行访问

1.12、由图可知,elasticsearch已经安装成功。

最新文章

  1. SQL Server 2016 CTP2.2 的关键特性
  2. AJAX JSONP源码实现(原理解析)
  3. form表单里如果只存在一个文本框,enter键提交
  4. Android 数据传递(二)Activity与fragment之间的通信
  5. TermServDevices报错导致服务器死机(远程服务使用者必读)
  6. poj 1190 生日蛋糕
  7. cmd find命令
  8. Baidu Sitemap Generator插件使用图解教程
  9. 《Java4Android视频教程》学习笔记(二)
  10. apache下的IfModule里设置含义
  11. shell学习之变量、判断、重复动作
  12. 我对国内两大购书站点的感受(dearbook和china-pub)
  13. NSOJ 畅通工程(并查集)
  14. JAVA的三大特征 封装继承多态- 简单总结
  15. 前端测试框架Jest系列教程 -- Asynchronous(测试异步代码)
  16. Java设置接口跨域
  17. 移动端解决单机事件延迟fastclick
  18. SSE图像算法优化系列五:超高速指数模糊算法的实现和优化(10000*10000在100ms左右实现)。
  19. PDP context
  20. Application类

热门文章

  1. 纯css实现网上商城左侧垂直商品分类菜单
  2. controller函数中参数列表使用多个@RequestBody
  3. Neo4j的查询语法笔记(二)
  4. linux加大服务器文件描述符
  5. Java中数组在内存中的存放原理?
  6. AOP技术介绍--(.Net平台AOP技术研究)
  7. 使用Fabric在tomcat中部署应用的问题总结
  8. 【leetcode】778. Swim in Rising Water
  9. spring boot构建
  10. vue框架搭建--移动端