中间件: 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 -p

echo "* 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.repo

yum 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'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一点博客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值