中间件: 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'
相关推荐
Sendingab11 分钟前
3.4 Spring Boot整合Elasticsearch:全文检索与聚合分析
spring boot·elasticsearch·全文检索
一直在学习的小白~11 小时前
前端项目中创建自动化部署脚本,用于 Jenkins 触发 npm run publish 来完成远程部署
前端·自动化·jenkins
Elastic 中国社区官方博客11 小时前
Elasticsearch:语义文本 - 更简单、更好、更精炼、更强大 8.18
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
PagiHi15 小时前
iWebOffice2015 中间件如何在Chrome107及之后的高版本中加载
前端·javascript·chrome·中间件·edge·js
kngines16 小时前
【实战ES】实战 Elasticsearch:快速上手与深度实践-附录-2-性能调优工具箱
大数据·elasticsearch·搜索引擎
noravinsc21 小时前
install of jenkins-2.501-1.1.noarch conflicts with file
centos·jenkins
Elasticsearch1 天前
如何通过 Airbyte 将数据摄取到 Elasticsearch
elasticsearch
吱吱喔喔1 天前
NET Core中负责依赖注入和控制反转的核心组件有两个:IServiceCollection和IServiceProvider
经验分享·后端·中间件·架构·c#·依赖倒置原则
童先生2 天前
docker安装的es报错了?failed to obtain node locks怎么破~
elasticsearch·docker·jenkins
neo_Ggx232 天前
ElasticSearch 入门到放弃(持续更新中)
elasticsearch·搜索引擎·wpf