# groonga - An open-source fulltext search engine and column store.

- 日本語版はこちら

### Navigation

- index
- next |
- previous |
- groonga v2.0.4 documentation »
- 7. リファレンスマニュアル »
- 7.1. 実行ファイル »

# 7.1.5. groonga-httpd

## 7.1.5.1. Summary

groonga-httpd is a program to communicate with a groonga server using the HTTP protocol. It functions as same as groonga HTTPサーバー. Although groonga HTTPサーバー has limited support for HTTP with a minimal built-in HTTP server, groonga-httpd has full support for HTTP with an embedded nginx. All standards-compliance and features provided by nginx is also available in groonga-httpd. For details about nginx, see http://www.nginx.org/

groonga-httpd has an Web-based administration tool implemented with HTML and JavaScript. You can access to it from http://hostname:port/.

## 7.1.5.2. Synopsis

    groonga-httpd [nginx options]

## 7.1.5.3. Usage

### 7.1.5.3.1. Set up

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 groonga_database directive like this:

    # 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; # <= This means to turn on groonga-httpd.

        # Specify an actual database and enable this.
        groonga_database /var/lib/groonga/db/db;
      }
      ...
    }

Then, run groonga-httpd. Note that the control immediately returns back to the console because groonga-httpd runs as a daemon process by default.:

    % groonga-httpd

### 7.1.5.3.2. Request queries

To check, request a simple query (status).

Execution example:

    % curl http://localhost:10041/d/status
    [
      [
        0,
        1337566253.89858,
        0.000355720520019531
      ],
      {
        "uptime": 0,
        "max_command_version": 2,
        "n_queries": 0,
        "cache_hit_rate": 0.0,
        "version": "2.0.3-278-g6071d65",
        "alloc_count": 145,
        "command_version": 1,
        "starttime": 1340769698,
        "default_command_version": 1
      }
    ]

### 7.1.5.3.3. Browse the administration tool

Also, you can browse Web-based administration tool at http://localhost:10041/.

### 7.1.5.3.4. Shut down

Finally, to terminate the running groonga-httpd daemon, run this:

    % groonga-httpd -s stop

## 7.1.5.4. Configuration directives

There are two kinds of configuration directives. One is provided by nginx, the other is by groonga-httpd.

The following directives can be used in the groonga-httpd configuration file. By default, it's located at /etc/groonga/httpd/groonga-httpd.conf.

### 7.1.5.4.1. Groonga-specific directives

The following directives aren't provided by nginx. They are provided by groonga-httpd to configure groonga-httpd-specific configurations.

#### 7.1.5.4.1.1. `groonga_database`

Specifies the path to a groonga database.

### 7.1.5.4.2. Performance-related directives

The following directives are related to the performance of groonga-httpd.

#### 7.1.5.4.2.1. `worker_processes`

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.

This isn't a groonga-httpd specific directive, but an nginx's one. For details, see http://wiki.nginx.org/CoreModule#worker_processes.

By default, this is set to 1. It is nginx's default.

## 7.1.5.5. Available nginx modules

All standard HTTP modules except HttpRewriteModule is available. HttpRewriteModule is disabled to avoid to depend on PCRE (Perl Compatible Regular Expressions). For the list of other standard HTTP modules, see http://wiki.nginx.org/Modules.

### Navigation

- index
- next |
- previous |
- groonga v2.0.4 documentation »
- 7. リファレンスマニュアル »
- 7.1. 実行ファイル »