kgrag/kgrag_migration/02_load_neo4j_by_ship.sh
2026-06-30 13:35:52 +08:00

49 lines
1.5 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# =============================================================================
# 步骤 2将指定舰船的 kg_snapshot.json 导入迁移目标机的 Neo4j按舰版
# 在【迁移目标机】上执行本脚本
# 配置项IMPORT_SHIP 等)请修改 migration_config.sh
# =============================================================================
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "${SCRIPT_DIR}/migration_config.sh"
PYTHON="python3"
set -e
if [ -z "$IMPORT_SHIP" ]; then
echo "错误migration_config.sh 中 IMPORT_SHIP 未设置。"
echo "如需导入全量快照,请使用 02_load_neo4j.sh。"
exit 1
fi
SNAPSHOT_PATH="${DST_CODE_DIR}/migration_split/${IMPORT_SHIP}/kg_snapshot.json"
echo "=========================================="
echo " kgrag Neo4j 导入脚本 - 步骤 2按舰版"
echo " 导入舰船: ${IMPORT_SHIP}"
echo " 快照文件: ${SNAPSHOT_PATH}"
echo "=========================================="
if [ ! -f "${SNAPSHOT_PATH}" ]; then
echo "错误:快照文件不存在: ${SNAPSHOT_PATH}"
echo "请先运行 split_by_ship.py 生成按舰快照。"
exit 1
fi
echo ""
echo "快照文件大小: $(du -sh ${SNAPSHOT_PATH} | cut -f1)"
echo ""
cd "${DST_CODE_DIR}"
${PYTHON} batch_kg_build.py \
--phase load_snapshot \
--snapshot_path "${SNAPSHOT_PATH}"
echo ""
echo "=========================================="
echo " Neo4j 导入完成!已导入: ${IMPORT_SHIP}"
echo " 下一步:执行 bash 02b_rebuild_index.sh"
echo "=========================================="