线上ES集群部署

一.下载安装包

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.0-linux-x86_64.tar.gz

二.配置节点(三个节点)

节点1:x.x.x.61

节点2:x.x.x.62

节点3:x.x.x.73

三.配置节点参数

节点1配置:直接linux命令行直接复制粘贴

cat >> elasticsearch.yml <<EOF

#====================================61==================================

# ======================== Elasticsearch Configuration =========================

cluster.name: cluster-Es

node.name: es3

network.host: 0.0.0.0

node.master: true

node.data: true

path.data: /data/es/data

path.logs: /data/es/log

# head 插件需要这打开这两个配置

http.cors.allow-origin: "*"

http.cors.enabled: true

http.max_content_length: 200mb

# 可以选举的主节点

cluster.initial_master_nodes: ["x.x.x.61:9300","x.x.x.62:9300","x.x.x.x:9300"]

discovery.seed_hosts: ["x.x.x.61:9300","x.x.x.x:9300","x.x.x.73:9300"]

gateway.recover_after_nodes: 2

network.tcp.keep_alive: true

network.tcp.no_delay: true

transport.tcp.compress: true

#集群内同时启动的数据任务个数,默认是2个

cluster.routing.allocation.cluster_concurrent_rebalance: 16

#添加或删除节点及负载均衡时并发恢复的线程个数,默认4个

cluster.routing.allocation.node_concurrent_recoveries: 16

#初始化数据恢复时,并发恢复线程的个数,默认4个

cluster.routing.allocation.node_initial_primaries_recoveries: 16

#开启 xpack 功能,如果要禁止使用密码,请将以下内容注释,直接启动不需要设置密码

#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-certificates.p12

EOF

节点2配置:直接linux命令行直接复制粘贴

cat >> elasticsearch.yml <<EOF

#====================================62==================================

# ======================== Elasticsearch Configuration =========================

cluster.name: cluster-Es

node.name: es2

network.host: 0.0.0.0

node.master: true

node.data: true

path.data: /data/es/data

path.logs: /data/es/log

# head 插件需要这打开这两个配置

http.cors.allow-origin: "*"

http.cors.enabled: true

http.max_content_length: 200mb

# 可以选举的主节点

cluster.initial_master_nodes: ["x.x.x.61:9300","x.x.x.62:9300","x.x.x.73:9300"]

discovery.seed_hosts: ["x.x.x.61:9300","x.x.x.62:9300","x.x.x.73:9300"]

gateway.recover_after_nodes: 2

network.tcp.keep_alive: true

network.tcp.no_delay: true

transport.tcp.compress: true

#集群内同时启动的数据任务个数,默认是2个

cluster.routing.allocation.cluster_concurrent_rebalance: 16

#添加或删除节点及负载均衡时并发恢复的线程个数,默认4个

cluster.routing.allocation.node_concurrent_recoveries: 16

#初始化数据恢复时,并发恢复线程的个数,默认4个

cluster.routing.allocation.node_initial_primaries_recoveries: 16

#开启 xpack 功能,如果要禁止使用密码,请将以下内容注释,直接启动不需要设置密码

#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-certificates.p12

EOF

节点3配置:直接linux命令行直接复制粘贴

cat >> elasticsearch.yml <<EOF

# ====================================73==================================

# ======================== Elasticsearch Configuration =========================

cluster.name: cluster-Es

node.name: es1

network.host: 0.0.0.0

node.master: true

node.data: true

path.data: /data/es/data

path.logs: /data/es/log

# head 插件需要这打开这两个配置

http.cors.allow-origin: "*"

http.cors.enabled: true

http.max_content_length: 200mb

# 可以选举的主节点

cluster.initial_master_nodes: ["x.x.x.61:9300","x.x.x.62:9300","x.x.x.73:9300"]

discovery.seed_hosts: ["x.x.x.61:9300","x.x.x.62:9300","x.x.x.73:9300"]

gateway.recover_after_nodes: 2

network.tcp.keep_alive: true

network.tcp.no_delay: true

transport.tcp.compress: true

#集群内同时启动的数据任务个数,默认是2个

cluster.routing.allocation.cluster_concurrent_rebalance: 16

#添加或删除节点及负载均衡时并发恢复的线程个数,默认4个

cluster.routing.allocation.node_concurrent_recoveries: 16

#初始化数据恢复时,并发恢复线程的个数,默认4个

cluster.routing.allocation.node_initial_primaries_recoveries: 16

#开启 xpack 功能,如果要禁止使用密码,请将以下内容注释,直接启动不需要设置密码

#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-certificates.p12

EOF

四.启动集群

./elasticsearch -d -p pid

启动报错

修改配置

vim /etc/sysctl.conf

vm.max_map_count = 562144

五.验证服务可用性

curl -l http://x.x.x.x:9200

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

远方有海,小样不乖

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

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

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

打赏作者

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

抵扣说明:

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

余额充值