elastic配置文件详解+命令操作

  1. es配置文件详解
#集群名称:
cluster.name: yunsuo  
#节点名称     
node.name: node-16.4
#数据目录
path.data: /data/es/data
#日志目录
path.logs: /data/es/logs
#数据备份路径
path.repo: ["/data/es23back"]  数据备份路径
#禁用或启用 Elasticsearch 进程使用锁定内存的能力。启用内存锁定可以提高性能,但需要相应的操作系统权限。
bootstrap.memory_lock: true
#广播地址
network.host: 0.0.0.0
#绑定地址
network.bind_host: 0.0.0.0
#端口号
http.port: 9200
#发现集群地址
discovery.seed_hosts: ["172.26.16.4", "172.26.16.5","172.26.16.6"]
#允许成为master地址
cluster.initial_master_nodes: ["172.26.16.4", "172.26.16.5","172.26.16.6"]
#允许成为master、数据、节点、默认分片为10000个
node.master: true
node.data: true
node.ingest: true
cluster.max_shards_per_node: 10000
#是否开启安全验证
xpack.security.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.license.self_generated.type: basic
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
#是否启动磁盘配额限制
cluster.routing.allocation.disk.threshold_enabled: true
cluster.routing.allocation.disk.watermark.low: 85%
cluster.routing.allocation.disk.watermark.high: 90%
cluster.routing.allocation.disk.watermark.flood_stage: 90%

今天你安全吗?
2. elasticdump配置详解

elasticdump数据 设置、映射、数据、一致性、并发数

elasticdump --input='http://本机地址:9200/ys_event-2023-06-27' --output='http://远端地址:9200/ys_event-2023-06-27' --type=settings
elasticdump --input='http://本机地址:9200/ys_event-2023-06-27' --output='http://远端地址:9200/ys_event-2023-06-27' --type=mapping
elasticdump --input='http://本机地址:9200/ys_event-2023-06-27' --output='http://远端地址:9200/ys_event-2023-06-27' --type=data --support-big-int --limit 10000 >/tmp/1.txt &
  1. 重新分配恢复分片

查询集群里面的节点是不是有挂掉的,如果没有挂掉的试试重新分配看看能不能恢复。还要检查下/data/es 里面详细的日志;

curl  -XPOST "http://本机地址:9200/_cluster/reroute?retry_failed=true"
  1. 配置scroll为5000,临时配置最重要还是要分配足够内存
curl -X PUT -u elastic:elastic  http://127.0.0.1:9200/_cluster/settings -H 'Content-Type: application/json' -d'{"persistent" : {"search.max_open_scroll_context": 5000},"transient": {"search.max_open_scroll_context": 5000}}'
查看scroll
curl -u elastic:jowto1234 127.0.0.1:9200/_nodes/stats?pretty | grep scroll_current
  1. 查看健康值和未分配异常索引原因
curl -u elastic:elastic 10.149.3.4:9200/_cluster/health?pretty
{
  "cluster_name" : "xxx_elastic",
  "status" : "red",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 492,
  "active_shards" : 553,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 95,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 85.3395061728395
}

查看未分配异常分片数问题
curl -XGET -u  elastic:elastic http://172.26.16.6:9200/_cluster/allocation/explain?pretty
  1. 设置索引副本数
curl -v -X PUT --header 'Content-Type: application/json'  -d '{"number_of_replicas":2}'  http://172.26.15.8:9200/ys_other_log-2023-05-26/_settings
  1. 把副本数清0
curl -XPUT 'http://localhost:9200/_settings' -H 'content-Type:application/json' -d' {"number_of_replicas": 0}'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值