Cache
キャッシュ・ストレージシステム
📚 情報ソース
このドキュメントは以下の情報源を基に作成されています:
主要ソース
補足ソース
- キャッシュシステムのベストプラクティス: パフォーマンスチューニングとクラスター構成
- 実運用環境の設定例: HA構成とフェイルオーバー設定
Redis
📚 公式ドキュメント: Redis
Redisはインメモリデータストア・キャッシュシステムです。高速なデータアクセスとパブ/サブ機能を提供します。
基本設定
| com.instana.plugin.redis:
poll_rate: 10 # 秒単位(デフォルト1秒)
|
設定項目の詳細
| 項目 |
説明 |
デフォルト値 |
推奨値 |
取得方法 |
poll_rate |
メトリクス収集間隔 |
1 |
10 |
秒単位 |
host |
Redisホスト |
localhost |
環境に応じて |
Redis設定から |
port |
Redisポート |
6379 |
6379 |
Redis設定から |
password |
Redis認証パスワード |
- |
Vault推奨 |
Redis設定から |
database |
データベース番号 |
0 |
0 |
用途に応じて |
実践的な使用例
1. 基本的なRedis監視
| com.instana.plugin.redis:
poll_rate: 10
host: 'localhost'
port: 6379
|
2. パスワード認証付きRedis
| com.instana.plugin.redis:
poll_rate: 10
host: 'redis.example.com'
port: 6379
password: 'redis_password'
|
3. Vault統合
| com.instana.plugin.redis:
poll_rate: 10
host: 'redis.example.com'
port: 6379
password:
configuration_from:
type: vault
secret_key:
path: secret/redis
key: password
|
4. Redis Sentinel
| com.instana.plugin.redis:
poll_rate: 10
sentinel:
master_name: 'mymaster'
sentinels:
- host: 'sentinel1.example.com'
port: 26379
- host: 'sentinel2.example.com'
port: 26379
- host: 'sentinel3.example.com'
port: 26379
password:
configuration_from:
type: vault
secret_key:
path: secret/redis
key: password
|
5. Redis Cluster
| com.instana.plugin.redis:
poll_rate: 10
cluster:
nodes:
- host: 'redis-node1.example.com'
port: 6379
- host: 'redis-node2.example.com'
port: 6379
- host: 'redis-node3.example.com'
port: 6379
password:
configuration_from:
type: vault
secret_key:
path: secret/redis
key: password
|
ベストプラクティス
セキュリティ
-
パスワード認証の有効化
| # redis.conf
requirepass your_strong_password
# Instana設定
```yaml
com.instana.plugin.redis:
password:
configuration_from:
type: vault
secret_key:
path: secret/redis
key: password
|
-
ネットワークアクセス制限
| # redis.conf
bind 127.0.0.1 10.0.0.0/8
protected-mode yes
|
-
SSL/TLS接続
| com.instana.plugin.redis:
host: 'redis.example.com'
port: 6380
ssl: true
ssl_ca_cert: '/etc/ssl/certs/ca-bundle.crt'
password:
configuration_from:
type: vault
secret_key:
path: secret/redis
key: password
|
Memcached
📚 公式ドキュメント: Memcached
Memcachedは分散メモリキャッシュシステムです。データベースの負荷を軽減するために広く使用されています。
基本設定
| com.instana.plugin.memcached:
poll_rate: 10 # 秒単位
|
設定項目の詳細
| 項目 |
説明 |
デフォルト値 |
推奨値 |
取得方法 |
poll_rate |
メトリクス収集間隔 |
10 |
10-30 |
秒単位 |
host |
Memcachedホスト |
localhost |
環境に応じて |
Memcached設定から |
port |
Memcachedポート |
11211 |
11211 |
Memcached設定から |
実践的な使用例
1. 基本的なMemcached監視
| com.instana.plugin.memcached:
poll_rate: 10
host: 'localhost'
port: 11211
|
2. 複数Memcachedインスタンス
| com.instana.plugin.memcached:
instances:
- name: 'memcached-session'
host: 'memcached1.example.com'
port: 11211
poll_rate: 10
- name: 'memcached-cache'
host: 'memcached2.example.com'
port: 11211
poll_rate: 30
|
3. SASL認証付きMemcached
| com.instana.plugin.memcached:
poll_rate: 10
host: 'memcached.example.com'
port: 11211
sasl:
enabled: true
username: 'memcached_user'
password:
configuration_from:
type: vault
secret_key:
path: secret/memcached
key: password
|
Ceph
📚 公式ドキュメント: Ceph
Cephは分散ストレージシステムで、オブジェクト、ブロック、ファイルストレージを提供します。
基本設定
| com.instana.plugin.ceph:
enabled: true
ceph-executable-path: '/usr/bin/ceph'
poll_rate: 10 # 秒単位(デフォルト5秒)
|
設定項目の詳細
| 項目 |
説明 |
デフォルト値 |
推奨値 |
取得方法 |
enabled |
センサーの有効化 |
false |
true |
- |
ceph-executable-path |
Cephコマンドパス |
/usr/bin/ceph |
環境に応じて |
which ceph |
poll_rate |
メトリクス収集間隔 |
5 |
10 |
秒単位 |
config_file |
Ceph設定ファイル |
/etc/ceph/ceph.conf |
環境に応じて |
Ceph設定から |
実践的な使用例
1. 基本的なCeph監視
| com.instana.plugin.ceph:
enabled: true
ceph-executable-path: '/usr/bin/ceph'
poll_rate: 10
|
2. カスタム設定ファイル
| com.instana.plugin.ceph:
enabled: true
ceph-executable-path: '/usr/bin/ceph'
config_file: '/etc/ceph/ceph.conf'
keyring: '/etc/ceph/ceph.client.admin.keyring'
poll_rate: 10
|
3. 複数Cephクラスター
| com.instana.plugin.ceph:
enabled: true
clusters:
- name: 'ceph-prod'
ceph-executable-path: '/usr/bin/ceph'
config_file: '/etc/ceph/prod/ceph.conf'
poll_rate: 10
- name: 'ceph-backup'
ceph-executable-path: '/usr/bin/ceph'
config_file: '/etc/ceph/backup/ceph.conf'
poll_rate: 30
|
ベストプラクティス
セキュリティ
-
最小権限の原則
| # 監視専用ユーザーの作成
ceph auth get-or-create client.monitoring \
mon 'allow r' \
osd 'allow r' \
mds 'allow r'
# キーリングの作成
ceph auth get client.monitoring -o /etc/ceph/ceph.client.monitoring.keyring
|
-
キーリングの保護
| # 適切な権限設定
chmod 600 /etc/ceph/ceph.client.monitoring.keyring
chown instana:instana /etc/ceph/ceph.client.monitoring.keyring
|
Varnish Cache
📚 公式ドキュメント: Varnish Cache
VarnishはHTTPアクセラレータ・リバースプロキシキャッシュです。
基本設定
| com.instana.plugin.varnish:
poll_rate: 1 # 秒単位(デフォルト1秒)
|
設定項目の詳細
| 項目 |
説明 |
デフォルト値 |
推奨値 |
取得方法 |
poll_rate |
メトリクス収集間隔 |
1 |
1-10 |
秒単位 |
instance_name |
Varnishインスタンス名 |
- |
環境に応じて |
varnishstat -l |
実践的な使用例
1. 基本的なVarnish監視
| com.instana.plugin.varnish:
poll_rate: 1
|
2. 名前付きインスタンス
| com.instana.plugin.varnish:
poll_rate: 1
instance_name: 'varnish-frontend'
|
3. 複数Varnishインスタンス
| com.instana.plugin.varnish:
instances:
- name: 'varnish-web'
instance_name: 'web'
poll_rate: 1
- name: 'varnish-api'
instance_name: 'api'
poll_rate: 5
|
ベストプラクティス
パフォーマンス
-
適切なキャッシュサイズ
| # varnish起動オプション
varnishd -s malloc,2G # 2GBのメモリキャッシュ
|
-
キャッシュヒット率の監視
| com.instana.plugin.varnish:
poll_rate: 1
# キャッシュヒット率が低い場合はVCL設定を見直す
|
DRBD (Distributed Replicated Block Device)
📚 公式ドキュメント: DRBD
DRBDは分散レプリケーテッドブロックデバイスで、ネットワーク経由でブロックデバイスをミラーリングします。
基本設定
| com.instana.plugin.drbd:
enabled: true
poll_rate: 60 # 秒単位(デフォルト60秒)
instances:
DRBD_HOST_1:
port: '8080'
username: 'admin'
password: 'drbd_password'
availabilityZone: 'DRBD Cluster A'
DRBD_HOST_2:
port: '8080'
username: 'admin'
password: 'drbd_password'
availabilityZone: 'DRBD Cluster B'
|
設定項目の詳細
| 項目 |
説明 |
デフォルト値 |
推奨値 |
取得方法 |
enabled |
センサーの有効化 |
false |
true |
- |
poll_rate |
メトリクス収集間隔 |
60 |
60 |
秒単位 |
port |
DRBDポート |
8080 |
8080 |
DRBD設定から |
username |
認証ユーザー名 |
- |
監視用ユーザー |
DRBD設定から |
password |
認証パスワード |
- |
Vault推奨 |
DRBD設定から |
実践的な使用例
1. 基本的なDRBD監視
| com.instana.plugin.drbd:
enabled: true
poll_rate: 60
instances:
PRIMARY:
port: '8080'
username: 'monitoring'
password: 'drbd_password'
availabilityZone: 'Primary Node'
SECONDARY:
port: '8080'
username: 'monitoring'
password: 'drbd_password'
availabilityZone: 'Secondary Node'
|
2. Vault統合
| com.instana.plugin.drbd:
enabled: true
poll_rate: 60
instances:
PRIMARY:
port: '8080'
username: 'monitoring'
password:
configuration_from:
type: vault
secret_key:
path: secret/drbd
key: password
availabilityZone: 'Primary Node'
|
トラブルシューティング
問題1: Redisに接続できない
症状:
- Redis メトリクスが表示されない
- 接続エラー
原因と解決策:
-
Redis接続の確認
| # Redisに接続できるか確認
redis-cli -h localhost -p 6379 ping
# パスワード認証が必要な場合
redis-cli -h localhost -p 6379 -a password ping
|
-
ネットワーク設定の確認
| # Redisが起動しているか確認
systemctl status redis
# ポートが開いているか確認
netstat -tlnp | grep 6379
|
-
Redis設定の確認
| # bind設定を確認
grep bind /etc/redis/redis.conf
# protected-modeを確認
grep protected-mode /etc/redis/redis.conf
|
問題2: Memcachedメトリクスが取得できない
症状:
- Memcached メトリクスが表示されない
原因と解決策:
-
Memcached接続の確認
| # Memcachedに接続できるか確認
echo "stats" | nc localhost 11211
# または
telnet localhost 11211
stats
quit
|
-
Memcached起動確認
| # Memcachedが起動しているか確認
systemctl status memcached
# プロセス確認
ps aux | grep memcached
|
問題3: Cephコマンドが実行できない
症状:
- Ceph メトリクスが表示されない
- 権限エラー
原因と解決策:
-
Cephコマンドの確認
| # Cephコマンドが実行できるか確認
sudo -u instana ceph status
# 権限がない場合
sudo usermod -a -G ceph instana
|
-
Ceph設定の確認
| # 設定ファイルの確認
ls -la /etc/ceph/
# キーリングの確認
ls -la /etc/ceph/*.keyring
|
FAQ
Q1: Redis SentinelとRedis Clusterの違いは?
A:
- Redis Sentinel: 高可用性のためのマスター/スレーブ構成。自動フェイルオーバー。
- Redis Cluster: データシャーディングによる水平スケーリング。複数のマスターノード。
| # Sentinel
com.instana.plugin.redis:
sentinel:
master_name: 'mymaster'
sentinels:
- host: 'sentinel1'
port: 26379
# Cluster
com.instana.plugin.redis:
cluster:
nodes:
- host: 'redis-node1'
port: 6379
|
Q2: Memcachedのパフォーマンスを最適化するには?
A: 以下のポイントに注意してください:
-
適切なメモリサイズ
| # 起動オプション
memcached -m 2048 # 2GBのメモリ
|
-
接続数の調整
| memcached -c 1024 # 最大1024接続
|
-
監視間隔の調整
| com.instana.plugin.memcached:
poll_rate: 30 # 負荷が高い場合は間隔を長くする
|
Q3: Varnishのキャッシュヒット率を改善するには?
A: VCL(Varnish Configuration Language)の設定を見直してください:
| # VCL設定例
sub vcl_recv {
# 静的コンテンツをキャッシュ
if (req.url ~ "\.(jpg|jpeg|png|gif|css|js)$") {
return (hash);
}
}
sub vcl_backend_response {
# キャッシュ時間を設定
set beresp.ttl = 1h;
}
|
Q4: Cephクラスターの健全性を確認するには?
A: 以下のコマンドで確認できます:
| # クラスター全体の状態
ceph status
# OSDの状態
ceph osd status
# PGの状態
ceph pg stat
# 健全性の詳細
ceph health detail
|
Instanaは自動的にこれらの情報を収集し、ダッシュボードに表示します。
関連ドキュメント:
- データベース監視設定
- ホスト監視設定
- パフォーマンスチューニング