| Crates.io | kawa-cli |
| lib.rs | kawa-cli |
| version | 0.1.0 |
| created_at | 2025-07-10 07:12:40.458038+00 |
| updated_at | 2025-07-10 07:12:40.458038+00 |
| description | Command-line interface for Kawa message broker |
| homepage | https://github.com/jun784/kawadb.com |
| repository | https://github.com/jun784/kawadb.com |
| max_upload_size | |
| id | 1745987 |
| size | 87,107 |
kawa-cliは、Kawaブローカーの包括的な管理・運用ツールです。美しいUI、豊富な機能、直感的なコマンド体系により、効率的なブローカー運用を実現します。
# リポジトリをクローン
git clone https://github.com/your-org/kawa.git
cd kawa
# CLIをビルド
cargo build --release --bin kawa
# システムパスに追加(オプション)
sudo cp target/release/kawa /usr/local/bin/
# バージョン確認
kawa --version
# ヘルプ表示
kawa --help
# サブコマンドヘルプ
kawa server --help
# デフォルト設定でサーバー起動
kawa server start
# カスタムポートで起動
kawa server start --port 9092
# 設定ファイルを指定して起動
kawa server start --config ./custom-config.toml
# バックグラウンドで起動
kawa server start --daemon
# サーバー停止
kawa server stop
# サーバー状態確認
kawa server status
$ kawa server start
🚀 Starting Kawa broker server...
✅ Server started successfully!
📡 Listening on: 127.0.0.1:9092
🔧 Data directory: ./data
ℹ️ Press Ctrl+C to stop the server
# トピック一覧(簡潔表示)
kawa topic list
# トピック一覧(詳細表示)
kawa topic list --verbose
# 新しいトピック作成
kawa topic create my-topic --partitions 3 --replication 1
# トピック削除(確認あり)
kawa topic delete my-topic
# トピック削除(強制実行)
kawa topic delete my-topic --force
# トピック詳細表示
kawa topic describe my-topic
$ kawa topic list --verbose
📋 Listing topics...
┌─────────────┬────────────┬────────┐
│ Topic Name │ Partitions │ Status │
├─────────────┼────────────┼────────┤
│ user-events │ 3 │ Active │
│ log-stream │ 1 │ Active │
│ metrics │ 5 │ Active │
└─────────────┴────────────┴────────┘
ℹ️ Found 3 topic(s)
# 直接メッセージ送信
kawa message produce my-topic --message "Hello, Kawa!"
# 特定パーティションに送信
kawa message produce my-topic --message "Hello" --partition 2
# ファイルから送信
kawa message produce my-topic --file ./message.txt
# 標準入力から送信
echo "Test message" | kawa message produce my-topic
# 最新メッセージから受信
kawa message consume my-topic
# 特定オフセットから受信
kawa message consume my-topic --offset 100
# 最大受信数を指定
kawa message consume my-topic --max 50
# 特定パーティションから受信
kawa message consume my-topic --partition 1 --offset 0 --max 10
$ kawa message consume user-events --max 3
📥 Consuming messages from topic 'user-events'...
📊 Partition: 0
📍 Starting offset: 0
📏 Max messages: 3
📨 Received 3 message(s):
📋 Message 1:
Offset: 0
Timestamp: 2024-01-15 10:30:15 UTC
Size: 28 bytes
Content: {"user": "alice", "action": "login"}
📋 Message 2:
Offset: 1
Timestamp: 2024-01-15 10:30:16 UTC
Size: 32 bytes
Content: {"user": "bob", "action": "purchase"}
# 現在の設定表示
kawa config show
# 設定ファイル検証
kawa config validate
# デフォルト設定生成
kawa config generate
# 設定をファイルに出力
kawa config generate --output kawa-config.toml
[network]
bind_host = "0.0.0.0"
bind_port = 9092
max_connections = 1000
[storage]
data_dir = "./data"
segment_size = 1073741824 # 1GB
sync_interval_ms = 1000
[cluster]
node_id = 0
enable_replication = false
# システムメトリクス表示
kawa metrics show
# データ統計表示
kawa data stats
$ kawa metrics show
📊 Fetching metrics...
┌──────────────────┬───────┐
│ Metric │ Value │
├──────────────────┼───────┤
│ Active Sessions │ 5 │
│ Total Topics │ 3 │
│ Consumer Groups │ 2 │
│ Total Offsets │ 1,234 │
│ Uptime │ 3,600s│
└──────────────────┴───────┘
# 包括的ヘルスチェック
kawa health check
$ kawa health check
🏥 Performing health check...
⠁ [00:00:02] ████████████████████████████████████████ 4/4 ✅ Health check passed
🎉 All systems are healthy!
# 削除確認
$ kawa topic delete important-topic
⚠️ Are you sure you want to delete topic 'important-topic'? [y/N]: n
ℹ️ Deletion cancelled
# 標準入力からのメッセージ
$ kawa message produce my-topic
📝 Enter message (Ctrl+D to finish):
This is a multi-line
message from stdin
^D
✅ Message produced successfully!
#!/bin/bash
# Kawa管理スクリプト例
# サーバー起動
kawa server start --daemon
# トピック作成
kawa topic create logs --partitions 5
kawa topic create events --partitions 3
# 設定確認
kawa config validate
# ヘルスチェック
kawa health check
echo "✅ Kawa setup completed!"
# 本番環境設定
kawa server start --config /etc/kawa/production.toml
# 開発環境設定
kawa server start --config ./dev-config.toml
#!/bin/bash
# 定期監視スクリプト
while true; do
echo "=== $(date) ==="
kawa metrics show
kawa health check
sleep 60
done
kawa [OPTIONS] <SUBCOMMAND>
OPTIONS:
-h, --help ヘルプを表示
-V, --version バージョンを表示
-v, --verbose 詳細出力を有効化
-q, --quiet 簡潔出力モード
| コマンド | 説明 | 例 |
|---|---|---|
| server | サーバー管理 | kawa server start |
| topic | トピック管理 | kawa topic create my-topic |
| message | メッセージ操作 | kawa message produce my-topic |
| config | 設定管理 | kawa config show |
| metrics | メトリクス表示 | kawa metrics show |
| data | データ統計 | kawa data stats |
| health | ヘルスチェック | kawa health check |
// src/commands/custom.rs
use clap::Subcommand;
#[derive(Subcommand, Clone)]
pub enum CustomAction {
/// カスタム機能
Custom {
#[arg(short, long)]
option: String,
},
}
// プラグインインターフェース
pub trait KawaPlugin {
fn name(&self) -> &str;
fn execute(&self, args: &[String]) -> Result<()>;
}
kawa-cli - 美しく、使いやすく、高機能な管理ツール! ⚙️🚀