当前位置: 首页 > news >正文

elasticsearch7.10.2集群部署带认证

安装elasticsearch

rpm包安装
下载地址
https://mirrors.aliyun.com/elasticstack/7.x/yum/7.10.2/

生成证书

#1.生成CA证书
# 生成CA证书,执行命令后,系统还会提示你输入密码,可以直接留空
cd /usr/share/elasticsearch/bin
./elasticsearch-certutil ca#会在/usr/share/elasticsearch/下生成一个elastic-stack-ca.p12文件
ls -l /usr/share/elasticsearch/
-rw-------. 1 elastic elastic 2527 May 21 14:29 elastic-stack-ca.p12#2.根据elastic-stack-ca.p12文件 生成elastic-certificates.p12
# 生成证书和私钥,系统还会提示你输入密码,你可以输入证书和密钥的密码,也可以留空
cd /usr/share/elasticsearch/
./bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12

把生成的证书放到 /etc/elasticsearch/目录下,并授权

不加认证,启动集群模式

egrep -v “#|^$” /etc/elasticsearch/elasticsearch.yml

cluster.name: es
node.name: es1
path.data: /app/es/data
path.logs: /app/es/log
network.host: 0.0.0.0
node.master: true
node.data: true
discovery.seed_hosts: ["172.17.13.10:9300", "172.17.13.11:9300", "172.17.13.12:9300"]
cluster.initial_master_nodes: ["es1", "es2", "es3"]
discovery.zen.minimum_master_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: "*"
#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-stack-ca.p12
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

启动集群,查看状态

curl -XGET  "http://127.0.0.1:9200/_cat/nodes"

添加认证和证书,重启集群

egrep -v “#|^$” /etc/elasticsearch/elasticsearch.yml

cluster.name: es
node.name: es1
path.data: /app/es/data
path.logs: /app/es/log
network.host: 0.0.0.0
node.master: true
node.data: true
discovery.seed_hosts: ["172.17.13.10:9300", "172.17.13.11:9300", "172.17.13.12:9300"]
#cluster.initial_master_nodes: ["es1", "es2", "es3"]
discovery.zen.minimum_master_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: "*"
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-stack-ca.p12
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

设置口令

./bin/elasticsearch-setup-passwords interactive

查看集群信息

curl -XGET -u elastic:123456 "http://127.0.0.1:9200/_cluster/health?pretty"
curl -XGET -u elastic:123456 "http://127.0.0.1:9200/_cat/nodes"

kibana

vim /etc/kibana/kibana.yml

server.port: 5601
server.host: 0.0.0.0
elasticsearch.hosts: ["http://192.168.0.11:9200","http://192.168.0.12:9200","http://192.168.0.13:9200"]
xpack.security.enabled: true
kibana.index: ".kibana"
i18n.locale: "zh-CN"
elasticsearch.username: "elastic"
elasticsearch.password: "123456"
http://www.lryc.cn/news/491151.html

相关文章:

  • Java基础-I/O流
  • 全面解析多种mfc140u.dll丢失的解决方法,五种方法详细解决
  • 详细探索xinput1_3.dll:功能、问题与xinput1_3.dll丢失的解决方案
  • InfluxDB时序数据库笔记(一)
  • Spring Boot 3.x + OAuth 2.0:构建认证授权服务与资源服务器
  • 2024年09月CCF-GESP编程能力等级认证Scratch图形化编程二级真题解析
  • Linux 正则表达式(basic and extened)
  • GB 35114-2017 学习笔记(规避版权阉割版)
  • YOLO-FaceV2: A Scale and Occlusion Aware Face Detector
  • 进程间通信--详解
  • 零基础上手WebGIS+智慧校园实例(1)【html by js】
  • 【Github】如何使用Git将本地项目上传到Github
  • 集合Queue、Deque、LinkedList、ArrayDeque、PriorityQueue详解
  • 谈一下开源生态对 AI人工智能大模型的促进作用
  • 基于python的机器学习(四)—— 聚类(一)
  • 实时数据开发 | 怎么通俗理解Flink容错机制,提到的checkpoint、barrier、Savepoint、sink都是什么
  • C++设计模式-策略模式-StrategyMethod
  • 小程序免备案:快速部署与优化的全攻略
  • Jmeter中的定时器
  • C++自动化测试:GTest 与 GitLab CI/CD 的完美融合
  • vscode连接远程开发机报错
  • 神经网络12-Time-Series Transformer (TST)模型
  • IDEA 2024安装指南(含安装包以及使用说明 cannot collect jvm options 问题 四)
  • Fakelocation Server服务器/专业版 Centos7
  • oracle的静态注册和动态注册
  • 机器翻译基础与模型 之四:模型训练
  • Vue——响应式数据,v-on,v-bind,v-if,v-for(内含项目实战)
  • ceph 18.2.4二次开发,docker镜像制作
  • 产品经理的项目管理课
  • Linux 下的 AWK 命令详细指南与示例