<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>8.1.4. groonga-httpd — groonga v3.0.5ドキュメント</title> <link rel="stylesheet" href="../../_static/groonga.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../../', VERSION: '3.0.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../../_static/jquery.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/translations.js"></script> <link rel="shortcut icon" href="../../_static/favicon.ico"/> <link rel="top" title="groonga v3.0.5ドキュメント" href="../../index.html" /> <link rel="up" title="8.1. 実行ファイル" href="../executables.html" /> <link rel="next" title="8.1.5. groonga HTTPサーバー" href="groonga-server-http.html" /> <link rel="prev" title="8.1.3. groongaコマンド" href="groonga.html" /> </head> <body> <div class="header"> <h1 class="title"> <a id="top-link" href="../../index.html"> <span class="project">groonga</span> <span class="separator">-</span> <span class="description">オープンソースのカラムストア機能付き全文検索エンジン</span> </a> </h1> <div class="other-language-links"> <ul> <li><a href="../../../../en/html/reference/executables/groonga-httpd.html"><img src="../../_static/us.png" alt="English">English page</a></li> </ul> </div> </div> <div class="related"> <h3>ナビゲーション</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="総合索引" accesskey="I">索引</a></li> <li class="right" > <a href="groonga-server-http.html" title="8.1.5. groonga HTTPサーバー" accesskey="N">次へ</a> |</li> <li class="right" > <a href="groonga.html" title="8.1.3. groongaコマンド" accesskey="P">前へ</a> |</li> <li><a href="../../index.html">groonga v3.0.5ドキュメント</a> »</li> <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> <li><a href="../executables.html" accesskey="U">8.1. 実行ファイル</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="groonga-httpd"> <h1>8.1.4. groonga-httpd<a class="headerlink" href="#groonga-httpd" title="このヘッドラインへのパーマリンク">¶</a></h1> <div class="section" id="summary"> <h2>8.1.4.1. 概要<a class="headerlink" href="#summary" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>groonga-httpdはgroongaサーバーとHTTPプロトコルで通信するプログラムです。 機能的には、 <a class="reference internal" href="groonga-server-http.html"><em>groonga HTTPサーバー</em></a> と同じです。 <a class="reference internal" href="groonga-server-http.html"><em>groonga HTTPサーバー</em></a> はHTTPサーバーとしては最小限の機能しか持ちませんが、groonga-httpdは <a class="reference external" href="http://www.nginx.org/">nginx</a> を組み込むことでnginxが準拠しているHTTPの仕様と機能をすべて利用できます。</p> <p>groonga-httpdにはHTML + JavaScriptで実装された管理ツールが標準で付属しています。ウェブブラウザでhttp://hostname:port/にアクセスすると、管理ツールを利用できます。</p> </div> <div class="section" id="synopsis"> <h2>8.1.4.2. 書式<a class="headerlink" href="#synopsis" title="このヘッドラインへのパーマリンク">¶</a></h2> <div class="highlight-none"><div class="highlight"><pre>groonga-httpd [nginx options] </pre></div> </div> </div> <div class="section" id="usage"> <h2>8.1.4.3. 使い方<a class="headerlink" href="#usage" title="このヘッドラインへのパーマリンク">¶</a></h2> <div class="section" id="set-up"> <h3>8.1.4.3.1. 設定をする<a class="headerlink" href="#set-up" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>まずは、データベースを指定するためにgroonga-httpdの設定ファイルを編集する必要があります。次のように/etc/groonga/httpd/groonga-httpd.confを編集して <tt class="docutils literal"><span class="pre">groonga_database</span></tt> ディレクティブを有効にしてます。</p> <div class="highlight-none"><div class="highlight"><pre># Match this to the file owner of groonga database files if groonga-httpd is # run as root. #user groonga; ... http { ... # Don't change the location; currently only /d/ is supported. location /d/ { groonga on; # <= This means to turn on groonga-httpd. # Specify an actual database and enable this. groonga_database /var/lib/groonga/db/db; } ... } </pre></div> </div> <p>次に、groonga-httpdを実行してください。すぐにターミナルに制御が戻ってきます。これはgroonga-httpdはデフォルトでデーモンプロセスになるからです。</p> <div class="highlight-none"><div class="highlight"><pre>% groonga-httpd </pre></div> </div> </div> <div class="section" id="request-queries"> <h3>8.1.4.3.2. クエリーを実行する<a class="headerlink" href="#request-queries" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>動作を確認するため、簡単なクエリー( <a class="reference internal" href="../commands/status.html"><em>status</em></a> )をリクエストしてみます。</p> <p>実行例:</p> <div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status [ [ 0, 1337566253.89858, 0.000355720520019531 ], { "uptime": 1, "max_command_version": 2, "n_queries": 0, "cache_hit_rate": 0.0, "version": "3.0.5", "alloc_count": 157, "command_version": 1, "starttime": 1372040796, "default_command_version": 1 } ] </pre></div> </div> </div> <div class="section" id="browse-the-administration-tool"> <h3>8.1.4.3.3. 管理ツールを使う<a class="headerlink" href="#browse-the-administration-tool" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>補足ですが、 <a class="reference external" href="http://localhost:10041/">http://localhost:10041/</a> にアクセスすると管理ツールを利用できます。</p> </div> <div class="section" id="shut-down"> <h3>8.1.4.3.4. 終了する<a class="headerlink" href="#shut-down" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>最後に、次のコマンドで動作中のgroonga-httpdデーモンを終了できます。</p> <div class="highlight-none"><div class="highlight"><pre>% groonga-httpd -s stop </pre></div> </div> </div> </div> <div class="section" id="configuration-directives"> <h2>8.1.4.4. 設定ディレクティブ<a class="headerlink" href="#configuration-directives" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>このセクションでは重要なディレクティブのみ説明します。重要なディレクティブとはgroonga-http特有のディレクティブと性能に関するディレクティブです。</p> <p>以下のディレクティブはgroonga-httpdの設定ファイル中で使用することができます。デフォルトでは、設定ファイルは/etc/groonga/httpd/groonga-httpd.confに置かれています。</p> <div class="section" id="groonga-httpd-specific-directives"> <h3>8.1.4.4.1. groonga-httpd特有のディレクティブ<a class="headerlink" href="#groonga-httpd-specific-directives" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>以下のディレクティブはnginxが提供しているものではなく、groonga-httpd関連の設定をするためにgroonga-httpdが提供しているディレクティブです。</p> <div class="section" id="groonga"> <h4>8.1.4.4.1.1. <tt class="docutils literal"><span class="pre">groonga</span></tt><a class="headerlink" href="#groonga" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>書式:</p> <div class="highlight-none"><div class="highlight"><pre>groonga on | off; </pre></div> </div> <dl class="docutils"> <dt>Default</dt> <dd><tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">off;</span></tt></dd> <dt>Context</dt> <dd><tt class="docutils literal"><span class="pre">location</span></tt></dd> </dl> <p>この <tt class="docutils literal"><span class="pre">location</span></tt> ブロックでgroongaを使うかどうかを指定します。デフォルトは <tt class="docutils literal"><span class="pre">off</span></tt> です。groongaを使うためには <tt class="docutils literal"><span class="pre">on</span></tt> を指定してください。</p> <p>例:</p> <div class="highlight-none"><div class="highlight"><pre>location /d/ { groonga on; # Enables groonga under /d/... path } location /d/ { groonga off; # Disables groonga under /d/... path } </pre></div> </div> </div> <div class="section" id="groonga-database"> <h4>8.1.4.4.1.2. <tt class="docutils literal"><span class="pre">groonga_database</span></tt><a class="headerlink" href="#groonga-database" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>書式:</p> <div class="highlight-none"><div class="highlight"><pre>groonga_database /path/to/groonga/database; </pre></div> </div> <dl class="docutils"> <dt>Default</dt> <dd><tt class="docutils literal"><span class="pre">groonga_database</span> <span class="pre">/usr/local/var/lib/groonga/db/db;</span></tt></dd> <dt>Context</dt> <dd><tt class="docutils literal"><span class="pre">http</span></tt>, <tt class="docutils literal"><span class="pre">server</span></tt>, <tt class="docutils literal"><span class="pre">location</span></tt></dd> </dl> <p>groongaデータベースのパスを指定します。このディレクティブは必須です。</p> </div> <div class="section" id="groonga-base-path"> <h4>8.1.4.4.1.3. <tt class="docutils literal"><span class="pre">groonga_base_path</span></tt><a class="headerlink" href="#groonga-base-path" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>書式:</p> <div class="highlight-none"><div class="highlight"><pre>groonga_base_path /d/; </pre></div> </div> <dl class="docutils"> <dt>Default</dt> <dd><p class="first last"><tt class="docutils literal"><span class="pre">location</span></tt> の名前と同じ値。</p> </dd> <dt>Context</dt> <dd><tt class="docutils literal"><span class="pre">location</span></tt></dd> </dl> <p>URIのベースパスを指定します。groongaは <tt class="docutils literal"><span class="pre">command</span></tt> を実行するために <tt class="docutils literal"><span class="pre">/d/command?parameter1=value1&...</span></tt> というパスを使います。groonga-httpdでもこのパスの形式を使いますが、groonga-httpdは <tt class="docutils literal"><span class="pre">/other-prefix/command?parameter1=value1&...</span></tt> というように <tt class="docutils literal"><span class="pre">/d/</span></tt> ではなく別のプレフィックスを使った形式もサポートしています。この別の形式もサポートするために、groonga-httpdはリクエストURIの先頭からベースパスを削除し、先頭に <tt class="docutils literal"><span class="pre">/d/</span></tt> を追加します。このパスの変換をすることにより、ユーザーはプレフィックスをカスタムできるようになりますが、groongaは常に <tt class="docutils literal"><span class="pre">/d/command?parameter1=value1&...</span></tt> という形式で処理できます。</p> <p>通常、このディレクティブを使う必要はありません。このディレクティブはコマンド毎に設定をしたい場合に使います。</p> <p>以下は <a class="reference internal" href="../commands/shutdown.html"><em>shutdown</em></a> コマンドに認証をかける設定例です。:</p> <div class="highlight-none"><div class="highlight"><pre>groonga_database /var/lib/groonga/db/db; location /d/shutdown { groonga on; # groonga_base_path is needed. # Because /d/shutdown is handled as the base path. # Without this configuration, /d/shutdown/shutdown path is required # to run shutdown command. groonga_base_path /d/; auth_basic "manager is required!"; auth_basic_user_file "/etc/managers.htpasswd"; } location /d/ { groonga on; # groonga_base_path doesn't needed. # Because location name is the base path. } </pre></div> </div> </div> </div> <div class="section" id="performance-related-directives"> <h3>8.1.4.4.2. 性能関連のディレクティブ<a class="headerlink" href="#performance-related-directives" title="このヘッドラインへのパーマリンク">¶</a></h3> <p>以下のディレクティブはgronoga-httpdの性能に関連しているディレクティブです。</p> <div class="section" id="worker-processes"> <h4>8.1.4.4.2.1. <tt class="docutils literal"><span class="pre">worker_processes</span></tt><a class="headerlink" href="#worker-processes" title="このヘッドラインへのパーマリンク">¶</a></h4> <p>最適なパフォーマンスを得るためには、CPU数あるいはコア数と同じ数になるようにこのディレクティブを設定してください。大抵の場合、groongaのクエリーはCPU負荷が高いものとなり、複数のCPU/コアを使い切るためには、このディレクティブを設定する必要があります。</p> <p>このディレクティブはgroonga-httpdのディレクティブではなく、nginxのディレクティブです。詳細は、 <a class="reference external" href="http://wiki.nginx.org/CoreModule#worker_processes">http://wiki.nginx.org/CoreModule#worker_processes</a> を参照してください。</p> <p>デフォルトで、このディレクティブには1が設定されています。</p> </div> </div> </div> <div class="section" id="available-nginx-modules"> <h2>8.1.4.5. 利用可能なnginxモジュール<a class="headerlink" href="#available-nginx-modules" title="このヘッドラインへのパーマリンク">¶</a></h2> <p>全てのHTTPの標準モジュールが利用可能です。PCRE(Perl Compatible Regular Expressions)がない場合はHttpRewriteModuleは無効になります。標準モジュールの一覧は、 <a class="reference external" href="http://wiki.nginx.org/Modules">http://wiki.nginx.org/Modules</a> を参照してください。</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../../index.html">目次</a></h3> <ul> <li><a class="reference internal" href="#">8.1.4. groonga-httpd</a><ul> <li><a class="reference internal" href="#summary">8.1.4.1. 概要</a></li> <li><a class="reference internal" href="#synopsis">8.1.4.2. 書式</a></li> <li><a class="reference internal" href="#usage">8.1.4.3. 使い方</a><ul> <li><a class="reference internal" href="#set-up">8.1.4.3.1. 設定をする</a></li> <li><a class="reference internal" href="#request-queries">8.1.4.3.2. クエリーを実行する</a></li> <li><a class="reference internal" href="#browse-the-administration-tool">8.1.4.3.3. 管理ツールを使う</a></li> <li><a class="reference internal" href="#shut-down">8.1.4.3.4. 終了する</a></li> </ul> </li> <li><a class="reference internal" href="#configuration-directives">8.1.4.4. 設定ディレクティブ</a><ul> <li><a class="reference internal" href="#groonga-httpd-specific-directives">8.1.4.4.1. groonga-httpd特有のディレクティブ</a><ul> <li><a class="reference internal" href="#groonga">8.1.4.4.1.1. <tt class="docutils literal"><span class="pre">groonga</span></tt></a></li> <li><a class="reference internal" href="#groonga-database">8.1.4.4.1.2. <tt class="docutils literal"><span class="pre">groonga_database</span></tt></a></li> <li><a class="reference internal" href="#groonga-base-path">8.1.4.4.1.3. <tt class="docutils literal"><span class="pre">groonga_base_path</span></tt></a></li> </ul> </li> <li><a class="reference internal" href="#performance-related-directives">8.1.4.4.2. 性能関連のディレクティブ</a><ul> <li><a class="reference internal" href="#worker-processes">8.1.4.4.2.1. <tt class="docutils literal"><span class="pre">worker_processes</span></tt></a></li> </ul> </li> </ul> </li> <li><a class="reference internal" href="#available-nginx-modules">8.1.4.5. 利用可能なnginxモジュール</a></li> </ul> </li> </ul> <h4>前のトピックへ</h4> <p class="topless"><a href="groonga.html" title="前の章へ">8.1.3. groongaコマンド</a></p> <h4>次のトピックへ</h4> <p class="topless"><a href="groonga-server-http.html" title="次の章へ">8.1.5. groonga HTTPサーバー</a></p> <h3>このページ</h3> <ul class="this-page-menu"> <li><a href="../../_sources/reference/executables/groonga-httpd.txt" rel="nofollow">ソースコードを表示</a></li> </ul> <div id="searchbox" style="display: none"> <h3>クイック検索</h3> <form class="search" action="../../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="検索" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> モジュール、クラス、または関数名を入力してください </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>ナビゲーション</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="総合索引" >索引</a></li> <li class="right" > <a href="groonga-server-http.html" title="8.1.5. groonga HTTPサーバー" >次へ</a> |</li> <li class="right" > <a href="groonga.html" title="8.1.3. groongaコマンド" >前へ</a> |</li> <li><a href="../../index.html">groonga v3.0.5ドキュメント</a> »</li> <li><a href="../../reference.html" >8. リファレンスマニュアル</a> »</li> <li><a href="../executables.html" >8.1. 実行ファイル</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2013, Brazil, Inc. </div> </body> </html>