写在前面的话
比较通透。昨天,同事的老公来找我,之前就说过,让我有点诧异,有什么事呢?但没敢问,上周说是给我送点土特产,让我有点受宠若惊,我说,我都没给你们送过什么。在北京十年,基本0收礼,也0送礼,交际比较简单。兄弟来了,卡卡往外掏礼物,价值不菲,我说这条烟就两三百,太贵重了。兄弟坚持,就放下了。中午一起吃饭,兄弟问我:你每天坚持到两三点,你觉得值得吗,这个岁数用命换钱没必要,我一般都12点就睡。我说:就这一段,之前也是回来刷刷视频就睡了。兄弟说:看你也不保养,衣服穿的也挺随便,身材也胖不少,放飞自我了呀。我说:你的体型没咋变化,我现在220斤,胖了一圈。吃完饭,我这边上号比较忙,兄弟买的空调到了,人家在门口等着,就回去了。看着兄弟的装束,再看看我,恍惚有点不是一个层次的人似的,实际上我们关系很好。
[234+100]-------底部有张生活照片
(头条号运营:大家想全托管上号的联系我哦,每天让你得个早餐钱,wx: qhz198607)
【关键词】python、ragflow、索引重建、同步数据
一、ES索引新建(三级)
描述:看下怎么对索引数据进行备份。
开工:
第一步:查资料(四级)
20250403周四时间段:15:12-16:00
先不备份,备份感觉好复杂。
接下来的思路是新建索引。
第二步:新建索引(四级)
20250403周四时间段:15:34-16:00
curl.exe -u "elffastic:infdddini_rag_flow" -X PUT "http://es01:1200/my_index_new" -H "Content-Type: application/json" -d "{\`"settings\`":{\`"number_of_shards\`":24,\`"number_of_replicas\`":1}}"建成如下:
图1a-1
注:同样的配方,建个大的,如下:
curl.exe -u "elastdic:inddfini_rag_flow" -X PUT "http://es01:1200/ragflow_7d19a176807611efb0f80242ac120006_new" -H "Content-Type: application/json" -d
"{\`"settings\`":{\`"number_of_shards\`":24,\`"number_of_replicas\`":1},\`"mappings\`":{\`"_doc\`":{\`"dynamic_templates\`":[{\`"int\`":{\`"mapping\`":{\`"store\`":\`"true\`",\`"type\`":\`"integer\`"},\`"match\`":\`"*_int\`"}},{\`"ulong\`":{\`"mapping\`":{\`"store\`":\`"true\`",\`"type\`":\`"unsigned_long\`"},\`"match\`":\`"*_ulong\`"}},{\`"long\`":{\`"mapping\`":{\`"store\`":\`"true\`",\`"type\`":\`"long\`"},\`"match\`":\`"*_long\`"}},{\`"short\`":{\`"mapping\`":{\`"store\`":\`"true\`",\`"type\`":\`"short\`"},\`"match\`":\`"*_short\`"}},{\`"numeric\`":{\`"mapping\`":{\`"store\`":true,\`"type\`":\`"float\`"},\`"match\`":\`"*_flt\`"}},{\`"tks\`":{\`"mapping\`":{\`"analyzer\`":\`"whitespace\`",\`"similarity\`":\`"scripted_sim\`",\`"store\`":true,\`"type\`":\`"text\`"},\`"match\`":\`"*_tks\`"}},{\`"ltks\`":{\`"mapping\`":{\`"analyzer\`":\`"whitespace\`",\`"store\`":true,\`"type\`":\`"text\`"},\`"match\`":\`"*_ltks\`"}},{\`"kwd\`":{\`"match_pattern\`":\`"regex\`",\`"mapping\`":{\`"similarity\`":\`"boolean\`",\`"store\`":true,\`"type\`":\`"keyword\`"},\`"match\`":\`"^(.*_(kwd|id|ids|uid|uids)|uid)$\`"}},{\`"dt\`":{\`"match_pattern\`":\`"regex\`",\`"mapping\`":{\`"format\`":\`"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyy-MM-dd_HH:mm:ss\`",\`"store\`":true,\`"type\`":\`"date\`"},\`"match\`":\`"^.*(_dt|_time|_at)$\`"}},{\`"nested\`":{\`"mapping\`":{\`"type\`":\`"nested\`"},\`"match\`":\`"*_nst\`"}},{\`"object\`":{\`"mapping\`":{\`"dynamic\`":\`"true\`",\`"type\`":\`"object\`"},\`"match\`":\`"*_obj\`"}},{\`"string\`":{\`"mapping\`":{\`"index\`":\`"false\`",\`"store\`":true,\`"type\`":\`"text\`"},\`"match\`":\`"*_with_weight\`"}},{\`"string\`":{\`"mapping\`":{\`"type\`":\`"rank_feature\`"},\`"match\`":\`"*_fea\`"}},{\`"dense_vector\`":{\`"mapping\`":{\`"dims\`":512,\`"similarity\`":\`"cosine\`",\`"index\`":true,\`"type\`":\`"dense_vector\`"},\`"match\`":\`"*_512_vec\`"}},{\`"dense_vector\`":{\`"mapping\`":{\`"dims\`":768,\`"similarity\`":\`"cosine\`",\`"index\`":true,\`"type\`":\`"dense_vector\`"},\`"match\`":\`"*_768_vec\`"}},{\`"dense_vector\`":{\`"mapping\`":{\`"dims\`":1024,\`"similarity\`":\`"cosine\`",\`"index\`":true,\`"type\`":\`"dense_vector\`"},\`"match\`":\`"*_1024_vec\`"}},{\`"dense_vector\`":{\`"mapping\`":{\`"dims\`":1536,\`"similarity\`":\`"cosine\`",\`"index\`":true,\`"type\`":\`"dense_vector\`"},\`"match\`":\`"*_1536_vec\`"}},{\`"binary\`":{\`"mapping\`":{\`"type\`":\`"binary\`"},\`"match\`":\`"*_bin\`"}}],\`"date_detection\`":true,\`"properties\`":{\`"weight_int\`":{\`"store\`":true,\`"type\`":\`"integer\`"},\`"content_with_weight\`":{\`"index\`":false,\`"store\`":true,\`"type\`":\`"text\`"},\`"create_timestamp_flt\`":{\`"store\`":true,\`"type\`":\`"float\`"},\`"img_id\`":{\`"similarity\`":\`"boolean\`",\`"store\`":true,\`"type\`":\`"keyword\`"},\`"title_tks\`":{\`"analyzer\`":\`"whitespace\`",\`"similarity\`":\`"scripted_sim\`",\`"store\`":true,\`"type\`":\`"text\`"},\`"weight_flt\`":{\`"store\`":true,\`"type\`":\`"float\`"},\`"available_int\`":{\`"store\`":true,\`"type\`":\`"integer\`"},\`"important_kwd\`":{\`"similarity\`":\`"boolean\`",\`"store\`":true,\`"type\`":\`"keyword\`"},\`"kb_id\`":{\`"similarity\`":\`"boolean\`",\`"store\`":true,\`"type\`":\`"keyword\`"},\`"rank_int\`":{\`"store\`":true,\`"type\`":\`"integer\`"},\`"position_int\`":{\`"store\`":true,\`"type\`":\`"integer\`"},\`"top_int\`":{\`"store\`":true,\`"type\`":\`"integer\`"},\`"lat_lon\`":{\`"store\`":true,\`"type\`":\`"geo_point\`"},\`"title_sm_tks\`":{\`"analyzer\`":\`"whitespace\`",\`"similarity\`":\`"scripted_sim\`",\`"store\`":true,\`"type\`":\`"text\`"},\`"q_4096_vec\`":{\`"dims\`":4096,\`"similarity\`":\`"cosine\`",\`"index\`":true,\`"type\`":\`"dense_vector\`"},\`"create_time\`":{\`"format\`":\`"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyy-MM-dd_HH:mm:ss\`",\`"store\`":true,\`"type\`":\`"date\`"},\`"knowledge_graph_kwd\`":{\`"similarity\`":\`"boolean\`",\`"store\`":true,\`"type\`":\`"keyword\`"},\`"content_ltks\`":{\`"analyzer\`":\`"whitespace\`",\`"store\`":true,\`"type\`":\`"text\`"},\`"content_sm_ltks\`":{\`"analyzer\`":\`"whitespace\`",\`"store\`":true,\`"type\`":\`"text\`"},\`"authors_sm_tks\`":{\`"analyzer\`":\`"whitespace\`",\`"similarity\`":\`"scripted_sim\`",\`"store\`":true,\`"type\`":\`"text\`"},\`"doc_id\`":{\`"similarity\`":\`"boolean\`",\`"store\`":true,\`"type\`":\`"keyword\`"},\`"q_1024_vec\`":{\`"dims\`":1024,\`"similarity\`":\`"cosine\`",\`"index\`":true,\`"type\`":\`"dense_vector\`"},\`"authors_tks\`":{\`"analyzer\`":\`"whitespace\`",\`"similarity\`":\`"scripted_sim\`",\`"store\`":true,\`"type\`":\`"text\`"},\`"docnm_kwd\`":{\`"similarity\`":\`"boolean\`",\`"store\`":true,\`"type\`":\`"keyword\`"},\`"page_num_int\`":{\`"store\`":true,\`"type\`":\`"integer\`"},\`"name_kwd\`":{\`"similarity\`":\`"boolean\`",\`"store\`":true,\`"type\`":\`"keyword\`"},\`"entities_kwd\`":{\`"similarity\`":\`"boolean\`",\`"store\`":true,\`"type\`":\`"keyword\`"}}}}}"
第三步:删除无用索引(四级)
20250403周四时间段:18:30-19:00
删除无用索引,因为占的太大了,6T,截图如下:
图1a-2
注:接下来,删除这个索引。
curl.exe -X DELETE "http://localhost:9200/my_index"
怎么查目前有哪些索引,语句如下:
curl -XGET 'http://localhost:9200/_cat/indices?v'
注:在postman中查查试试。效果如下:
图1a-3
注:接下来,给索引改名字。
第四步:索引改名字(四级)
20250403周四时间段:19:30-20:00
想着,把索引my_index_new改为ragflow_7d19a176807611efb0f80242ac120006_new,改名很复杂,先不改名了,改mapping。
第五步:改mapping(四级)
现在建了个索引,但映射没建,需要做一下,现在es很慢,查询没事,但删除、新建都不成功,接下来,把这个索引【my_index_new】删除掉。
操作效果如下:
图1a-4
注:接下来,重建索引。
第六步:重建索引(四级)
20250403周四时间段:20:05-21:00
先获取旧索引的mapping,如下:
图1a-5
注:接下来,获取索引的setting,最终,创建索引成功,如下:
图1a-6
注:在索引列表中的表现如下:
图1a-7
注:接下来,同步数据到新索引。
二、同步索引数据(三级)
描述:现在新索引创建完毕,需要把旧索引中的数据同步过去,看下怎么做。
开工:
第一步:同步数据语句(四级)
20250403周四时间段:20:28-21:00
# 3. 将旧索引数据迁移到新索引
POST _reindex
{
"source": { "index": "old_index" },
"dest": { "index": "new_index" }
}
注:用postman搞一下,截图如下:
图1b-1
注:关注下新索引的数据是否有增加。发现是增加的,截图如下:
图1b-2
注:现在已增加到4.37G了,一会试试效果。
注:这个看不到速度,结果花了36个小时,也没结果。现在重建索引ragflow_7d19a176807611efb0f80242ac120006_new2,接下来,看下速度。
第二步:同步速度(四级)
20250405周六时间段:16:10-17:00
看下deepseek是咋说的,如下:
进行了索引优化:
PUT ragflow_7d19a176807611efb0f80242ac120006_new2/_settings
{
"index": {
"number_of_replicas": 0, // 关闭副本
"refresh_interval": "60s", // 降低刷新频率
"translog.durability": "async" // 异步写事务日志
}
}
集群优化:
PUT _cluster/settings
{
"persistent": {
# 增大写入线程池容量
"thread_pool.write.queue_size": 2000,
# 调整断路器限制
"indices.breaker.total.limit": "70%"
}
}
注:集群优化,不知道在哪配,用提高内存替代了,如下:
# 原配置可能为 -Xms8g -Xmx8g
-Xms31g
-Xmx31g
注:接下来,看下同步速度。监控到报错如下:
"error": {
"type": "es_rejected_execution_exception",
"reason": "rejected execution of coordinating operation [coordinating_and_primary_bytes=3212798284, replica_bytes=0, all_bytes=3212798284, coordinating_operation_bytes=401960493, max_coordinating_and_primary_bytes=3328599654]",
"suppressed": [
{
"type": "es_rejected_execution_exception",
"reason": "rejected execution of coordinating operation [coordinating_and_primary_bytes=3212798284, replica_bytes=0, all_bytes=3212798284, coordinating_operation_bytes=398129360, max_coordinating_and_primary_bytes=3328599654]"
},
{
"type": "es_rejected_execution_exception",
"reason": "rejected execution of coordinating operation [coordinating_and_primary_bytes=3212798284, replica_bytes=0, all_bytes=3212798284, coordinating_operation_bytes=401857743, max_coordinating_and_primary_bytes=3328599654]"
},注:查下deepseek,看看原因。处理如下:
1. 清理失败任务
# 强制终止残留任务
POST _tasks/huw827OYQ1OHqgPbdCI9jw:51116/_cancel
# 修改 scroll 超时时间(永久生效)
PUT _cluster/settings
{
"persistent": {
"search.max_keep_alive": "30m"
}
}
注:现在基本可以,先这样,截图如下:
图1b-3
注:接下来,看下怎么查看同步日志。
第三步:查看同步日志(四级)
20250405周六时间段:16:10-17:00
看下怎么查看同步日志,这个要问下deepseek,并试试能不能看到。
三、头条号战果汇报
昨日总播放:263.6万,总收入:148.8,累计收入:4878.4块,可提现:1636.3,软件截图如下:
图1c-1
注:想要全脱管运营头条号的联系我,你出账号,我来运营,收益四六分成(你六我四),你当甩手掌柜,每天都能得几块零花钱,财富wx: 17701328814,也可以加群先了解一下。
图1c-2
四、生活照片
拍摄于2026年2月1日,10:50:56,带二宝去看花,二宝当时三岁五个月。兄弟走了之后,把掉线的号能联系上的挂上,陷入了短暂的沉思。兄弟说的对,不能说结婚之后,就没有了自己的生活,就要梭哈到孩子身上,就像兄弟所说,自己买个空调,舒舒服服的吹着凉风,拷着串,挺爽的。把我说的都有点心动了,我想起我刚来北京那会,买衣服一买就是三五件,鞋子一买三五双,都是牌子的。现在每个月也不少花钱,所以,媳妇时不时质问我,你的钱都花在哪里了,给我拉清单,我说,我也没花自己身上啊。所以,现在先把家庭搞和谐,再想着潇洒吧,每个家庭不一样,不能完全复制兄弟的经验。
图1d-1
《本文完》