Sophie

Sophie

distrib > Fedora > 18 > x86_64 > media > updates > by-pkgid > e450e7f3d6075c4a54de19e68d38177f > files > 347

groonga-doc-3.0.5-1.fc18.x86_64.rpm


<!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>4.2. Remote access &mdash; 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="4. Tutorial" href="../tutorial.html" />
    <link rel="next" title="4.3. Various data types" href="data.html" />
    <link rel="prev" title="4.1. Basic operations" href="introduction.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/tutorial/network.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="data.html" title="4.3. Various data types"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="introduction.html" title="4.1. Basic operations"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">groonga v3.0.5 documentation</a> &raquo;</li>
          <li><a href="../tutorial.html" accesskey="U">4. Tutorial</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="remote-access">
<h1>4.2. Remote access<a class="headerlink" href="#remote-access" title="Permalink to this headline">¶</a></h1>
<p>You can use groonga as a server which allows remote access. Groonga supports the original protocol (gqtp), the memcached binary protocol and HTTP.</p>
<div class="section" id="groonga-query-transfer-protocol-gqtp">
<h2>4.2.1. Groonga query transfer protocol (gqtp)<a class="headerlink" href="#groonga-query-transfer-protocol-gqtp" title="Permalink to this headline">¶</a></h2>
<div class="section" id="how-to-run-a-gqtp-server">
<h3>4.2.1.1. How to run a gqtp server<a class="headerlink" href="#how-to-run-a-gqtp-server" title="Permalink to this headline">¶</a></h3>
<p>Groonga has a special protocol, named groonga query transfer ptorotocl (gqtp), for remote access to a database. The following form shows how to run groonga as a gqtp server.</p>
<p>Form:</p>
<div class="highlight-none"><div class="highlight"><pre>groonga [-p PORT_NUMBER] -s DB_PATH
</pre></div>
</div>
<p>The <cite>-s</cite> option specifies to run groonga as a server. DB_PATH specifies the path of the existing database to be hosted. The <cite>-p</cite> option and its argument, PORT_NUMBER, specify the port number of the server. The default port number is 10041, which is used when you don't specify PORT_NUMBER.</p>
<p>The following command runs a server that listens on the default port number. The server accepts operations to the specified database.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>% groonga -s /tmp/groonga-databases/introduction.db
Ctrl-c
%
</pre></div>
</div>
</div>
<div class="section" id="how-to-run-a-gqtp-daemon">
<h3>4.2.1.2. How to run a gqtp daemon<a class="headerlink" href="#how-to-run-a-gqtp-daemon" title="Permalink to this headline">¶</a></h3>
<p>You can also run a gqtp server as a daemon by using the <cite>-d</cite> option, instead of the <cite>-s</cite> option.</p>
<p>Form:</p>
<div class="highlight-none"><div class="highlight"><pre>groonga [-p PORT_NUMBER] -d DB_PATH
</pre></div>
</div>
<p>A groonga daemon prints its process ID as follows. In this example, the process ID is 12345. Then, the daemon opens a specified database and accepts operations to that database.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>% groonga -d /tmp/groonga-databases/introduction.db
12345
%
</pre></div>
</div>
</div>
<div class="section" id="how-to-run-a-gqtp-client">
<h3>4.2.1.3. How to run a gqtp client<a class="headerlink" href="#how-to-run-a-gqtp-client" title="Permalink to this headline">¶</a></h3>
<p>You can run groonga as a gqtp client as follows:</p>
<p>Form:</p>
<div class="highlight-none"><div class="highlight"><pre>groonga [-p PORT_NUMBER] -c [HOST_NAME_OR_IP_ADDRESS]
</pre></div>
</div>
<p>This command establishes a connection with a gqtp server and then enters into interactive mode. HOST_NAME_OR_IP_ADDRESS specifies the hostname or the IP address of the server. If not specifed, groonga uses the default hostname &quot;localhost&quot;. The <cite>-p</cite> option and its argument, PORT_NUMBER, specify the port number of the server. If not specified, groonga uses the default port number 10041.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>% groonga -c
status
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   {
#     &quot;uptime&quot;: 0,
#     &quot;max_command_version&quot;: 2,
#     &quot;n_queries&quot;: 0,
#     &quot;cache_hit_rate&quot;: 0.0,
#     &quot;version&quot;: &quot;3.0.5&quot;,
#     &quot;alloc_count&quot;: 136,
#     &quot;command_version&quot;: 1,
#     &quot;starttime&quot;: 1372040831,
#     &quot;default_command_version&quot;: 1
#   }
# ]
&gt; ctrl-d
%
</pre></div>
</div>
<p>In interactive mode, groonga reads commands from the standard input and executes them one by one.</p>
</div>
<div class="section" id="how-to-terminate-a-gqtp-server">
<h3>4.2.1.4. How to terminate a gqtp server<a class="headerlink" href="#how-to-terminate-a-gqtp-server" title="Permalink to this headline">¶</a></h3>
<p>You can terminate a gqtp server with a <a class="reference internal" href="../reference/commands/shutdown.html"><em>shutdown</em></a> command.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>% groonga -c
&gt; shutdown
%
</pre></div>
</div>
</div>
</div>
<div class="section" id="memcached-binary-protocol">
<h2>4.2.2. Memcached binary protocol<a class="headerlink" href="#memcached-binary-protocol" title="Permalink to this headline">¶</a></h2>
<p>Groonga supports the memcached binary protocol. The following form shows how to run groonga as a memcached binary protocol server daemon.</p>
<p>Form:</p>
<div class="highlight-none"><div class="highlight"><pre>groonga [-p PORT_NUMBER] -d --protocol memcached DB_PATH
</pre></div>
</div>
<p>The <cite>--protocol</cite> option and its argument specify the protocol of the server. &quot;memcached&quot; specifies to use the memcached binary protocol.</p>
</div>
<div class="section" id="hypertext-transfer-protocol-http">
<h2>4.2.3. Hypertext transfer protocol (HTTP)<a class="headerlink" href="#hypertext-transfer-protocol-http" title="Permalink to this headline">¶</a></h2>
<div class="section" id="how-to-run-an-http-server">
<h3>4.2.3.1. How to run an HTTP server<a class="headerlink" href="#how-to-run-an-http-server" title="Permalink to this headline">¶</a></h3>
<p>Groonga supports the hypertext transfer protocol (HTTP). The following form shows how to run groonga as an HTTP server daemon.</p>
<p>Form:</p>
<div class="highlight-none"><div class="highlight"><pre>groonga [-p PORT_NUMBER] -d --protocol http DB_PATH
</pre></div>
</div>
<p>The <cite>--protocol</cite> option and its argument specify the protocol of the server. &quot;http&quot; specifies to use HTTP.</p>
<p>The following command runs an HTTP server that listens on the port number 80.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>% sudo groonga -p 80 -d --protocol http /tmp/groonga-databases/introduction.db
%
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You must have root privileges if you listen on the port number 80 (well known port).
There is no such a limitation about the port number 1024 or over.</p>
</div>
</div>
<div class="section" id="how-to-send-a-command-to-an-http-server">
<h3>4.2.3.2. How to send a command to an HTTP server<a class="headerlink" href="#how-to-send-a-command-to-an-http-server" title="Permalink to this headline">¶</a></h3>
<p>You can send a command to an HTTP server by sending a GET request to /d/COMMAND_NAME. Command parameters can be passed as parameters of the GET request. The format is &quot;?NAME_1=VALUE_1&amp;NAME_2=VALUE_2&amp;...&quot;.</p>
<p>The following example shows how to send commands to an HTTP server.</p>
<p>Execution example:</p>
<div class="highlight-none"><div class="highlight"><pre>http://HOST_NAME_OR_IP_ADDRESS[:PORT_NUMBER]/d/status
Executed command:
status
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   {
#     &quot;uptime&quot;: 0,
#     &quot;max_command_version&quot;: 2,
#     &quot;n_queries&quot;: 0,
#     &quot;cache_hit_rate&quot;: 0.0,
#     &quot;version&quot;: &quot;3.0.5&quot;,
#     &quot;alloc_count&quot;: 137,
#     &quot;command_version&quot;: 1,
#     &quot;starttime&quot;: 1372040831,
#     &quot;default_command_version&quot;: 1
#   }
# ]

http://HOST_NAME_OR_IP_ADDRESS[:PORT_NUMBER]/d/select?table=Site&amp;query=title:@this
Executed command:
select --table Site --query title:@this
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   [
#     [
#       [
#         1
#       ],
#       [
#         [
#           &quot;_id&quot;,
#           &quot;UInt32&quot;
#         ],
#         [
#           &quot;_key&quot;,
#           &quot;ShortText&quot;
#         ],
#         [
#           &quot;country&quot;,
#           &quot;SiteCountry&quot;
#         ],
#         [
#           &quot;domain&quot;,
#           &quot;SiteDomain&quot;
#         ],
#         [
#           &quot;link&quot;,
#           &quot;Site&quot;
#         ],
#         [
#           &quot;links&quot;,
#           &quot;Site&quot;
#         ],
#         [
#           &quot;location&quot;,
#           &quot;WGS84GeoPoint&quot;
#         ],
#         [
#           &quot;title&quot;,
#           &quot;ShortText&quot;
#         ]
#       ],
#       [
#         1,
#         &quot;http://example.org/&quot;,
#         &quot;japan&quot;,
#         &quot;.org&quot;,
#         &quot;http://example.net/&quot;,
#         [
#           &quot;http://example.net/&quot;,
#           &quot;http://example.org/&quot;,
#           &quot;http://example.com/&quot;
#         ],
#         &quot;128452975x503157902&quot;,
#         &quot;This is test record 1!&quot;
#       ]
#     ]
#   ]
# ]
</pre></div>
</div>
</div>
</div>
<div class="section" id="administration-tool-http">
<h2>4.2.4. Administration tool (HTTP)<a class="headerlink" href="#administration-tool-http" title="Permalink to this headline">¶</a></h2>
<p>An HTTP server of groonga provides a browser based administration tool that makes database management easy. After starting an HTTP server, you can use the administration tool by accessing <a class="reference external" href="http://HOST_NAME_OR_IP_ADDRESS[:PORT_NUMBER]/">http://HOST_NAME_OR_IP_ADDRESS[:PORT_NUMBER]/</a>. Note that Javascript must be enabled for the tool to work properly.</p>
</div>
<div class="section" id="security-issues">
<h2>4.2.5. Security issues<a class="headerlink" href="#security-issues" title="Permalink to this headline">¶</a></h2>
<p>Groonga servers don't support user authentication. Everyone can view and modify databases hosted by groonga servers. You are recommended to restrict IP addresses that can access groonga servers. You can use iptables or similar for this purpose.</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="#">4.2. Remote access</a><ul>
<li><a class="reference internal" href="#groonga-query-transfer-protocol-gqtp">4.2.1. Groonga query transfer protocol (gqtp)</a><ul>
<li><a class="reference internal" href="#how-to-run-a-gqtp-server">4.2.1.1. How to run a gqtp server</a></li>
<li><a class="reference internal" href="#how-to-run-a-gqtp-daemon">4.2.1.2. How to run a gqtp daemon</a></li>
<li><a class="reference internal" href="#how-to-run-a-gqtp-client">4.2.1.3. How to run a gqtp client</a></li>
<li><a class="reference internal" href="#how-to-terminate-a-gqtp-server">4.2.1.4. How to terminate a gqtp server</a></li>
</ul>
</li>
<li><a class="reference internal" href="#memcached-binary-protocol">4.2.2. Memcached binary protocol</a></li>
<li><a class="reference internal" href="#hypertext-transfer-protocol-http">4.2.3. Hypertext transfer protocol (HTTP)</a><ul>
<li><a class="reference internal" href="#how-to-run-an-http-server">4.2.3.1. How to run an HTTP server</a></li>
<li><a class="reference internal" href="#how-to-send-a-command-to-an-http-server">4.2.3.2. How to send a command to an HTTP server</a></li>
</ul>
</li>
<li><a class="reference internal" href="#administration-tool-http">4.2.4. Administration tool (HTTP)</a></li>
<li><a class="reference internal" href="#security-issues">4.2.5. Security issues</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="introduction.html"
                        title="previous chapter">4.1. Basic operations</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="data.html"
                        title="next chapter">4.3. Various data types</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/tutorial/network.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="data.html" title="4.3. Various data types"
             >next</a> |</li>
        <li class="right" >
          <a href="introduction.html" title="4.1. Basic operations"
             >previous</a> |</li>
        <li><a href="../index.html">groonga v3.0.5 documentation</a> &raquo;</li>
          <li><a href="../tutorial.html" >4. Tutorial</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2013, Brazil, Inc.
    </div>
  </body>
</html>