文档:https://pymilvus.readthedocs.io/en/latest/
报错
[2022-04-25 23:07:20,681][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection xxx does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
解决方案
删除的时候一定是先删除索引,再删除集合,顺序反了会报错
创建的时候一定是后创建索引,先创建集合,顺序反了会报错
def insert_ini(self, collection_name, vectors, ids=None, partition_tag=None):
try:
if self.has_collection(collection_name):
self.client.drop_index(collection_name)
self.client.drop_collection(collection_name)
self.creat_collection(collection_name)
self.create_index(collection_name)
print('collection info: {}'.format(self.client.get_collection_info(collection_name)[1]))
self.create_partition(collection_name, partition_tag)
if vectors != -1:
status, ids = self.client.insert(
collection_name=collection_name,
records=vectors,
ids=ids,
partition_tag=partition_tag)
self.client.flush([collection_name])
print(
'Insert {} entities, there are {} entities after insert data.'.
format(
len(ids), self.client.count_entities(collection_name)[1]))
return status, ids
else:
return -1, ids
except Exception as e:
print("Milvus insert error:", e)
整体弄完后,一定要去组件的后台查看日志,看是否有异常
单机版
cd /home/$USER/milvus/logs
无报错日志才算彻底正常
cat milvus-22-04-25-22:22-error.log
mishards集群版,还是报错
[2022-04-26 01:13:47,971][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error: Collection already exists and it is in delete state, please wait a second
[2022-04-26 01:13:47,975][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,978][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,981][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,985][ERROR][SERVER][OnExecute][reqsched_thread] [insert][0] Collection call_12345_prd not found
[2022-04-26 01:13:47,985][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,987][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,990][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
进相应的节点,查看日志文件,一样挨个做检查。
kubectl get pods
kubectl exec -it milvus-release-mishards-767dc476bf-fxz8v -- /bin/bash
kubectl exec -it milvus-release-readonly-6cb6c5bcd9-9m4c5 -- /bin/bash
kubectl exec -it milvus-release-readonly-6cb6c5bcd9-mzrh6 -- /bin/bash
kubectl exec -it milvus-release-writable-7776777fcc-dsdmv -- /bin/bash