本記事では CData サポート担当からこんなことを聞かれたらどこを確認すべきか?という観点で、よく頂くお問合せ内容をご紹介します。
記事はこちら →Elasticsearch は、人気の分散型の全文検索エンジンです。データを一元的に格納することで、超高速検索や、関連性の細かな調整、パワフルな分析が大規模に、手軽に実行可能になります。Elasticsearch にはデータのローディングを行うパイプラインツール「Logstash」があります。CData Drivers を利用することができるので、CData JDBC Drivers の対応するあらゆるデータソースを簡単にElasticsearch に取り込んで検索・分析を行うことができます。
この記事では、CData Drivers for Google Data Catalog を使って、Google Data Catalog のデータをLogstash 経由でElasticsearch にロードする手順を説明します。
それでは、LogstashでElasticsearch にGoogle Data Catalog データ転送を行うための設定ファイルを作成していきます。
Google Data Catalog uses the OAuth authentication standard. Authorize access to Google APIs on behalf on individual users or on behalf of users in a domain.
Before connecting, specify the following to identify the organization and project you would like to connect to:
Click the project selection drop-down, and select your organization from the list. Then, click More -> Settings. The organization ID is displayed on this page.
Find this by navigating to the cloud console dashboard and selecting your project from the Select from drop-down. The project ID will be present in the Project info card.
When you connect, the OAuth endpoint opens in your default browser. Log in and grant permissions to the application to completes the OAuth process. For more information, refer to the OAuth section in the Help documentation.
input {
jdbc {
jdbc_driver_library => "../logstash-core/lib/jars/cdata.jdbc.googledatacatalog.jar"
jdbc_driver_class => "Java::cdata.jdbc.googledatacatalog.GoogleDataCatalogDriver"
jdbc_connection_string => "jdbc:googledatacatalog:ProjectId=YourProjectId;InitiateOAuth=REFRESH"
jdbc_user => ""
jdbc_password => ""
schedule => "*/30 * * * * *"
statement => "SELECT Type, DatasetName FROM Schemas WHERE ProjectId = 'bigquery-public-data'"
}
}
output {
Elasticsearch {
index => "googledatacatalog_Schemas"
document_id => "xxxx"
}
}
それでは作成した「logstash.conf」ファイルを元にLogstash を実行してみます。
> logstash-7.8.0\bin\logstash -f logstash.conf
成功した旨のログが出ます。これでGoogle Data Catalog データがElasticsearch にロードされました。
例えばKibana で実際にElasticsearch に転送されたデータを見てみます。
GET googledatacatalog_Schemas/_search
{
"query": {
"match_all": {}
}
}
データがElasticsearch に格納されていることが確認できました。
CData JDBC Driver for Google Data Catalog をLogstash で使うことで、Google Data Catalog コネクタとして機能し、簡単にデータをElasticsearch にロードすることができました。ぜひ、30日の無償評価版 をお試しください。