惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

问题库 on 打工人日志

k8s master 节点 Unauthorized kindle 邮件发送失败,错误代码E999 SELinux 问题:导致端口无法创建,无法访问 linux服务器进程打开文件过多导致服务异常 Linux 系统收包流程以及内核参数优化 Vue3 + vite + nginx项目部署后404问题 githubAction set-output弃用错误 k8s CNI 问题 连接认证失效 k8s.gcr.io国内无法连接解决方法 K8S 问题排查:cgroup 内存泄露问题 docker 问题处理 安装 docker 出现 ERROR: Unsupported distribution 'ol' 问题
解决Elasticsearch索引只读(read-only)
2023-09-20 · via 问题库 on 打工人日志

背景

这两天有开发向我反馈说elasticsearch有报错,嘿,我定睛一看,这不是进入只读状态了,看来是存储达到额度,我马上加个新的数据节点,平衡一下存储压力
报错信息:

1Elasticsearch Error {type:cluster_block_exception,reason:”blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];}

新建服务器,安装elasticsearch

为了和之前的服务器一样,我简单写一下我elasticsearch版本和服务器系统版本

软件版本
centos7.9
elasticsearch6.7.2
JDK1.8.61
内存32G

安装和配置elasticsearch

使用rpm 安装

1wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.2.rpm
1rpm --install elasticsearch-6.7.2.rpm

配置参数,进入/etc/elasticsearch目录
修改配置vim elasticsearch.yml

 1# ======================== Elasticsearch Configuration ========================= 
 2
 3cluster.name: cluster-prod-es # 集群名称
 4
 5node.name: node-x # 节点名称
 6
 7path.data: /var/lib/elasticsearch # 数据存储
 8
 9path.logs: /var/log/elasticsearch  # 日志存储
10
11network.host: 192.168.0.170 # 主机IP地址 
12
13http.port: 9200 # 端口号
14
15discovery.zen.ping.unicast.hosts: ["192.168.0.171", "192.168.0.172", "192.168.0.173"] # 集群节点
16
17discovery.zen.minimum_master_nodes: 2 #防止脑裂

修改配置vim jvm.options

启动elasticsearch 服务

1systemctl start elasticsearch.service

等待数据节点自动调节

这里要等待一会儿数据节点自动调节,这个调节时间取决于你数据的大小,一般来说几个小时也好了,如果数据重要性不太高的话,和领导沟通一下,就别傻坐着等他迁移完,正常下班就行了。

关闭索引只读

对了,千万不要忘记关闭只读状态,虽然你新增了节点,但是当前的只读状态并没有关闭,所以要执行一下命令关闭只读状态

1curl -XPUT -H "Content-Type: application/json" http://192.168.0.170:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

或者你在head-elasticsearch上操作
head-es

感谢你的阅读