中间件: ElasticSearch的安装与部署

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

单机部署

创建用户:

shell 复制代码
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

系统参数配置:

shell 复制代码
echo "vm.max_map_count = 262144" >> /etc/sysctl.conf
sysctl -p

echo "* soft nofile 65536
* hard nofile 65536" >> /etc/security/limits.conf 

方式一:YUM安装

shell 复制代码
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.repo

yum install -y --enablerepo=elasticsearch elasticsearch

方式二:

shell 复制代码
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

配置

shell 复制代码
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

启动

shell 复制代码
systemctl start elasticsearch

集群部署

shell 复制代码
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

查看集群状态:

shell 复制代码
curl -XGET 'http://<elasticsearch_host>:<elasticsearch_port>/_cluster/health?pretty=true'
相关推荐
The Straggling Crow13 分钟前
熟练版本控制 (Git)、CI/CD 流程。
git·elasticsearch·ci/cd
weixin_307779131 小时前
Jenkins 多分支流水线自动化引擎:GitHub Branch Source 插件完全指南
运维·架构·自动化·jenkins
失伟4 小时前
CDC(数据变更捕获)场景应用
mongodb·elasticsearch·kafka·kafka-connect
weixin_307779134 小时前
Jenkins Ioncions API 插件:现代化图标库在持续集成中的应用
java·运维·开发语言·前端·jenkins
天草二十六_简村人4 小时前
jenkins打包制作Python镜像,并推送至docker仓库,部署到k8s
后端·python·docker·容器·kubernetes·jenkins
Elasticsearch4 小时前
使用 LangGraph . js 和 Elasticsearch 构建一个金融 AI 搜索工作流
elasticsearch
汪小成4 小时前
# 在云服务器上安装与使用Jenkins(基于 CentOS Stream 9)
jenkins
武子康5 小时前
大数据-175 Elasticsearch Term 精确查询与 Bool 组合实战:range/regexp/fuzzy 全示例
大数据·后端·elasticsearch
云和数据.ChenGuang6 小时前
运维工程师技术之MyCat中间件免费技术教程
运维·中间件·mycat·运维工程师·运维技术
weixin_307779136 小时前
Jenkins Gson API插件:统一JSON处理的基础库
java·运维·开发语言·架构·jenkins