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

41 lines
1.3 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
# 在【迁移目标机】上执行本脚本
# 配置项请修改 migration_config.sh
# =============================================================================
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "${SCRIPT_DIR}/migration_config.sh"
SNAPSHOT_PATH="${DST_CODE_DIR}/kg_snapshot.json"
PYTHON="docker exec ${KGRAG_CONTAINER} python3"
set -e
echo "=========================================="
echo " kgrag Neo4j 导入脚本 - 步骤 2全量"
echo " 快照文件: ${SNAPSHOT_PATH}"
echo "=========================================="
if [ ! -f "${SNAPSHOT_PATH}" ]; then
echo "错误:快照文件不存在: ${SNAPSHOT_PATH}"
echo "请先执行步骤 1 迁移文件。"
exit 1
fi
echo ""
echo "快照文件大小: $(du -sh ${SNAPSHOT_PATH} | cut -f1)"
echo ""
cd "${DST_CODE_DIR}"
${PYTHON} ${CONTAINER_APP_DIR}/batch_kg_build.py \
--phase load_snapshot \
--snapshot_path "${CONTAINER_APP_DIR}/kg_snapshot.json"
echo ""
echo "=========================================="
echo " Neo4j 导入完成!"
echo " 下一步:执行 bash 02b_rebuild_index.sh"
echo "=========================================="