elasticsearch

mac安装配置 ElasticSearch

2020-12-17  本文已影响0人  Geroge1226

1、说明

ElasticSearch 有很多中安装方式,这里我选择homebrew方式安装。版本号:7.10
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/brew.html

image.png

2、安装步骤如下:

2.1 、首先,安elastic 仓库: brew tap elastic/tap
brew tap elastic/tap

结果如图:

image.png
2.2、然后,终端输入brew install elastic/tap/elasticsearch-full
brew install elastic/tap/elasticsearch-full

安装过程截图

image.png
至此ES安装完成。 es安装比较简单。
2.3、查看是否安装成功:elasticsearch --version

终端返回:

Version: 7.10.1, Build: default/tar/1c34507e66d7db1211f66f3513706fdf548736aa/2020-12-05T01:00:33.671820Z, JVM: 15.0.1

3 ES启动

通过终端输入:elasticsearch
运行日志如下:

[2020-12-17T16:54:58,833][INFO ][o.e.n.Node               ] [lsyPro] version[7.10.1], pid[25385], build[default/tar/1c34507e66d7db1211f66f3513706fdf548736aa/2020-12-05T01:00:33.671820Z], OS[Mac OS X/10.14.6/x86_64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/15.0.1/15.0.1+9]
[2020-12-17T16:54:58,835][INFO ][o.e.n.Node               ] [lsyPro] JVM home [/usr/local/Cellar/elasticsearch-full/7.10.1/libexec/jdk.app/Contents/Home], using bundled JDK [true]
[2020-12-17T16:54:58,835][INFO ][o.e.n.Node               ] [lsyPro] JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, -Xms1g, -Xmx1g, -XX:+UseG1GC, -XX:G1ReservePercent=25, -XX:InitiatingHeapOccupancyPercent=30, -Djava.io.tmpdir=/var/folders/5j/d5tc0tqj5m1fyx4hqbrx9d600000gn/T/elasticsearch-4921904634609360906, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=/usr/local/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/usr/local/Cellar/elasticsearch-full/7.10.1/libexec, -Des.path.conf=/usr/local/etc/elasticsearch, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true]
------- 中间省略部分日志 ------
[2020-12-17T16:55:12,470][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [lsyPro] adding index lifecycle policy [watch-history-ilm-policy]
[2020-12-17T16:55:12,532][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [lsyPro] adding index lifecycle policy [ilm-history-ilm-policy]
[2020-12-17T16:55:12,589][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [lsyPro] adding index lifecycle policy [slm-history-ilm-policy]
[2020-12-17T16:55:12,741][INFO ][o.e.l.LicenseService     ] [lsyPro] license [9465b130-4d68-45aa-990d-1b20267921e7] mode [basic] - valid
[2020-12-17T16:55:12,742][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [lsyPro] Active license is now [BASIC]; Security is disabled

浏览器上输入:localhost:9200 回车

image.png

浏览器Json数据内容:

{
  "name" : "lsyPro",
  "cluster_name" : "elasticsearch_longshiyang",
  "cluster_uuid" : "T2r4_VQUTIypBPp1LTxPYw",
  "version" : {
    "number" : "7.10.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "1c34507e66d7db1211f66f3513706fdf548736aa",
    "build_date" : "2020-12-05T01:00:33.671820Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

4、ES安装目录介绍

elasticsearch : /usr/local/Cellar/elasticsearch/7.10.1
Data: /usr/local/var/elasticsearch/elasticsearch_xuchen/
Logs: /usr/local/var
Config: /usr/local/etc/elasticsearch/

5、ES配置文件elasticsearch.yml

[longshiyang@lsyPro elasticsearch ]$ vim 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: elasticsearch_longshiyang
#
# ------------------------------------ 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: /usr/local/var/lib/elasticsearch/
#
# Path to log files:
#

path.logs: /usr/local/var/log/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: 192.168.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 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: ["node-1", "node-2"]
#
# 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: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true


上一篇下一篇

猜你喜欢

热点阅读