<!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 documentation</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> <link rel="shortcut icon" href="../../_static/favicon.ico"/> <link rel="top" title="groonga v3.0.5 documentation" 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 command" 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">An open-source fulltext search engine and column store.</span> </a> </h1> <div class="other-language-links"> <ul> <li><a href="../../../../ja/html/reference/executables/groonga-httpd.html"><img src="../../_static/jp.png" alt="日本語">日本語版はこちら</a></li> </ul> </div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="groonga-server-http.html" title="8.1.5. groonga HTTPサーバー" accesskey="N">next</a> |</li> <li class="right" > <a href="groonga.html" title="8.1.3. groonga command" accesskey="P">previous</a> |</li> <li><a href="../../index.html">groonga v3.0.5 documentation</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="Permalink to this headline">¶</a></h1> <div class="section" id="summary"> <h2>8.1.4.1. Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2> <p>groonga-httpd is a program to communicate with a groonga server using the HTTP protocol. It functions as same as <a class="reference internal" href="groonga-server-http.html"><em>groonga HTTPサーバー</em></a>. Although <a class="reference internal" href="groonga-server-http.html"><em>groonga HTTPサーバー</em></a> has limited support for HTTP with a minimal built-in HTTP server, groonga-httpd has full support for HTTP with an embedded <a class="reference external" href="http://nginx.org/">nginx</a>. All standards-compliance and features provided by nginx is also available in groonga-httpd.</p> <p>groonga-httpd has an Web-based administration tool implemented with HTML and JavaScript. You can access to it from <a class="reference external" href="http://hostname:port/">http://hostname:port/</a>.</p> </div> <div class="section" id="synopsis"> <h2>8.1.4.2. Synopsis<a class="headerlink" href="#synopsis" title="Permalink to this headline">¶</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. Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2> <div class="section" id="set-up"> <h3>8.1.4.3.1. Set up<a class="headerlink" href="#set-up" title="Permalink to this headline">¶</a></h3> <p>First, you'll need to edit the groonga-httpd configuration file to specify a database. Edit /etc/groonga/httpd/groonga-httpd.conf to enable the <tt class="docutils literal"><span class="pre">groonga_database</span></tt> directive like this:</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>Then, run groonga-httpd. Note that the control immediately returns back to the console because groonga-httpd runs as a daemon process by default.:</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. Request queries<a class="headerlink" href="#request-queries" title="Permalink to this headline">¶</a></h3> <p>To check, request a simple query (<a class="reference internal" href="../commands/status.html"><em>status</em></a>).</p> <p>Execution example:</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. Browse the administration tool<a class="headerlink" href="#browse-the-administration-tool" title="Permalink to this headline">¶</a></h3> <p>Also, you can browse Web-based administration tool at <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. Shut down<a class="headerlink" href="#shut-down" title="Permalink to this headline">¶</a></h3> <p>Finally, to terminate the running groonga-httpd daemon, run this:</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. Configuration directives<a class="headerlink" href="#configuration-directives" title="Permalink to this headline">¶</a></h2> <p>This section decribes only important directives. They are groonga-httpd specific directives and performance related directives.</p> <p>The following directives can be used in the groonga-httpd configuration file. By default, it's located at /etc/groonga/httpd/groonga-httpd.conf.</p> <div class="section" id="groonga-httpd-specific-directives"> <h3>8.1.4.4.1. Groonga-httpd specific directives<a class="headerlink" href="#groonga-httpd-specific-directives" title="Permalink to this headline">¶</a></h3> <p>The following directives aren't provided by nginx. They are provided by groonga-httpd to configure groonga-httpd specific configurations.</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="Permalink to this headline">¶</a></h4> <p>Synopsis:</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>Specifies whether groonga is enabled in the <tt class="docutils literal"><span class="pre">location</span></tt> block. The default is <tt class="docutils literal"><span class="pre">off</span></tt>. You need to specify <tt class="docutils literal"><span class="pre">on</span></tt> to enable groonga.</p> <p>Examples:</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="Permalink to this headline">¶</a></h4> <p>Synopsis:</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>Specifies the path to a groonga database. This is the required directive.</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="Permalink to this headline">¶</a></h4> <p>Synopsis:</p> <div class="highlight-none"><div class="highlight"><pre>groonga_base_path /d/; </pre></div> </div> <dl class="docutils"> <dt>Default</dt> <dd>The same value as <tt class="docutils literal"><span class="pre">location</span></tt> name.</dd> <dt>Context</dt> <dd><tt class="docutils literal"><span class="pre">location</span></tt></dd> </dl> <p>Specifies the base path in URI. groonga uses <tt class="docutils literal"><span class="pre">/d/command?parameter1=value1&...</span></tt> path to run <tt class="docutils literal"><span class="pre">command</span></tt>. The form of path in used in groonga-httpd but groonga-httpd also supports <tt class="docutils literal"><span class="pre">/other-prefix/command?parameter1=value1&...</span></tt> form. To support the form, groonga-httpd removes the base path from the head of request URI and prepend <tt class="docutils literal"><span class="pre">/d/</span></tt> to the processed request URI. By the path conversion, users can use custom path prefix and groonga can always uses <tt class="docutils literal"><span class="pre">/d/command?parameter1=value1&...</span></tt> form.</p> <p>Nomally, this directive isn't needed. It is needed for per command configuration.</p> <p>Here is an example configuration to add authorization to <a class="reference internal" href="../commands/shutdown.html"><em>shutdown</em></a> command:</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. Performance related directives<a class="headerlink" href="#performance-related-directives" title="Permalink to this headline">¶</a></h3> <p>The following directives are related to the performance of groonga-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="Permalink to this headline">¶</a></h4> <p>For optimum performance, set this to be equal to the number of CPUs or cores. In many cases, groonga queries may be CPU-intensive work, so to fully utilize multi-CPU/core systems, it's essential to set this accordingly.</p> <p>This isn't a groonga-httpd specific directive, but an nginx's one. For details, see <a class="reference external" href="http://wiki.nginx.org/CoreModule#worker_processes">http://wiki.nginx.org/CoreModule#worker_processes</a>.</p> <p>By default, this is set to 1. It is nginx's default.</p> </div> </div> </div> <div class="section" id="available-nginx-modules"> <h2>8.1.4.5. Available nginx modules<a class="headerlink" href="#available-nginx-modules" title="Permalink to this headline">¶</a></h2> <p>All standard HTTP modules is available. HttpRewriteModule is disabled when you don't have PCRE (Perl Compatible Regular Expressions). For the list of standard HTTP modules, see <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">Table Of Contents</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. Summary</a></li> <li><a class="reference internal" href="#synopsis">8.1.4.2. Synopsis</a></li> <li><a class="reference internal" href="#usage">8.1.4.3. Usage</a><ul> <li><a class="reference internal" href="#set-up">8.1.4.3.1. Set up</a></li> <li><a class="reference internal" href="#request-queries">8.1.4.3.2. Request queries</a></li> <li><a class="reference internal" href="#browse-the-administration-tool">8.1.4.3.3. Browse the administration tool</a></li> <li><a class="reference internal" href="#shut-down">8.1.4.3.4. Shut down</a></li> </ul> </li> <li><a class="reference internal" href="#configuration-directives">8.1.4.4. Configuration directives</a><ul> <li><a class="reference internal" href="#groonga-httpd-specific-directives">8.1.4.4.1. Groonga-httpd specific directives</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. Performance related directives</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. Available nginx modules</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="groonga.html" title="previous chapter">8.1.3. groonga command</a></p> <h4>Next topic</h4> <p class="topless"><a href="groonga-server-http.html" title="next chapter">8.1.5. groonga HTTPサーバー</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/reference/executables/groonga-httpd.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="groonga-server-http.html" title="8.1.5. groonga HTTPサーバー" >next</a> |</li> <li class="right" > <a href="groonga.html" title="8.1.3. groonga command" >previous</a> |</li> <li><a href="../../index.html">groonga v3.0.5 documentation</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>