环境:
OS:Centos 7
DB:2.4.6
前提条件:之前做了备份,备份文件在本机服务器
1.停掉milvus
[root@host135 milvus]# cd /home/middle/milvus
[root@host135 milvus]# docker-compose stop standalone
2.删除消息队列日志文件和milvus数据文件
rocksmq日志文件
[root@host135 rdb_data]#cd /home/middle/milvus/volumes/milvus/rdb_data
[root@host135 rdb_data]# rm -rf *
[root@host135 rdb_data_meta_kv]#cd /home/middle/milvus/volumes/milvus/rdb_data_meta_kv
[root@host135 rdb_data_meta_kv]# rm -rf *
milvus数据文件(存放在minio)
[root@host135 insert_log]# cd /home/middle/milvus/volumes/minio/a-bucket/files/insert_log
[root@host135 insert_log]# rm -rf *
[root@host135 stats_log]# cd /home/middle/milvus/volumes/minio/a-bucket/files/stats_log
[root@host135 stats_log]# rm -rf *
3.启动
[root@host135 milvus]# cd /home/middle/milvus
[root@host135 milvus]# docker-compose start standalone
这个时候milvus是可以启动的
[root@host135 milvus]# docker-compose psName Command State Ports
----------------------------------------------------------------------------------------------------------------------
attu docker-entrypoint.sh /bin/ ... Up 0.0.0.0:8000->3000/tcp,:::8000->3000/tcp
milvus-etcd etcd -advertise-client-url ... Up (healthy) 2379/tcp, 2380/tcp
milvus-minio /usr/bin/docker-entrypoint ... Up (healthy) 0.0.0.0:9000->9000/tcp,:::9000->9000/tcp, 0.0.0.0:9001->9001/tcp,:::9001->9001/tcp
milvus-standalone /tini -- milvus run standalone Up (healthy) 0.0.0.0:19530->19530/tcp,:::19530->19530/tcp, 0.0.0.0:9091->9091/tcp,:::9091->9091/tcp
但是从日志有如下提示:
docker logs --tail=100 milvus-standaloneI20241112 02:16:42.192111 64 Utils.cpp:822] [SERVER][LoadFieldDatasFromRemote][milvus] failed to load data from remote: Error in GetObjectSize[errcode:404, exception:, errmessage:No response body., params:params, bucket=a-bucket, object=files/insert_log/453869183760339791/453869183760339792/453869183760540174/100/453869183760540183]
[2024/11/12 02:16:42.223 +00:00] [ERROR] [funcutil/parallel.go:88] [loadSegmentFunc] [error="At LoadSegment: Error in GetObjectSize[errcode:404, exception:, errmessage:No response body., params:params, bucket=a-bucket, object=files/insert_log/453869183760339791/453869183760339792/453869183760540174/1/453869183760540182]"] [errorVerbose="At LoadSegment: Error in GetObjectSize[errcode:404, exception:, errmessage:No response body., params:params, bucket=a-bucket, object=files/insert_log/453869183760339791/453869183760339792/453869183760540174/1/453869183760540182]\n(1) attached stack trace\n -- stack trace:\n | github.com/milvus-io/milvus/internal/querynodev2/segments.(*segmentLoader).Load.func4\n | \t/workspace/source/internal/querynodev2/segments/segment_loader.go:708\n | github.com/milvus-io/milvus/pkg/util/funcutil.ProcessFuncParallel.func3\n | \t/workspace/source/pkg/util/funcutil/parallel.go:86\n | runtime.goexit\n | \t/usr/local/go/src/runtime/asm_amd64.s:1650\nWraps: (2) At LoadSegment\nWraps: (3) Error in GetObjectSize[errcode:404, exception:, errmessage:No response body., params:params, bucket=a-bucket, object=files/insert_log/453869183760339791/453869183760339792/453869183760540174/1/453869183760540182]\nError types: (1) *withstack.withStack (2) *errutil.withPrefix (3) merr.milvusError"] [idx=0] [stack="github.com/milvus-io/milvus/pkg/util/funcutil.ProcessFuncParallel.func3\n\t/workspace/source/pkg/util/funcutil/parallel.go:88"]
提示找不到相应的数据目录
4.恢复
查看当前的备份
/opt/milvus_backup/milvus-backup list --config=/opt/milvus_backup/conf/backup.yaml
>> Backups:
bak_db_test_20240815
bak_tables_20240815
我们使用 bak_db_test_20240815 这个备份进行恢复
/opt/milvus_backup/milvus-backup restore -n bak_db_test_20240815 -d db_test --restore_index=true --config=/opt/milvus_backup/conf/backup.yaml
完成后会有如下的输出信息
[2024/11/12 10:21:38.027 +08:00] [INFO] [core/backup_impl_restore_backup.go:357] ["start restore l0 segments"] [backup_db_name=db_test] [backup_collection_name=db_test] [target_db_name=db_test] [target_collection_name=CEC_Corpus] [skipDiskQuotaCheck=false] [global_l0_segment_num=0] [partition_l0_segment_num=0]
[2024/11/12 10:21:38.028 +08:00] [INFO] [core/backup_impl_restore_backup.go:366] ["finish restore collection"] [db_name=db_test] [collection_name=CEC_Corpus] [size=2177638]
success
duration:17 s