我的DEMO项目下载:https://gitee.com/zhuhongliang/soringboot_elastic_search_732.git

elasticsearch,我用的是windows10系统,在官网下载:https://www.elastic.co/cn/start 连kibana一起下载了
解压后,看下配置文件elasticsearch-7.3.2\config\elasticsearch.yml,注意修改一下network.host这个属性,设为elasticsearch启动机器的ip,cluster.name属性去掉注释,然后随便加个名字上去,我用的: application

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#启动机器的ip
network.host: 192.168.10.1
#
# Set a custom port for HTTP:
#默认9200
#http.port: 9200
#
# For more information, consult the network module documentation.
#

然后启动:elasticsearch.bat
看到下面的输出就行了

PS C:\data\elasticsearch-7.3.2\bin> .\elasticsearch.bat
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2019-09-18T21:50:48,471][INFO ][o.e.e.NodeEnvironment    ] [node-1] using [1] data paths, mounts [[Windows (C:)]], net usable_space [70gb], net total_space [237.2gb], types [NTFS]
[2019-09-18T21:50:48,475][INFO ][o.e.e.NodeEnvironment    ] [node-1] heap size [989.8mb], compressed ordinary object pointers [true]
[2019-09-18T21:50:48,763][INFO ][o.e.n.Node               ] [node-1] node name [node-1], node ID [3yVr9onNQku6gNesOurCwg], cluster name [application]
[2019-09-18T21:50:48,764][INFO ][o.e.n.Node               ] [node-1] version[7.3.2], pid[38752], build[default/zip/1c1faf1/2019-09-06T14:40:30.409026Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/12.0.2/12.0.2+10]
[2019-09-18T21:50:48,764][INFO ][o.e.n.Node               ] [node-1] JVM home [C:\data\elasticsearch-7.3.2\jdk]
[2019-09-18T21:50:48,765][INFO ][o.e.n.Node               ] [node-1] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -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, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=C:\Users\zhuho\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -Dio.netty.allocator.type=unpooled, -XX:MaxDirectMemorySize=536870912, -Delasticsearch, -Des.path.home=C:\data\elasticsearch-7.3.2, -Des.path.conf=C:\data\elasticsearch-7.3.2\config, -Des.distribution.flavor=default, -Des.distribution.type=zip, -Des.bundled_jdk=true]
……

我的机器ip是192.168.10.1,所以在浏览器访问http://192.168.10.1:9200/,
浏览器输出:

{
  "name" : "node-1",
  "cluster_name" : "application",
  "cluster_uuid" : "Y8Hd00TLQJ-ZlLSAb3RtoQ",
  "version" : {
    "number" : "7.3.2",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "1c1faf1",
    "build_date" : "2019-09-06T14:40:30.409026Z",
    "build_snapshot" : false,
    "lucene_version" : "8.1.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

elasticsearch就启动完毕了。

然后启动kibana
首先改一下kibana的配置文件,kibana-7.3.2-windows-x86_64\config\kibana.yml
把elasticsearch.hosts设置为elasticsearch配置的地址

# The URLs of the Elasticsearch instances to use for all your queries.
elasticsearch.hosts: ["http://192.168.10.1:9200"]

启动:kibana-7.3.2-windows-x86_64\bin\kibana.bat

启动完成后访问:http://localhost:5601 就能打开kibana的后台

发表评论