LOG Indexing Service は、E-MapReduce によって起動された Druid プラグインであり、Log Service からのデータを消費するために使用されます。
バックグランド
LOG Indexing Service は、Kafka Indexing Service と同様の方法でデータを消費し、1 回限りのセマンティクスをサポートします。
LOG Indexing Service には、Log Service と Kafka Indexing Service の両方の利点があります。
- Log Service にデータを収集するためのさまざまな便利な方法を提供しています。
- Kafka クラスターが不要になり、データフローのパスが短縮されます。
- 1 回限りのセマンティクスをサポートしています。
- 失敗したジョブを再試行してデータ消費の信頼性を確保し、サービスを中断することなくクラスターの再起動とサービスの更新を可能にします。
準備
- LOG をアクティブにし、プロジェクトとログストアを設定したことをご確認ください。
- 次の設定項目を準備します。
- LOG のエンドポイントです。 イントラネットエンドポイントを使用します。
- LOG にアクセスするための AccessKey ID と AccessKey シークレットのペアです。
LOG Indexing Service の使用
- 取り込み仕様を準備します。
LOG Indexing Service は、Kafka Indexing Service に似ています。 詳細については、「Kafka Indexing Service」をご参照ください。 同じデータにインデックスが付けられます。 データソースの取り込み仕様は次のとおりで、metrics-sls.json として保存されます。
{ "type": "sls", "dataSchema": { "dataSource": "metrics-sls", "parser": { "type": "string", "parseSpec": { "timestampSpec": { "column": "time", "format": "auto" }, "dimensionsSpec": { "dimensions": ["url", "user"] }, "format": "json" } }, "granularitySpec": { "type": "uniform", "segmentGranularity": "hour", "queryGranularity": "none" }, "metricsSpec": [{ "type": "count", "name": "views" }, { "name": "latencyMs", "type": "doubleSum", "fieldName": "latencyMs" } ] }, "ioConfig": { "project": <your_project>, "logstore": <your_logstore>, "consumerProperties": { "endpoint": "cn-hangzhou-intranet.log.aliyuncs.com", (In this example, the China (Hangzhou) region is used. Use the intranet endpoint.) accessKeyId: "<your-access-key-id>", "access-key-secret": <your_access_key_secret>, "logtail.collection-mode": "simple"/"other" }, "taskCount": 1, "replicas": 1, "taskDuration": "PT1H" }, "tuningConfig": { "type": "sls", "maxRowsInMemory": "100000" } }
Kafka Indexing Service と LOG Indexing Service の取り込み仕様は似ています。 次のフィールドにご注意ください。- タイプ: sls です。
- dataSchema.parser.parseSpec.format: ioConfig.consumerProperties.logtail.collection-mode (Log Service のログ収集モード) に依存します。 シンプルモードを選択した場合は、ソースファイルフォーマットを入力します。 シンプルモードを選択しない場合は、json と入力します。
- ioConfig.project: 収集するログのプロジェクトです。
- ioConfig.logstore: 収集するログのログストアです。
- ioConfig.consumerProperties.endpoint: LOG のイントラネットエンドポイントです。 たとえば、中国 (杭州) リージョンのエンドポイントは cn-hangzhou-intranet.log.aliyuncs.com です。
- ioConfig.consumerProperties.access-key-id: アカウントの AccessKey ID です。
- ioConfig.consumerProperties.access-key-secret: アカウントの AccessKey Secret です。
- ioConfig.consumerProperties.logtail.collection-mode: Log Service のログ収集モードです。 シンプルモードを選択した場合は、simple と入力します。 それ以外の場合は、other と入力します。
- 次のコマンドを実行して、LOG スーパーバイザーを追加します。
curl --negotiate -u:druid -b ~/cookies -c ~/cookies -XPOST -H 'Content-Type: application/json' -d @metrics-sls.json http://emr-header-1.cluster-1234:18090/druid/indexer/v1/supervisor
重要 安全な Druid クラスターには、-negotiate、-u、-b、および -c オプションが必須です。 - LOG にデータをインポートする
複数の方法を使用して、LOG にデータをインポートすることができます。 詳細については、「Log Service」をご参照ください。
- Druid を使用してクエリを実行します。