Schema创建后插入数据连续报错

  • nebula 版本:2.0.1
  • 部署方式:分布式
  • 是否为线上版本:N
  • 硬件信息
    • 磁盘: SSD
    • CPU、内存信息:4C、32G
  • 问题的具体描述

建好Schema信息后插入数据连续报错

(nebula@nebula) [(none)]> CREATE SPACE basketballplayer (partition_num=15, replica_factor=3, vid_type=fixed_string(30));
Execution succeeded (time spent 8003/9209 us)

Mon, 26 Jul 2021 03:23:26 UTC

(nebula@nebula) [(none)]> USE basketballplayer;
[ERROR (-8)]: SpaceNotFound:

Mon, 26 Jul 2021 03:23:31 UTC

(nebula@nebula) [(none)]>
(nebula@nebula) [(none)]> ADD LISTENER ELASTICSEARCH 10.65.101.89:9789,10.65.101.42:9789,10.65.101.43:9789;
[ERROR (-12)]: SemanticError: Space was not chosen.

Mon, 26 Jul 2021 03:24:02 UTC

(nebula@nebula) [(none)]> USE basketballplayer;
Execution succeeded (time spent 1371/2236 us)

Mon, 26 Jul 2021 03:24:13 UTC

(nebula@nebula) [basketballplayer]> ADD LISTENER ELASTICSEARCH 10.65.101.89:9789,10.65.101.42:9789,10.65.101.43:9789;
Execution succeeded (time spent 6171/6769 us)

Mon, 26 Jul 2021 03:24:23 UTC

(nebula@nebula) [basketballplayer]> CREATE TAG player(name string, team string, age int);
Execution succeeded (time spent 5897/6425 us)

Mon, 26 Jul 2021 03:24:32 UTC

(nebula@nebula) [basketballplayer]> CREATE TAG INDEX name ON player(name(20));
Execution succeeded (time spent 5022/5319 us)

Mon, 26 Jul 2021 03:24:32 UTC

(nebula@nebula) [basketballplayer]> CREATE TAG INDEX team ON player(team(20));
Execution succeeded (time spent 6067/6654 us)

Mon, 26 Jul 2021 03:24:33 UTC

(nebula@nebula) [basketballplayer]> INSERT VERTEX player(name, team, age) VALUES \
                                 ->   "Russell Westbrook": ("Russell Westbrook", "Thunder", 30), \
                                 ->   "Chris Paul": ("Chris Paul", "Sun", 33), \
                                 ->   "Boris Diaw": ("Boris Diaw", "Sun", 36), \
                                 ->   "David West": ("David West", "Sun", 38), \
                                 ->   "Danny Green": ("Danny Green", "Lakers", 31), \
                                 ->   "Tim Duncan": ("Tim Duncan", "Lakers", 42), \
                                 ->   "James Harden": ("James Harden", "Lakers", 29), \
                                 ->   "Tony Parker": ("Tony Parker", "Lakers", 36), \
                                 ->   "Aron Baynes": ("Aron Baynes", "Celtics", 32), \
                                 ->   "Ben Simmons": ("Ben Simmons", "Celtics", 22), \
                                 ->   "Blake Griffin": ("Blake Griffin", "Celtics", 30);
