nebula-importer 如何在导入数据,创建索引后rebuild

  • nebula 版本:2.5.0
  • 部署方式: 单机
  • 安装方式:RPM
  • 是否为线上版本:Y
  • 问题的具体描述
    如题所示,使用nebula-importer导入数据,在prestop配置中执行创建索引语句,结果这样通过索引进行检索查不到数据,这是因为导入数据后创建索引,需要重新rebuild。于是在prestop中增加rebuild语句,这个时候整个创建索引都会失败,猜测是创建索引后不能立刻rebuild。请问一下,如何通过importer导入数据之后立刻能通过prestop创建索引并且rebuild呢?

你的意思是,你在 rebuild index 的过程中,又重新创建了新的 index 吗?

不是的呢,是在importer的yaml文件里面的prestop配置创建索引并且rebuild。因为文档上说最好导入数据之后创建索引,所以就在prestop中创建索引并且进行rebuild,但是这样做会失败。

遇到了一模一样的问题……

2021/11/15 11:30:15 [ERROR] clientpool.go:108: Client(0) fails to execute commands (CREATE TAG INDEX user_index ON user();
CREATE TAG INDEX user_name_index ON user(name(10));
CREATE TAG INDEX business_index ON business();
CREATE TAG INDEX business_name_index ON business(name(10));
REBUILD TAG INDEX user_index, user_name_index, business_index, business_name_index;
), response error code: -1009, message: SemanticError: Index user_index not found in space yelp
2021/11/15 11:30:15 Finish import data, consume time: 1527.07s
2021/11/15 11:30:16 --- END OF NEBULA IMPORTER ---

导入时提示失败,于是手动复制重新执行了一次,执行完之后看status,导入时的貌似并没有失败?然后算法我手动的一共执行了两次。

(root@nebula) [yelp]> show tag index status
+-----------------------------------------------------------------+--------------+
| Name                                                            | Index Status |
+-----------------------------------------------------------------+--------------+
| "user_index,user_name_index"                                    | "FINISHED"   |
| "user_index,user_name_index,business_index,business_name_index" | "RUNNING"    |
| "business_index,business_name_index"                            | "FINISHED"   |
+-----------------------------------------------------------------+--------------+
Got 3 rows (time spent 185087/204911 us)

Mon, 15 Nov 2021 03:47:30 UTC

你这个索引没有创建呀,所以就报错误索引不存在啊

我知道错误的意思…我意思是创建索引的命令放在了prestop里报错,直接复制到console里是没有问题的

因为有心跳的关系,当你在 prestop 里创建索引后,立即 rebuild,这个时候 graph 还没有更新索引信息,所以就会报失败。

目前 importer 的 prestop 不支持先创建索引,在等待几秒后 rebuild。
要么就是插输入前创建索引,但是这样会影响插数据的性能。
要么就是 importer 插入数据后,手动在 console 上 rebuild。

如果你希望 importer 的 prestop 里有延时的命令,可以在 github 提个 issue

3 个赞

那我想问下我上面贴的

(root@nebula) [yelp]> show tag index status
+-----------------------------------------------------------------+--------------+
| Name                                                            | Index Status |
+-----------------------------------------------------------------+--------------+
| "user_index,user_name_index"                                    | "FINISHED"   |
| "user_index,user_name_index,business_index,business_name_index" | "RUNNING"    |
| "business_index,business_name_index"                            | "FINISHED"   |
+-----------------------------------------------------------------+--------------+
Got 3 rows (time spent 185087/204911 us)

Mon, 15 Nov 2021 03:47:30 UTC

里的第一行和第三行命令实际有没有执行?这两条是我写在yaml里的prestop的,import时报错但status里有记录。我手动执行完之后(表格里的第二行,我把两命令合成了一起),看到yaml里的这两个命令也写着FINISHED

import 里报错不会执行,这个显示的是你手动执行的把。

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。