7

在 Windows 上运行 OpenSearch(ElasticSearch)

 2 years ago
source link: https://my.oschina.net/javayou/blog/5324698
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

在 Windows 上运行 OpenSearch(ElasticSearch)

明明是 Java 开发的项目,却只提供 Linux 的安装包,官方也没有提供在 Windows 下安装的相关的指引,开发调试研究测试多麻烦呀。

备注:OpenSearch 是 AWS 推出的 ElasticSearch 的分叉版本,基于 ElasticSearch 7.10.2 版本分叉的。至于为何分叉,大家自行搜索吧,说来话长。

本文只介绍 OpenSearch 在 Windows 下的安装使用。

0. 前提条件

你机器需要先装有 Java 开发环境,随便弄个 JDK 至少 8 以上版本的即可。至少运行个 java --version 没毛病的。

1. 首先从 OpenSearch 官方下载 Linux 下的发行版本

https://opensearch.org/downloads.html 

目前最新版本是刚刚发布的 1.2.0 ,如下图点下载即可

up-dcb6e2e19d45b4a0d06771cba4782f8161a.png

2. 先搞个启动脚本

压缩包有四百多兆呢,下载完毕解压到指定目录,然后进入该目录下创建个新的脚本文件,随便取个名字,例如 opensearch.bat ,内容如下:

java -Xms8g -Xmx8g -Dlog4j2.disable.jmx=true -Dopensearch.disable.jmx=true -Dopensearch -Dopensearch.path.home="." -Dopensearch.path.conf="config" -cp lib\* org.opensearch.bootstrap.OpenSearch

3. 运行试试

直接运行 .\opensearch.bat 你肯定会看到一堆异常报错信息,具体什么报错信息我就不贴了,反正都是一些不影响基本服务运行的插件搞的。

4. 外科手术

为了让服务正常运行,我们需要对其做一番手术。

首先打开 config/opensearch.yml 添加一行配置(随便找个位置塞进去就行)

plugins.security.disabled: true

接下来打开 plugins 目录干掉两个插件(就是删除对应目录),分别是:

opensearch-observability 
opensearch-performance-analyzer

因为这两个插件只能在 Linux 下使用,而且对我们作为普通的开发调试环境并没有任何影响,放心的干!


好了,再次运行 opensearch.bat 就可以看到一堆正常的日志,然后打开浏览器访问 http://localhost:9200/ 即可看到正常的输出啦。

凑合用吧,生产环境还是老老实实在 Linux 下折腾吧。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK