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

50 lines
1.7 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
# =============================================================================
# 步骤 1从原数据机拉取数据文件到迁移目标机全量版
# 仅传输数据files/ kg_output/ kg_snapshot.json
# 在【迁移目标机】上执行本脚本
# 配置项请修改 migration_config.sh
# =============================================================================
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "${SCRIPT_DIR}/migration_config.sh"
set -e
echo "=========================================="
echo " kgrag 数据迁移脚本 - 步骤 1全量"
echo " 原数据机: ${SRC_SERVER}:${SRC_APP_DIR}"
echo " 目标代码目录: ${DST_CODE_DIR}"
echo " 目标文件目录: ${DST_FILES_DIR}"
echo "=========================================="
mkdir -p "${DST_FILES_DIR}"
mkdir -p "${DST_CODE_DIR}/kg_output"
echo ""
echo "[1/3] 原始文档 → ${DST_FILES_DIR}/ ..."
rsync -avz --progress ${RSYNC_EXTRA} \
-e "ssh -p ${SRC_SSH_PORT}" \
"${SRC_SERVER}:${SRC_APP_DIR}/files/" \
"${DST_FILES_DIR}/"
echo ""
echo "[2/3] kg_output → ${DST_CODE_DIR}/kg_output/ ..."
rsync -avz --progress ${RSYNC_EXTRA} \
-e "ssh -p ${SRC_SSH_PORT}" \
"${SRC_SERVER}:${SRC_APP_DIR}/kg_output/" \
"${DST_CODE_DIR}/kg_output/"
echo ""
echo "[3/3] kg_snapshot.json → ${DST_CODE_DIR}/ ..."
rsync -avz --progress ${RSYNC_EXTRA} \
-e "ssh -p ${SRC_SSH_PORT}" \
"${SRC_SERVER}:${SRC_APP_DIR}/kg_snapshot.json" \
"${DST_CODE_DIR}/kg_snapshot.json"
echo ""
echo "=========================================="
echo " 数据迁移完成!"
echo " 下一步:执行 bash 02_load_neo4j.sh"
echo "=========================================="