[ERROR (-12)]: SemanticError: No schema found for `player'

Mon, 26 Jul 2021 03:24:39 UTC

(nebula@nebula) [basketballplayer]> INSERT VERTEX player(name, team, age) VALUES \
                                 ->   "Russell Westbrook": ("Russell Westbrook", "Thunder", 30), \
                                 ->   "Chris Paul": ("Chris Paul", "Sun", 33), \
                                 ->   "Boris Diaw": ("Boris Diaw", "Sun", 36), \
                                 ->   "David West": ("David West", "Sun", 38), \
                                 ->   "Danny Green": ("Danny Green", "Lakers", 31), \
                                 ->   "Tim Duncan": ("Tim Duncan", "Lakers", 42), \
                                 ->   "James Harden": ("James Harden", "Lakers", 29), \
                                 ->   "Tony Parker": ("Tony Parker", "Lakers", 36), \
                                 ->   "Aron Baynes": ("Aron Baynes", "Celtics", 32), \
                                 ->   "Ben Simmons": ("Ben Simmons", "Celtics", 22), \
                                 ->   "Blake Griffin": ("Blake Griffin", "Celtics", 30);
[ERROR (-8)]: Storage Error: The leader has changed. Try again later

Mon, 26 Jul 2021 03:24:43 UTC

(nebula@nebula) [basketballplayer]> INSERT VERTEX player(name, team, age) VALUES \
                                 ->   "Russell Westbrook": ("Russell Westbrook", "Thunder", 30), \
                                 ->   "Chris Paul": ("Chris Paul", "Sun", 33), \
                                 ->   "Boris Diaw": ("Boris Diaw", "Sun", 36), \
                                 ->   "David West": ("David West", "Sun", 38), \
                                 ->   "Danny Green": ("Danny Green", "Lakers", 31), \
                                 ->   "Tim Duncan": ("Tim Duncan", "Lakers", 42), \
                                 ->   "James Harden": ("James Harden", "Lakers", 29), \
                                 ->   "Tony Parker": ("Tony Parker", "Lakers", 36), \
                                 ->   "Aron Baynes": ("Aron Baynes", "Celtics", 32), \
                                 ->   "Ben Simmons": ("Ben Simmons", "Celtics", 22), \
                                 ->   "Blake Griffin": ("Blake Griffin", "Celtics", 30);
[ERROR (-8)]: Storage Error: The leader has changed. Try again later

Mon, 26 Jul 2021 03:24:46 UTC

(nebula@nebula) [basketballplayer]> INSERT VERTEX player(name, team, age) VALUES \
                                 ->   "Russell Westbrook": ("Russell Westbrook", "Thunder", 30), \
                                 ->   "Chris Paul": ("Chris Paul", "Sun", 33), \
                                 ->   "Boris Diaw": ("Boris Diaw", "Sun", 36), \
                                 ->   "David West": ("David West", "Sun", 38), \
                                 ->   "Danny Green": ("Danny Green", "Lakers", 31), \
                                 ->   "Tim Duncan": ("Tim Duncan", "Lakers", 42), \
                                 ->   "James Harden": ("James Harden", "Lakers", 29), \
                                 ->   "Tony Parker": ("Tony Parker", "Lakers", 36), \
                                 ->   "Aron Baynes": ("Aron Baynes", "Celtics", 32), \
                                 ->   "Ben Simmons": ("Ben Simmons", "Celtics", 22), \
                                 ->   "Blake Griffin": ("Blake Griffin", "Celtics", 30);
Execution succeeded (time spent 4830/5359 us)

SHOW SPACESSHOW HOSTS 看下各自的返回结果呢

1 个赞

跟这个没关系吧

(nebula@nebula) [(none)]> show hosts;
+----------------+------+----------+--------------+---------------------------------------------------------------+---------------------------------------------------------------+
| Host           | Port | Status   | Leader count | Leader distribution                                           | Partition distribution                                |
+----------------+------+----------+--------------+---------------------------------------------------------------+---------------------------------------------------------------+
| "10.65.101.42" | 9779 | "ONLINE" | 14           | "GlossaryTest:1, basketballplayer:5, testxd2:3, testzzy:5"    | "GlossaryTest:1, basketballplayer:15, testxd2:3, testzzy:15"  |
+----------------+------+----------+--------------+---------------------------------------------------------------+---------------------------------------------------------------+
| "10.65.101.43" | 9779 | "ONLINE" | 16           | "GlossaryTest:2, basketballplayer:5, testxd2:4, testzzy:5"    | "GlossaryTest:2, basketballplayer:15, testxd2:4, testzzy:15"  |
+----------------+------+----------+--------------+---------------------------------------------------------------+---------------------------------------------------------------+
| "10.65.101.89" | 9779 | "ONLINE" | 15           | "GlossaryTest:2, basketballplayer:5, testxd2:3, testzzy:5"    | "GlossaryTest:2, basketballplayer:15, testxd2:3, testzzy:15"  |
+----------------+------+----------+--------------+---------------------------------------------------------------+---------------------------------------------------------------+
| "Total"        |      |          | 45           | "GlossaryTest:5, basketballplayer:15, testxd2:10, testzzy:15" | "GlossaryTest:5, basketballplayer:45, testxd2:10, testzzy:45" |
+----------------+------+----------+--------------+---------------------------------------------------------------+---------------------------------------------------------------+
Got 4 rows (time spent 2193/3081 us)

Mon, 26 Jul 2021 10:10:24 UTC

(nebula@nebula) [(none)]> SHOW SPACES;
+--------------------+
| Name               |
+--------------------+
| "GlossaryTest"     |
+--------------------+
| "basketballplayer" |
+--------------------+
| "testxd2"          |
+--------------------+
| "testzzy"          |
+--------------------+
Got 4 rows (time spent 1281/1853 us)

Mon, 26 Jul 2021 10:10:51 UTC

SHOW HOSTS 是保证你的服务都起来了,然后 SHOW SPACES 是看下你的图空间是否真的创建成功了。排除了这两个原因之后,你现在是不是可以用 USE 图空间了,因为创建了图空间之后需要过一段时间去查询,一般是 2 个心跳的时间。

指的是conf里面配置的这个参数(heartbeat_interval_secs)的周期吗?

嗯,一般新建 Schema 的话下一个心跳周期能查到,建议是等待 2 个心跳之后进行查询,你可以看下文档这里 CREATE TAG - Nebula Graph Database 手册

好像还是有问题,先运行show configs查看心跳设置,显示心跳时间是10s

(nebula@nebula) [basketballplayer]> show configs;
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| module    | name                                | type   | mode      | value                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "GRAPH"   | "v"                                 | "int"  | "MUTABLE" | 0                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "GRAPH"   | "minloglevel"                       | "int"  | "MUTABLE" | 0                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "GRAPH"   | "slow_op_threshhold_ms"             | "int"  | "MUTABLE" | 50                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "GRAPH"   | "accept_partial_success"            | "bool" | "MUTABLE" | false                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "GRAPH"   | "heartbeat_interval_secs"           | "int"  | "MUTABLE" | 10                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "GRAPH"   | "meta_client_retry_times"           | "int"  | "MUTABLE" | 3                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "v"                                 | "int"  | "MUTABLE" | 3                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "wal_ttl"                           | "int"  | "MUTABLE" | 14400                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "minloglevel"                       | "int"  | "MUTABLE" | 0                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "rocksdb_db_options"                | "map"  | "MUTABLE" | {}                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "slow_op_threshhold_ms"             | "int"  | "MUTABLE" | 50                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "clean_wal_interval_secs"           | "int"  | "MUTABLE" | 600                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "heartbeat_interval_secs"           | "int"  | "MUTABLE" | 10                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "meta_client_retry_times"           | "int"  | "MUTABLE" | 3                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "custom_filter_interval_secs"       | "int"  | "MUTABLE" | 86400                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "max_edge_returned_per_vertex"      | "int"  | "MUTABLE" | 2147483647                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "rocksdb_column_family_options"     | "map"  | "MUTABLE" | {max_bytes_for_level_base: "268435456", max_write_buffer_number: "4", write_buffer_size: "67108864"} |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
| "STORAGE" | "rocksdb_block_based_table_options" | "map"  | "MUTABLE" | {block_size: "8192"}                            |
+-----------+-------------------------------------+--------+-----------+------------------------------------------------------------------------------------------------------+
Got 18 rows (time spent 2073/3193 us)

继续重建schema,插入数据:

(nebula@nebula) [(none)]> CREATE SPACE basketballplayer (partition_num=15, replica_factor=3, vid_type=fixed_string(30));
Execution succeeded (time spent 9837/10358 us)

Tue, 27 Jul 2021 08:55:37 UTC

(nebula@nebula) [(none)]> use basketballplayer;
Execution succeeded (time spent 1384/2215 us)

Tue, 27 Jul 2021 08:55:47 UTC

(nebula@nebula) [basketballplayer]> CREATE TAG player(name string, team string, age int);
Execution succeeded (time spent 6926/7442 us)

Tue, 27 Jul 2021 08:55:58 UTC

(nebula@nebula) [basketballplayer]> CREATE TAG INDEX name ON player(name(20));
Execution succeeded (time spent 10058/10444 us)

Tue, 27 Jul 2021 08:55:58 UTC

(nebula@nebula) [basketballplayer]> CREATE TAG INDEX team ON player(team(20));
Execution succeeded (time spent 9536/10044 us)

Tue, 27 Jul 2021 08:55:59 UTC

过了两个心跳周期后,执行插入,还是报这个错误:

(nebula@nebula) [basketballplayer]> INSERT VERTEX player(name, team, age) VALUES   "Russell Westbrook": ("Russell Westbrook", "Thunder", 30),   "Chris Paul": ("Chris Paul", "Sun", 33),   "Boris Diaw": ("Boris Diaw", "Sun", 36),   "David West": ("David West", "Sun", 38),   "Danny Green": ("Danny Green", "Lakers", 31),   "Tim Duncan": ("Tim Duncan", "Lakers", 42),   "James Harden": ("James Harden", "Lakers", 29),   "Tony Parker": ("Tony Parker", "Lakers", 36),   "Aron Baynes": ("Aron Baynes", "Celtics", 32),   "Ben Simmons": ("Ben Simmons", "Celtics", 22),   "Blake Griffin": ("Blake Griffin", "Celtics", 30);
[ERROR (-8)]: Storage Error: The leader has changed. Try again later

Tue, 27 Jul 2021 08:56:29 UTC

该话题在最后一个回复创建后30天后自动关闭。不再允许新的回复。

浙ICP备20010487号