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

中间件: ElasticSearch的安装与部署

文档地址:
https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html

单机部署

创建用户:

useradd es
chown -R es /opt/soft/
mkdir -p /var/log/elastic
chown -R es /var/log/elastic
mkdir -p /tmp/elastic
chown -R es /tmp/elastic

系统参数配置:

echo "vm.max_map_count = 262144" >> /etc/sysctl.conf
sysctl -pecho "* soft nofile 65536
* hard nofile 65536" >> /etc/security/limits.conf 

方式一:YUM安装

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
echo "[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md" >> /etc/yum.repos.d/elasticsearch.repoyum install -y --enablerepo=elasticsearch elasticsearch

方式二:

cd /opt/soft/archive
wget https://mirrors.huaweicloud.com/elasticsearch/7.15.1/elasticsearch-7.15.1-linux-x86_64.tar.gz
tar -zxf elasticsearch-7.15.1-linux-x86_64.tar.gz -C ../echo 'cluster.name: my-application
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
discovery.seed_hosts: ["127.0.0.1"]
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true' >> /opt/soft/elasticsearch-7.15.1/config/elasticsearch.yml

配置

echo 'cluster.name: my-application
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
discovery.seed_hosts: ["127.0.0.1"]
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true' >> /etc/elasticsearch/elasticsearch.yml
systemctl daemon-reload

启动

systemctl start elasticsearch

集群部署

xpack.security.enabled: true
xpack.license.self_generated.type: basic
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

(1)修改配置elasticsearch.yml:

  • cluster.name # 一个集群内cluster name 需要相同
  • node.name # 各个节点node name 唯一
  • discovery.seed_hosts #
  • network.host
  • node.master # 主节点
  • node.data # 数据节点

(2)生成CA证书:

bin/elasticsearch-certutil ca

使用第一步生成的证书,生成p12密钥:

bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12

然后将证书复制到其余节点。
(3)然后启动所有节点,然后在主节点生成密码:

bin/elasticsearch-setup-password auto

查看集群状态:

curl -XGET 'http://<elasticsearch_host>:<elasticsearch_port>/_cluster/health?pretty=true'
http://www.lryc.cn/news/131174.html

相关文章:

  • LabVIEW模拟化学反应器的工作
  • Python基础语法入门(第二十三天)——正则表达式
  • 山西电力市场日前价格预测【2023-08-20】
  • C++中function,bind,lambda
  • 跟着美团学设计模式(感处)
  • 2023/8/19 小红书 Java 后台开发面经
  • 基于traccar快捷搭建gps轨迹应用
  • 【深度学习-图像识别】使用fastai对Caltech101数据集进行图像多分类(50行以内的代码就可达到很高准确率)
  • Debian10: 安装nut服务器(UPS)
  • 神经网络基础-神经网络补充概念-47-动量梯度下降法
  • C++11并发与多线程笔记(13) 补充知识、线程池浅谈、数量谈、总结
  • python高级基础
  • 使用线性回归模型优化权重:探索数据拟合的基础
  • 亿级短视频,如何架构?
  • jenkins pipeline方式一键部署github项目
  • Vue 项目搭建
  • 【NetCore】09-中间件
  • 机器学习深度学习——BERT(来自transformer的双向编码器表示)
  • Datawhale Django后端开发入门 Vscode TASK02 Admin管理员、外键的使用
  • 【ES5和ES6】数组遍历的各种方法集合
  • 学科在线教育元宇宙VR虚拟仿真平台落实更高质量的交互学习
  • [python爬虫] 爬取图片无法打开或已损坏的简单探讨
  • vue项目预览pdf功能(解决动态文字无法显示的问题)
  • vue3 样式穿透:deep不生效
  • 云原生反模式
  • 【2023年11月第四版教材】《第5章-信息系统工程(合集篇)》
  • 【qiankun】微前端在项目中的具体使用
  • 云安全与多云环境管理:讨论在云计算和多云环境下如何保护数据、应用程序和基础设施的安全
  • npm install ffi各种失败,换命令npm i ffi-napi成功
  • 0.flink学习资料