Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cortexの話をKubeConで聞きたかったっていう話

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for uesyn uesyn
January 09, 2019
2.1k

 Cortexの話をKubeConで聞きたかったっていう話

Avatar for uesyn

uesyn

January 09, 2019
Tweet

More Decks by uesyn

Transcript

  1. Prometheusのローカルストレージ • Long-term Storageではない ◦ レプリケーションの機能がない ◦ クラスター化されていない • 長期間保存が必要な場合

    ◦ Remote Storageを活用 ◦ Prometheusのremote read/write ▪ https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write ▪ https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_read https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations
  2. 簡単な歴史 2016/06/16 Project start at Weaveworks 2016/10/25 Renamed to Cortex

    2018/02/19 Weaveworks initiate community model 2018/09/20 Acceptance of Cortex into the CNCF Sandbox
  3. Ingester • 時系列データを長期ストレージバックエンドへ書き込む ◦ 数時間分のデータを圧縮しチャンクとして ▪ 圧縮にはGorillaを利用 ◦ バックエンドの長期ストレージへの書き込み頻度を下げる •

    過去12時間のデータを保持しておく ◦ 直近のデータの読み込みを高速化するため ◦ 上記のためセミステイトフル https://schd.ws/hosted_files/kccna18/9b/Cortex%20CloudNativeCon%202018.pdf
  4. Query Frontend • テナントからのReadリクエストをいい感じにQuerierに流してくれる ◦ Readのリクエストをテナント ID毎にキューイング ◦ テナント間のリクエストを公平にスケジューリング ◦

    エラー時のリトライ ◦ 複数の日をまたぐリクエストの分割による分散処理 ◦ クエリ結果のキャッシュ • オプションのサービスなので省略可能
  5. とりあえず動いた手順 1. make a. コンテナイメージができるので動かしたい k8sからアクセスできるregisotryへpush i. 公式で用意されているコンテナイメージはたぶん存在してない ii. makeの前にMakefileのIMAGE_PREFIXを編集しておく

    2. k8sディレクトリ内のマニフェストのimageを上記へ置換 3. 一部マニフェスト内のargumentが間違っている部分を修正 対象:ingester-dep.yaml, querier-dep.yaml, ruler-dep.yaml, table-manager-dep.yaml 変更:--dynamodb.periodic-table.start →  --dynamodb.periodic-table.from 4. kubectl create -f ./k8s
  6. とりあえず動作確認 5. kubectl port-forward svc/nginx 9999:80 6. curl http://127.0.0.1:9999/api/prom/api/v1/query?query=up ◦

    {"status":"success","data":{"resultType":"vector","result":[]}}が多分返ってくる
  7. まとめと今後 • まとめ ◦ cortexの歴史と概要を紹介 ◦ とりあえず動かす手順を紹介 • 今後 ◦

    本物のDynamoDB, S3への接続 ◦ 負荷テストとか? ◦ Ruler, table-manager, schemaの調査 ◦ 似たような設計のLokiの調査