CONFIG 语法

Nebula Graph 使用 gflags 进行运行时配置。

gflags 参数

相关的 gflags 参数有四个,其中,max_edge_returned_per_vertex 用来控制一个点最多可以搜索返回的边数,rocksdb_db_optionsrocksdb_column_family_optionsrocksdb_block_based_table_options 三个参数均为 json 格式,其中每个参数 key 和 value 均为 string 格式。例如可以在 storage 的 conf 文件中做如下设置:

  1. rocksdb_db_options = {"stats_dump_period_sec":"200", "enable_write_thread_adaptive_yield":"false", "write_thread_max_yield_usec":"600",
  2. "max_edge_returned_per_vertex":"INT_MAX"}
  3. rocksdb_column_family_options = {"max_write_buffer_number":"4", "min_write_buffer_number_to_merge":"2", "max_write_buffer_number_to_maintain":"1"}
  4. rocksdb_block_based_table_options = {"block_restart_interval":"2"}

另外目前支持动态修改 storage service 的部分 rocksdb 参数, 如下

  1. // rocksdb_column_family_options
  2. max_write_buffer_number
  3. level0_file_num_compaction_trigger
  4. level0_slowdown_writes_trigger
  5. level0_stop_writes_trigger
  6. target_file_size_base
  7. target_file_size_multiplier
  8. max_bytes_for_level_base
  9. max_bytes_for_level_multiplier
  10. ttl
  11. disable_auto_compactions
  12. // rocksdb_db_options
  13. max_total_wal_size
  14. delete_obsolete_files_period_micros
  15. max_background_jobs
  16. base_background_compactions
  17. max_background_compactions
  18. stats_dump_period_sec
  19. compaction_readahead_size
  20. writable_file_max_buffer_size
  21. bytes_per_sync
  22. wal_bytes_per_sync
  23. delayed_write_rate
  24. avoid_flush_during_shutdown
  25. max_open_files

示例

  1. nebula> UPDATE CONFIGS storage:rocksdb_column_family_options = \
  2. { disable_auto_compactions = false , level0_file_num_compaction_trigger = 10 }

显示变量

  1. SHOW CONFIGS [graph|meta|storage]

例如

  1. nebula> SHOW CONFIGS meta
  2. ============================================================================================================================
  3. | module | name | type | mode | value |
  4. ============================================================================================================================
  5. | META | v | INT64 | IMMUTABLE | 4 |
  6. ----------------------------------------------------------------------------------------------------------------------------
  7. | META | help | BOOL | IMMUTABLE | False |
  8. ----------------------------------------------------------------------------------------------------------------------------
  9. | META | port | INT64 | IMMUTABLE | 45500 |
  10. ----------------------------------------------------------------------------------------------------------------------------

获取变量

  1. GET CONFIGS [graph|meta|storage :] var

例如

  1. nebula> GET CONFIGS storage:load_data_interval_secs
  2. =================================================================
  3. | module | name | type | mode | value |
  4. =================================================================
  5. | STORAGE | load_data_interval_secs | INT64 | MUTABLE | 120 |
  6. -----------------------------------------------------------------
  1. nebula> GET CONFIGS load_data_interval_secs
  2. =================================================================
  3. | module | name | type | mode | value |
  4. =================================================================
  5. | GRAPH | load_data_interval_secs | INT64 | MUTABLE | 120 |
  6. -----------------------------------------------------------------
  7. | META | load_data_interval_secs | INT64 | IMMUTABLE | 120 |
  8. -----------------------------------------------------------------
  9. | STORAGE | load_data_interval_secs | INT64 | MUTABLE | 120 |
  10. -----------------------------------------------------------------
  11. Got 3 rows (Time spent: 1449/2339 us)

更新变量

  1. UPDATE CONFIGS [graph|meta|storage :] var = value

更新的变量将永久存储于 meta-service 中。 如果变量模式为 MUTABLE,更改会即时生效。如果模式为 REBOOT,更改在服务器重启后生效。 支持在 UPDATE CONFIGS 中使用算式。

例如

  1. nebula> UPDATE CONFIGS storage:load_data_interval_secs=1
  2. Execution succeeded (Time spent: 1750/2484 us)
  3. nebula> GET CONFIGS storage:load_data_interval_secs
  4. ===============================================================
  5. | module | name | type | mode | value |
  6. ===============================================================
  7. | STORAGE | load_data_interval_secs | INT64 | MUTABLE | 1 |
  8. ---------------------------------------------------------------
  9. Got 1 rows (Time spent: 1678/3420 us)