consul
Consulは、サービスを登録・監視したり、設定情報を保存したり、サービス間の安全な通信を構築したりするなど、システム運用に必要な様々な機能を提供するSkill。
📜 元の英語説明(参考)
HashiCorp Consul for service discovery, health checking, and service mesh. Use when the user needs to register services, perform health checks, store configuration in the KV store, or set up Connect for secure service-to-service communication.
🇯🇵 日本人クリエイター向け解説
Consulは、サービスを登録・監視したり、設定情報を保存したり、サービス間の安全な通信を構築したりするなど、システム運用に必要な様々な機能を提供するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o consul.zip https://jpskill.com/download/14779.zip && unzip -o consul.zip && rm consul.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14779.zip -OutFile "$d\consul.zip"; Expand-Archive "$d\consul.zip" -DestinationPath $d -Force; ri "$d\consul.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
consul.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
consulフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Consul
Consul は、サービスディスカバリ、ヘルスチェック、KV ストレージ、およびサービスメッシュ機能を提供します。
インストール
# Consul のインストール
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install consul
# 開発エージェントの起動
consul agent -dev
# クラスタメンバの確認
consul members
サーバー構成
# consul-server.hcl — 本番 Consul サーバー構成
datacenter = "dc1"
data_dir = "/opt/consul/data"
log_level = "INFO"
server = true
bootstrap_expect = 3
bind_addr = "{{ GetPrivateInterfaces | include \"network\" \"10.0.0.0/8\" | attr \"address\" }}"
client_addr = "0.0.0.0"
ui_config { enabled = true }
connect { enabled = true }
addresses {
http = "0.0.0.0"
grpc = "0.0.0.0"
}
ports {
grpc = 8502
}
encrypt = "your-gossip-encryption-key"
acl {
enabled = true
default_policy = "deny"
enable_token_persistence = true
}
tls {
defaults {
ca_file = "/opt/consul/tls/ca.pem"
cert_file = "/opt/consul/tls/server.pem"
key_file = "/opt/consul/tls/server-key.pem"
verify_incoming = true
verify_outgoing = true
}
}
autopilot {
cleanup_dead_servers = true
last_contact_threshold = "200ms"
server_stabilization_time = "10s"
}
サービス登録
// services/web.json — ヘルスチェック付きの web サービスの登録
{
"service": {
"name": "web",
"port": 8080,
"tags": ["production", "v2"],
"meta": {
"version": "2.0.0"
},
"check": {
"http": "http://localhost:8080/health",
"interval": "10s",
"timeout": "5s",
"deregister_critical_service_after": "30m"
}
}
}
# CLI 経由でのサービスの登録とクエリ
consul services register services/web.json
consul services deregister -id=web
# DNS ベースのサービスディスカバリ
dig @127.0.0.1 -p 8600 web.service.consul SRV
# HTTP API サービスディスカバリ
curl http://localhost:8500/v1/health/service/web?passing=true
# カタログクエリ
consul catalog services
consul catalog nodes
KV ストア
# キーバリュー操作
consul kv put config/app/db_host "db.example.com"
consul kv put config/app/db_port "5432"
consul kv get config/app/db_host
consul kv get -recurse config/app/
# インポート/エクスポート
consul kv export config/ > backup.json
consul kv import @backup.json
# キーの削除
consul kv delete config/app/db_host
consul kv delete -recurse config/app/
# 変更の監視
consul watch -type=key -key=config/app/db_host /scripts/reload.sh
サービスメッシュ (Connect)
# connect-proxy.hcl — サイドカープロキシを持つサービス
service {
name = "web"
port = 8080
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "api"
local_bind_port = 9091
}
upstreams {
destination_name = "database"
local_bind_port = 9092
}
}
}
}
}
# intentions.hcl — アクセス制御のためのサービスインテンション
Kind = "service-intentions"
Name = "api"
Sources = [
{
Name = "web"
Action = "allow"
},
{
Name = "*"
Action = "deny"
}
]
# インテンションの管理
consul config write intentions.hcl
consul intention list
consul intention check web api
準備済みクエリ
# データセンター間のフェイルオーバーのための準備済みクエリの作成
curl -X POST http://localhost:8500/v1/query -d '{
"Name": "web-query",
"Service": {
"Service": "web",
"Tags": ["production"],
"Failover": {
"Datacenters": ["dc2", "dc3"]
},
"OnlyPassing": true
}
}'
ACL 構成
# ACL システムのブートストラップ
consul acl bootstrap
# ポリシーの作成
consul acl policy create -name "app-read" \
-rules='service_prefix "web" { policy = "read" } key_prefix "config/app" { policy = "read" }'
# ポリシーを持つトークンの作成
consul acl token create -description "App token" -policy-name "app-read"
一般的なコマンド
# クラスタ管理
consul join 10.0.1.10
consul leave
consul operator raft list-peers
consul operator autopilot state
# バックアップ用のスナップショット
consul snapshot save backup.snap
consul snapshot restore backup.snap
# 監視とデバッグ
consul monitor -log-level=debug
consul debug -duration=30s -interval=5s 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Consul
Consul provides service discovery, health checking, KV storage, and service mesh capabilities.
Installation
# Install Consul
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install consul
# Start dev agent
consul agent -dev
# Check cluster members
consul members
Server Configuration
# consul-server.hcl — Production Consul server config
datacenter = "dc1"
data_dir = "/opt/consul/data"
log_level = "INFO"
server = true
bootstrap_expect = 3
bind_addr = "{{ GetPrivateInterfaces | include \"network\" \"10.0.0.0/8\" | attr \"address\" }}"
client_addr = "0.0.0.0"
ui_config { enabled = true }
connect { enabled = true }
addresses {
http = "0.0.0.0"
grpc = "0.0.0.0"
}
ports {
grpc = 8502
}
encrypt = "your-gossip-encryption-key"
acl {
enabled = true
default_policy = "deny"
enable_token_persistence = true
}
tls {
defaults {
ca_file = "/opt/consul/tls/ca.pem"
cert_file = "/opt/consul/tls/server.pem"
key_file = "/opt/consul/tls/server-key.pem"
verify_incoming = true
verify_outgoing = true
}
}
autopilot {
cleanup_dead_servers = true
last_contact_threshold = "200ms"
server_stabilization_time = "10s"
}
Service Registration
// services/web.json — Register web service with health check
{
"service": {
"name": "web",
"port": 8080,
"tags": ["production", "v2"],
"meta": {
"version": "2.0.0"
},
"check": {
"http": "http://localhost:8080/health",
"interval": "10s",
"timeout": "5s",
"deregister_critical_service_after": "30m"
}
}
}
# Register and query services via CLI
consul services register services/web.json
consul services deregister -id=web
# DNS-based service discovery
dig @127.0.0.1 -p 8600 web.service.consul SRV
# HTTP API service discovery
curl http://localhost:8500/v1/health/service/web?passing=true
# Catalog queries
consul catalog services
consul catalog nodes
KV Store
# Key-value operations
consul kv put config/app/db_host "db.example.com"
consul kv put config/app/db_port "5432"
consul kv get config/app/db_host
consul kv get -recurse config/app/
# Import/export
consul kv export config/ > backup.json
consul kv import @backup.json
# Delete keys
consul kv delete config/app/db_host
consul kv delete -recurse config/app/
# Watch for changes
consul watch -type=key -key=config/app/db_host /scripts/reload.sh
Service Mesh (Connect)
# connect-proxy.hcl — Service with sidecar proxy
service {
name = "web"
port = 8080
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "api"
local_bind_port = 9091
}
upstreams {
destination_name = "database"
local_bind_port = 9092
}
}
}
}
}
# intentions.hcl — Service intentions for access control
Kind = "service-intentions"
Name = "api"
Sources = [
{
Name = "web"
Action = "allow"
},
{
Name = "*"
Action = "deny"
}
]
# Manage intentions
consul config write intentions.hcl
consul intention list
consul intention check web api
Prepared Queries
# Create prepared query for failover across datacenters
curl -X POST http://localhost:8500/v1/query -d '{
"Name": "web-query",
"Service": {
"Service": "web",
"Tags": ["production"],
"Failover": {
"Datacenters": ["dc2", "dc3"]
},
"OnlyPassing": true
}
}'
ACL Configuration
# Bootstrap ACL system
consul acl bootstrap
# Create policy
consul acl policy create -name "app-read" \
-rules='service_prefix "web" { policy = "read" } key_prefix "config/app" { policy = "read" }'
# Create token with policy
consul acl token create -description "App token" -policy-name "app-read"
Common Commands
# Cluster management
consul join 10.0.1.10
consul leave
consul operator raft list-peers
consul operator autopilot state
# Snapshots for backup
consul snapshot save backup.snap
consul snapshot restore backup.snap
# Monitor and debug
consul monitor -log-level=debug
consul debug -duration=30s -interval=5s