elasticsearch.bat闪退的解决方案

elasticsearch.bat闪退的解决方案

大家好,又见面了,我是全栈君。

使用Easticsearc时侯启动时,点击elasticsearch.bat发生闪退。
原因:允许elasticsearch跨越访问时,在修改了elasticsearch的配置文件,并且以非UTF-8的格式修改的,结果就报错了。
添加跨域访问:

http.cors.enabled: true
http.cors.allow‐origin: "*"

日志:
java.lang.IllegalArgumentException: unknown setting [http.cors.allow�\origin] did you mean [http.cors.allow-origin]?
 问题:查看日志文件可以看出allowe-origin中的符号没有识别。
 解决:原因是在修改elasticsearch.yml时用的notepad++,默认的是ANSI 编码,重新修改配置文件,以UTF-8编码修改并保存。(注意:修改elasticsearch.yml最好只用utf-8编码)

elasticsearch:6.2.1

jdk:1.8.0.241  [ java -version]

 我的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:
##配置elasticsearch的集群名称,默认是elasticsearch。建议修改成一个有意义的名称。
cluster.name: lxw-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
##节点名,通常一台物理服务器就是一个节点,es会默认随机指定一个名字,建议指定一个有意义的名称,方便管理
node.name: lxw-node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
node.master: true  #主节点
node.data: true  #数据节点
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#索引目录
path.data: D:\softwore\elasticsearch-6.2.1\data

# Path to log files:
#日志
path.logs: D:\softwore\elasticsearch-6.2.1\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 -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
##绑定ip地址 我的问题是改的这里
#network.host: 0.0.0.0
network.host: 127.0.0.1

#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#暴露的http端口
http.port: 9200

#内部端口
transport.tcp.port: 9300 

#  跨域设置
http.cors.enabled: true   
http.cors.allow-origin: "*"

#
# 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.
#

#设置集群中master节点的初始列表
discovery.zen.ping.unicast.hosts: ["0.0.0.0:9300", "0.0.0.0:9301", "0.0.0.0:9302"] 

 #主结点数量的最少值 ,此值的公式为:(master_eligible_nodes / 2) + 1 ,比如:有3个符合要求的主结点,那么这里要设置为2。
discovery.zen.minimum_master_nodes: 1 

# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

报错如下: 

elasticsearch.bat闪退的解决方案

