RocksDB笔记 -- Options File

最近开完第一次组会, 准备学习RocksDB以及如何配置文件.

RocksDB数据库提供一些函数调用来帮助Options File:

1. 将一系列选项写入一个文件中: DB::Open(), DB::SetOptions(), DB::CreateColumnFamily(), DB::DropColumnFamily() .

2. 加载文件中的配置选项: LoadLatestOptions(), LoadOptionsFromFile() .

3. 检查两个配置选项集合的兼容性: CheckOptionsCompatibility() .

RocksDB的options file是文本文件, 它是INI文件格式. 

Tips:

1. 可以设置ConfigOptions.ignore_unknown_options=true可以忽略掉未知的文件配置选项. 该设置默认为false.

RocksDB Options File格式(rocksdb/examples/rocksdb_option_file_example.ini):

# This is a RocksDB option file.
#
# A typical RocksDB options file has four sections, which are
# Version section, DBOptions section, at least one CFOptions
# section, and one TableOptions section for each column family.
# The RocksDB options file in general follows the basic INI
# file format with the following extensions / modifications:
#
#  * Escaped characters
#    We escaped the following characters:
#     - \n -- line feed - new line
#     - \r -- carriage return
#     - \\ -- backslash \
#     - \: -- colon symbol :
#     - \# -- hash tag #
#  * Comments
#    We support # style comments.  Comments can appear at the ending
#    part of a line.
#  * Statements
#    A statement is of the form option_name = value.
#    Each statement contains a '=', where extra white-spaces
#    are supported. However, we don't support multi-lined statement.
#    Furthermore, each line can only contain at most one statement.
#  * Sections
#    Sections are of the form [SecitonTitle "SectionArgument"],
#    where section argument is optional.
#  * List
#    We use colon-separated string to represent a list.
#    For instance, n1:n2:n3:n4 is a list containing four values.
#
# Below is an example of a RocksDB options file:
[Version]rocksdb_version=4.3.0options_file_version=1.1[DBOptions]stats_dump_period_sec=600max_manifest_file_size=18446744073709551615bytes_per_sync=8388608delayed_write_rate=2097152WAL_ttl_seconds=0WAL_size_limit_MB=0max_subcompactions=1wal_dir=wal_bytes_per_sync=0db_write_buffer_size=0keep_log_file_num=1000table_cache_numshardbits=4max_file_opening_threads=1writable_file_max_buffer_size=1048576random_access_max_buffer_size=1048576use_fsync=falsemax_total_wal_size=0max_open_files=-1skip_stats_update_on_db_open=falsemax_background_compactions=16manifest_preallocation_size=4194304max_background_flushes=7is_fd_close_on_exec=truemax_log_file_size=0advise_random_on_open=truecreate_missing_column_families=falseparanoid_checks=truedelete_obsolete_files_period_micros=21600000000log_file_time_to_roll=0compaction_readahead_size=0create_if_missing=falseuse_adaptive_mutex=falseenable_thread_tracking=falseallow_fallocate=trueerror_if_exists=falserecycle_log_file_num=0db_log_dir=skip_log_error_on_recovery=falsenew_table_reader_for_compaction_inputs=trueallow_mmap_reads=falseallow_mmap_writes=falseuse_direct_reads=falseuse_direct_writes=false[CFOptions "default"]compaction_style=kCompactionStyleLevelcompaction_filter=nullptrnum_levels=6table_factory=BlockBasedTablecomparator=leveldb.BytewiseComparatormax_sequential_skip_in_iterations=8max_bytes_for_level_base=1073741824memtable_prefix_bloom_probes=6memtable_prefix_bloom_bits=0memtable_prefix_bloom_huge_page_tlb_size=0max_successive_merges=0arena_block_size=16777216min_write_buffer_number_to_merge=1target_file_size_multiplier=1source_compaction_factor=1max_bytes_for_level_multiplier=8max_bytes_for_level_multiplier_additional=2:3:5compaction_filter_factory=nullptrmax_write_buffer_number=8level0_stop_writes_trigger=20compression=kSnappyCompressionlevel0_file_num_compaction_trigger=4purge_redundant_kvs_while_flush=truemax_write_buffer_size_to_maintain=0memtable_factory=SkipListFactorymax_grandparent_overlap_factor=8expanded_compaction_factor=25hard_pending_compaction_bytes_limit=137438953472inplace_update_num_locks=10000level_compaction_dynamic_level_bytes=truelevel0_slowdown_writes_trigger=12filter_deletes=falseverify_checksums_in_compaction=truemin_partial_merge_operands=2paranoid_file_checks=falsetarget_file_size_base=134217728optimize_filters_for_hits=falsemerge_operator=PutOperatorcompression_per_level=kNoCompression:kNoCompression:kNoCompression:kSnappyCompression:kSnappyCompression:kSnappyCompressioncompaction_measure_io_stats=falseprefix_extractor=nullptrbloom_locality=0write_buffer_size=134217728disable_auto_compactions=falseinplace_update_support=false[TableOptions/BlockBasedTable "default"]format_version=2whole_key_filtering=trueno_block_cache=falsechecksum=kCRC32cfilter_policy=rocksdb.BuiltinBloomFilterblock_size_deviation=10block_size=8192block_restart_interval=16cache_index_and_filter_blocks=falsepin_l0_filter_and_index_blocks_in_cache=falsepin_top_level_index_and_filter=falseindex_type=kBinarySearchflush_block_policy_factory=FlushBlockBySizePolicyFactory

参考: 

RocksDB Options File · facebook/rocksdb Wiki · GitHub


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部