{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Raspberry Pi Import Integration","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"raspberry-pi-import-integration","__idx":0},"children":["Raspberry Pi Import Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.raspberrypi.org/"},"children":["Raspberry Pi"]},"は、クレジットカードサイズのシングルボードコンピュータです。低コストで、さまざまなタイプのセンサーを簡単に装備できるため、Raspberry Piをクラウドデータロガーとして使用することは、理想的な使用例の1つです。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Raspberry PiからTreasure Dataにセンサーデータをインポートできます。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"raspbianのインストール","__idx":1},"children":["Raspbianのインストール"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.raspbian.org/"},"children":["Raspbian"]},"は、Debianをベースにした無料のオペレーティングシステムで、Raspberry Pi用に最適化されています。以下のブログ投稿の手順に従って、Raspberry PiにRaspbianをインストールしてください:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.andrewmunsell.com/blog/getting-started-raspberry-pi-install-raspbian"},"children":["Getting Started with Raspberry Pi: Installing Raspbian"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"treasure-agentfluentdのインストール","__idx":2},"children":["Treasure Agent（Fluentd）のインストール"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["次に、RaspbianにTreasure Agent（Fluentd）をインストールします。RaspbianはデフォルトでRuby 1.9.3をバンドルしていますが、追加の開発パッケージが必要です。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ sudo aptitude install ruby-dev\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["これで、Treasure Agent（Fluentd）と必要なプラグインをインストールします。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ sudo gem install fluentd\n$ sudo fluent-gem install fluent-plugin-td\n\nまたは、fluentdの代わりにfluent-bitを使用できます。詳細については、以下のドキュメントを参照してください。\nhttp://fluentbit.io/documentation/0.12/installation/raspberry_pi.html\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"treasure-agentの設定と起動","__idx":3},"children":["Treasure Agentの設定と起動"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://console.treasuredata.com/users/sign_in"},"children":["Treasure アカウントにサインイン"]},"してください。アカウントのAPIキーは、",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://console.treasuredata.com/users/current"},"children":["usersページ"]},"から取得できます。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["APIキーを含む以下の情報でfluent.confファイルを準備します。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<match td.*.*>\n  type tdlog\n  apikey YOUR_API_KEY_HERE\n\n  auto_create_table\n  buffer_type file\n  buffer_path /home/pi/td\n</match>\nsource\n  type http\n  port 8888\n</source>\nsource\n  type forward\n</source>\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["最後に、ターミナルからTreasure Agent（Fluentd）を起動します。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ fluentd -c fluent.conf\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"アップロードテスト","__idx":4},"children":["アップロードテスト"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["設定をテストするには、HTTP経由でTreasure AgentにJSONメッセージを投稿するだけです。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ curl -X POST -d 'json={\"sensor1\":3123.13,\"sensor2\":321.3}' \\\n  http://localhost:8888/td.testdb.raspberrypi\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Pythonを使用している場合は、pythonロガーライブラリを使用できます。"," ","次に、databasesページにアクセスして、データがクラウドに正しくアップロードされたことを確認してください。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://console.treasuredata.com/databases"},"children":["Treasure Data: List of Databases"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["これで、インポートされたデータに対してクエリを発行できます。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://console.treasuredata.com/query_forms/new"},"children":["Treasure Data: New Query"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["たとえば、これらのクエリはsensor1値の平均とsensor2値の合計を計算します。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"SELECT AVG(sensor1) FROM raspberrypi;\nSELECT SUM(sensor2) FROM raspberrypi;\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"結論","__idx":5},"children":["結論"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Raspberry Piは、データロガーハードウェアのプロトタイピングに理想的なプラットフォームです。Raspberry PiとTreasure Dataを組み合わせることで、クラウドで物理世界を簡単に分析できます。"]}]},"headings":[{"value":"Raspberry Pi Import Integration","id":"raspberry-pi-import-integration","depth":1},{"value":"Raspbianのインストール","id":"raspbianのインストール","depth":1},{"value":"Treasure Agent（Fluentd）のインストール","id":"treasure-agentfluentdのインストール","depth":1},{"value":"Treasure Agentの設定と起動","id":"treasure-agentの設定と起動","depth":1},{"value":"アップロードテスト","id":"アップロードテスト","depth":1},{"value":"結論","id":"結論","depth":1}],"frontmatter":{"seo":{"title":"Raspberry Pi Import Integration"}},"lastModified":"2026-06-01T09:34:27.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/int/raspberry-pi-import-integration","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}