Elasticsearch配置安装

跨域

 elasticsearch-head连接es时会提示连接失败,有可能就是没有开启跨域

http.cors.enabled是否支持跨域,默认为false
http.cors.allow-origin当设置允许跨域,默认为*,表示支持所有域名,如果我们只是允许某些网站能访问,那么可以使用正则表达式。比如只允许本地地址。 /https?:\/\/localhost(:[0-9]+)?/
http.cors.max-age浏览器发送一个“预检”OPTIONS请求,以确定CORS设置。最大年龄定义多久的结果应该缓存。默认为1728000(20天)
http.cors.allow-methods允许跨域的请求方式,默认OPTIONS,HEAD,GET,POST,PUT,DELETE
http.cors.allow-headers跨域允许设置的头信息,默认为X-Requested-With,Content-Type,Content-Length
http.cors.allow-credentials是否返回设置的跨域Access-Control-Allow-Credentials头,如果设置为true,那么会返回给客户端。

 

x-pack

x-pack监控作用 

功能


图形展示     xpack.graph.enabled       只使用于kibana组件
报表统计     pack.reporting.enabled   只使用于kibana组件
报警通知     xpack.watcher.enabled   只适用于elasticsearch组件
安全认证     xpack.security.enabled   适用于elk的三个组件
监控跟踪     xpack.monitoring.enabled    适用于elk的三个组件
设备资源分配   xpack.ml.enabled      适用于elasticsearch和kibana组件

#设置                     #描述
xpack.graph.enabled       #设置为false以禁用X-Pack图形功能。
xpack.ml.enabled          #设置为false以禁用X-Pack机器学习功能。
xpack.monitoring.enabled  #设置为false以禁用X-Pack监视功能。
xpack.reporting.enabled   #设置为false以禁用X-Pack报告功能。
xpack.security.enabled    #设置为false以禁用X-Pack安全功能。
xpack.watcher.enabled     #设置为false以禁用Watche

node.master: false 这样这个节点就不会成为master节点 

 

 

监视 数据集合

这些xpack.monitoring.collection设置控制如何从Elasticsearch节点收集数据

xpack.monitoring.collection.enabled: true 启用

xpack.monitoring.collection.interval: 30s  间隔时间、

https://segmentfault.com/a/1190000016824141?utm_source=tag-newest

https://www.elastic.co/guide/en/elasticsearch/reference/6.3/monitoring-settings.html

 

开启ssl

xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

 

开启跨越

 

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: "Authorization,X-Requested-With,Content-Length,Content-Type"

 

开启监控

xpack.monitoring.enabled: true
xpack.monitoring.collection.enabled: true
xpack.monitoring.collection.interval: 30s

 

ES插件

官网下载安装包 

https://www.elastic.co/cn/

然后安装jdk  node.js环境

https://www.cnblogs.com/wudequn/p/11147869.html

https://www.cnblogs.com/wudequn/p/11072561.html

官方文档

https://www.elastic.co/cn/blog/security-for-elasticsearch-is-now-free

https://www.elastic.co/guide/cn/index.html

 

 https://discuss.elastic.co

 

https://github.com/elastic

 

一、IK分词

https://github.com/medcl/elasticsearch-analysis-ik/releases

下载后,加压,文件夹重命名  ik,放在plugins目录下。

 

安装ES

 一、修改配置文件

 1、安装证书

在bin下执行 elasticsearch-certutil cert -out config/elastic-certificates.p12 -pass ""

2、生成密码

bin下执行elasticsearch-setup-passwords auto

 

 密码将随机生成并打印到控制台 按下 y 确认

3、子节点设置

打开另一个新的ES节点的目录 我的是下图中的 node,这是master的一个副本,只是文件夹名不一样

修改node的config/elasticsearch.yml
除了和master相同的安全配置之外,还要添加
node.master: false 这样这个节点就不会成为master节点

xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
#此节点不会成为主节点
node.master: false

 

二、控制台启动ES  或者通过下面的服务启动ES

 

三、或者安装ES服务

 

或者通过nssm

四、测试

五、安装es-head

alsticsearch只是后端提供各种API,那么怎么直观的使用它呢?Elasticsearch-head将是一款专门针对于Elasticsearch的客户端工具

Elasticsearch-head安装包包,下载地址:https://github.com/mobz/elasticsearch-head

修改es-head目录下面的Gruntfile.js文件,添加hostname:’*'

 

1、首先要安装node.js:安装教程

2、cmd执行 npm install -g grunt-cli 安装grunt ,安装完成后执行grunt -version查看是否安装成功,会显示安装的版本号

3、在es-head目录下cmd执行  grunt server 或者npm run start 运行head插件

 

如果设置了es安全

则登录

http://localhost:9100/?auth_user=elastic&auth_password=caKBawShu0Pm7BsjSFbd 

 

学习视频

https://www.elastic.co/cn/webinars/getting-started-elasticsearch?elektra=home&storm=sub1

https://blog.csdn.net/MicoMecy/article/details/90642163

https://www.jianshu.com/p/5e65e04b4b64

转载于:https://www.cnblogs.com/wudequn/p/11001382.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值