D:\softwore\elasticsearch-6.2.1\bin>elasticsearch.bat
[2021-08-16T14:56:26,659][INFO ][o.e.n.Node               ] [lxw-node-1] initializing ...
[2021-08-16T14:56:26,753][INFO ][o.e.e.NodeEnvironment    ] [lxw-node-1] using [1] data paths, mounts [[(D:)]], net usable_space [380.2gb], net total_space [390.6gb], types [NTFS]
[2021-08-16T14:56:26,754][INFO ][o.e.e.NodeEnvironment    ] [lxw-node-1] heap size [990.7mb], compressed ordinary object pointers [true]
[2021-08-16T14:56:26,756][INFO ][o.e.n.Node               ] [lxw-node-1] node name [lxw-node-1], node ID [JdIIBJ5NRYSD52RuvkxTiQ]
[2021-08-16T14:56:26,756][INFO ][o.e.n.Node               ] [lxw-node-1] version[6.2.1], pid[13648], build[7299dc3/2018-02-07T19:34:26.990113Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_241/25.241-b07]
[2021-08-16T14:56:26,757][INFO ][o.e.n.Node               ] [lxw-node-1] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -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\LEJU\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Delasticsearch, -Des.path.home=D:\softwore\elasticsearch-6.2.1, -Des.path.conf=D:\softwore\elasticsearch-6.2.1\config]
[2021-08-16T14:56:27,485][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [aggs-matrix-stats]
[2021-08-16T14:56:27,485][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [analysis-common]
[2021-08-16T14:56:27,493][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [ingest-common]
[2021-08-16T14:56:27,494][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [lang-expression]
[2021-08-16T14:56:27,494][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [lang-mustache]
[2021-08-16T14:56:27,496][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [lang-painless]
[2021-08-16T14:56:27,497][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [mapper-extras]
[2021-08-16T14:56:27,497][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [parent-join]
[2021-08-16T14:56:27,498][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [percolator]
[2021-08-16T14:56:27,498][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [rank-eval]
[2021-08-16T14:56:27,499][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [reindex]
[2021-08-16T14:56:27,499][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [repository-url]
[2021-08-16T14:56:27,500][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [transport-netty4]
[2021-08-16T14:56:27,500][INFO ][o.e.p.PluginsService     ] [lxw-node-1] loaded module [tribe]
[2021-08-16T14:56:27,501][INFO ][o.e.p.PluginsService     ] [lxw-node-1] no plugins loaded
[2021-08-16T14:56:28,679][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [lxw-node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown setting [http.cors.allow鈥恛rigin] did you mean [http.cors.allow-origin]?
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.1.jar:6.2.1]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.2.1.jar:6.2.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.2.1.jar:6.2.1]
Caused by: java.lang.IllegalArgumentException: unknown setting [http.cors.allow鈥恛rigin] did you mean [http.cors.allow-origin]?
        at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:346) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:310) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:284) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.common.settings.SettingsModule.<init>(SettingsModule.java:134) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.node.Node.<init>(Node.java:331) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.node.Node.<init>(Node.java:246) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.1.jar:6.2.1]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.1.jar:6.2.1]

解决方法:

将原来的:注意版本问题,不同版本兼容性不一样

elasticsearch.bat闪退的解决方案

elasticsearch.bat闪退的解决方案elasticsearch.bat闪退的解决方案

 

补充:解决Elasticsearch(Windows)闪退问题

进入Elasticsearch安装目录下的config目录,修改elasticsearch.yml文件.在文件的末尾加入以下代码

http.cors.enabled: true 
http.cors.allow-origin: "*"
cluster.name: pengliang
node.name: master
node.master: true
network.host: 127.0.0.1

 发现持续闪退。这时候我一开始只加入前两行的时候,发现可以正常运行。于是推理了一下,其实可以看日志,但是可能我比较懒,直接感觉加的ip绑定有问题,于是删除最后一行,重新保存启动,发现可以正常运行,好像是因为Elasticsearch是夸域的,具体可能是什么问题,没有细查
 

参考:elasticsearch.bat闪退的解决方案

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/111477.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • linux基本命令手册_linux常用命令详解

    linux基本命令手册_linux常用命令详解命令功能说明线上查询及帮助命令(2个)man查看命令帮助,命令的词典,更复杂的还有info,但不常用。help查看Linux内置命令的帮助,比如cd命令。文件和目录操作命令(18个)l

    2022年8月6日
    5
  • HTML embed 标签「建议收藏」

    HTML embed 标签「建议收藏」HTMLembed标签embed标签–定义网页中嵌入除图片外的多媒体不符合标准网页设计的理念,不赞成使用.embed标签是单独出现的,以开始,结束使用embed标签可以在网页中嵌入Flash,Mid,MP3等嵌入式内容embed标签已经被符合标准的object标签代替。属性Common–一般属性align–对齐方式autostart–是否

    2022年10月21日
    0
  • Vue.js 数据绑定语法详解

    Vue.js 数据绑定语法详解

    2021年6月16日
    109
  • python猪脸识别_一种猪脸的识别方法与流程

    python猪脸识别_一种猪脸的识别方法与流程本发明涉及人工智能技术领域,特别涉及到一种用于猪脸的自动识别方法。背景技术:当前养猪场进行批量养猪的过程中,养殖者需要掌握每头猪只的饮食情况、健康状态、生长状况以及情绪等信息,因此识别每头猪只的身份信息为养殖者掌握养殖场基本状况提供便利,目前大型养猪场对于猪只的身份管理没有一个准确有效的识别方法,使得在管理猪只的过程中出现混乱和错误的情况,因此,猪脸识别技术的缺乏不利于规模化的精准养猪的推广。技术…

    2022年6月21日
    29
  • c程序设计,贪吃蛇程序是什么_C语言编写贪吃蛇

    c程序设计,贪吃蛇程序是什么_C语言编写贪吃蛇C语言,贪吃蛇程序设计一.代码分析(1)头文件(2)宏定义(3)全局变量(4)函数部分1)绘制地图函数DreawMap(),2)食物位置函数FoodRand()3)键盘控制移动函数ControlMove()函数4)移动函数Move()函数5)蛇身开始函数Isnake()函数6)判断食物是否被吃到函数Jfood()函数7)判断是否碰到墙Jwell()函数8)判断是否碰到蛇身Jsnake()函数9)计算分数和难度Showf()函数10)清空存储空间函数二.代码附录一.代码分析(1)头文件1.include

    2022年10月26日
    0
  • ODS和EDW_csgo vac和ow的区别

    ODS和EDW_csgo vac和ow的区别企业运营数据仓储(ODS)和企业数据仓库(EDW)企业数据架构EDW主要为企业提供分析决策服务。ODS主要实现企业数据整合、共享和准实时运营监控等功能,ODS是EDW的一个有益的补充和扩展其中.ADB为应用数据库;A、B、C表示不同类型的数据流动:A表示操作环境中应用数据库之间的直接数据交换;B表示操作环境中应用数据库之间通

    2022年9月26日
    0

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号