Elasticsearch 7.8 windows快速安装部署


Elasticsearch下载地址:https://www.elastic.co/cn/downloads/elasticsearch

elasticsearch-analysis-ik下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases

elasticsearch-head下载:https://github.com/mobz/elasticsearch-head

 

Elasticsearch.Net和NEST文档:https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html

1、安装

下载完成后,先把文件解压放到自己喜欢的目录下,建议不要放在Program Files里,因为在添加ik分词的时候,如果所在目录路径里有空格出现会报错。

配置jdk环境,Elasticsearch文件自带了jdk,无需再下载安装。

设置路径: 计算机=》属性=》高级=》环境变量=》系统变量=》新建

变量名:JAVA_HOME
变量值:D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0\jdk
变量名:ES_HOME
变量值:D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0

设置完成后即可启动。

启动方式1:设置完成后双击D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0\bin下的elasticsearch.bat启动,如果双击启动后窗口一闪而过,一般是因为环境变量设置有问题,可通过第二种方式来启动查看日志;

启动方式2:通过dos启动,这样在启动失败的时候可以看到错误日志(推荐);

D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0\bin>elasticsearch.bat //回车

 

2、开启远程访问

//打开配置文件进行修改
D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0\config\elasticsearch.yml
#network.host: 192.168.0.1 修改为:network.host: 0.0.0.0
#cluster.initial_master_nodes 修改为:cluster.initial_master_nodes

重新启动Elasticsearch,设置生效。

3、设置密码

这里需要为4个用户分别设置密码,elastic, kibana, logstash_system,beats_system

//打开配置文件进行修改
D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0\config\elasticsearch.yml
在末尾追加以下设置并保存:
"xpack.security.enabled": true,
"xpack.license.self_generated.type": "basic",
"xpack.security.transport.ssl.enabled": true

回到D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0\bin目录下执行命令:

D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0\bin>elasticsearch-setup-passwords interactive //回车
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y


Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana_system]:
Reenter password for [kibana_system]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
//修改密码
curl -H "Content-Type:application/json" -XPOST -u elastic 'http://localhost:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456" }'

 

重新启动Elasticsearch,设置生效。

4、安装ik分词

根据文章开头给出的地址下载到本地,并进行解压。把解压后的整个文件夹复制到elasticsearch的plugins目录下。

//这是我自己的ik安装目录
D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0\plugins
D:\elasticsearch-7.8.0-windows-x86_64\elasticsearch-7.8.0\plugins\elasticsearch-analysis-ik-7.8.0\config

重新启动Elasticsearch,设置生效。 如果报错,一般是你的目录里有格式导致,上边已经说过了。

//分词效果
//发送:post localhost:9200/_analyze
//默认分词器分词效果
{"text":"测试分词器,后边是测试内容:spring cloud实战"}
//ik分词器分词效果
{"text":"测试分词器,后边是测试内容:spring cloud实战","analyzer":"ik_max_word" }

 

 5、google浏览器插件 elasticsearch-head安装

 根据文章开头给出的地址下载到本地,并进行解压,解压后会有一个 es-head.crx文件,将其更名为es-head.rar 后再解压,然后通过google浏览器=》更多工具=》扩展程序=》打开开发者模式=》加载已解压的扩展程序 添加已解析的es-head文件夹即可。

6、kibana安装

7、常用命令

elasticsearch-service.bat install //安装Elasticsearch服务 
elasticsearch-service.bat remove // 删除已安装的Elasticsearch服务
elasticsearch-service.bat start: //启动Elasticsearch服务(如果已安装) 
elasticsearch-service.bat stop: //停止服务(如果启动) 
elasticsearch-service.bat manager //启动GUI来管理已安装的服务

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM