RocksDB CLI Client
A simple CLI client to interact with a RocksDB database. This client allows you to perform various operations such as storing, retrieving, deleting, and merging key-value pairs. It also supports advanced operations like managing column families and transactions.
Features
- Store a key-value pair in the database
- Retrieve the value of a key from the database
- Delete a key from the database
- Merge a value with an existing key
- List all column families in the database
- Create and drop column families
- Compact the database within a range
- Support for transactions (begin, commit, rollback)
Prerequisites
- Rust (only for building from source)
Getting Started
Download the Application
Pre-built versions of the application are available in the Releases. You can download the appropriate version for your operating system and run the application directly.
For example, you can download the specific version from this link.
Extract the Downloaded Archive
After downloading the appropriate archive for your operating system, extract it:
tar -xzf rocksdb_cli-<platform>.tar.gz # For Linux and macOS
# or
7z x rocksdb_cli-<platform>.zip # For Windows
Install with Homebrew (macOS)
You can also install RocksDB CLI Client using Homebrew on macOS. First, make sure to tap the repository:
brew tap s00d/rocksdbserver
Then, install the RocksDB CLI Client:
brew install rocksdb_cli
Run the Application
Navigate to the directory where the binary is extracted and run the application:
./rocksdb_cli ...
macOS Sign
If you are on macOS, you may need to sign the application before running it. Here are the steps:
Make the binary executable:
chmod +x ./rocksdb_cli
Clear extended attributes and sign the binary:
xattr -cr ./rocksdb_cli && codesign --force --deep --sign - ./rocksdb_cli
Command Usage
Common Options
--host
: Server host (default:127.0.0.1
)--port
: Server port (default:12345
)
Store a Key-Value Pair
./rocksdb_cli put --host 127.0.0.1 --port 12345 <key> <value>
Retrieve the Value of a Key
./rocksdb_cli get --host 127.0.0.1 --port 12345 <key>
Delete a Key
./rocksdb_cli delete --host 127.0.0.1 --port 12345 <key>
Merge a Value with an Existing Key
./rocksdb_cli merge --host 127.0.0.1 --port 12345 <key> <value>
List All Column Families
./rocksdb_cli list_column_families --host 127.0.0.1 --port 12345
Create a New Column Family
./rocksdb_cli create_column_family --host 127.0.0.1 --port 12345 <name>
Drop an Existing Column Family
./rocksdb_cli drop_column_family --host 127.0.0.1 --port 12345 <name>
Compact the Database Within a Range
./rocksdb_cli compact_range --host 127.0.0.1 --port 12345 [--start <start_key>] [--end <end_key>]
Begin a New Transaction
./rocksdb_cli begin_transaction --host 127.0.0.1 --port 12345
Commit a Transaction
./rocksdb_cli commit_transaction --host 127.0.0.1 --port 12345
Rollback a Transaction
./rocksdb_cli rollback_transaction --host 127.0.0.1 --port 12345
Detailed Workflow
Below is a detailed workflow of how the client interacts with the RocksDB server: