YUKI Hiroshi
null+****@clear*****
Fri Aug 29 16:56:50 JST 2014
YUKI Hiroshi 2014-08-29 16:56:50 +0900 (Fri, 29 Aug 2014) New Revision: b79b44f63fa9fdb0e266414233d6519d2a9c1832 https://github.com/droonga/droonga.org/commit/b79b44f63fa9fdb0e266414233d6519d2a9c1832 Message: Update descriptions to use droonga-http-server.yaml Modified files: tutorial/1.0.6/add-replica/index.md tutorial/1.0.6/basic/index.md tutorial/1.0.6/groonga/index.md Modified: tutorial/1.0.6/add-replica/index.md (+8 -20) =================================================================== --- tutorial/1.0.6/add-replica/index.md 2014-08-29 14:46:58 +0900 (cdd3f81) +++ tutorial/1.0.6/add-replica/index.md 2014-08-29 16:56:50 +0900 (ba0b378) @@ -60,7 +60,9 @@ First, prepare a new computer, install required softwares and configure them. # gem install droonga-engine # npm install -g droonga-http-server # mkdir ~/droonga - # echo "host: 192.168.100.52" > ~/droonga/droonga-engine.yaml + # echo "host: 192.168.100.52" > ~/droonga/droonga-engine.yaml + # echo "port: 10041" > ~/droonga/droonga-http-server.yaml + # echo "environment: production" >> ~/droonga/droonga-http-server.yaml Then generate the `catalog.json` with only one replica, the new node itself: @@ -81,16 +83,9 @@ If the computer was used as a Droonga node in old days, then you must clear old Let's start the server. (on 192.168.100.52) - # host=192.168.100.52 # export DROONGA_BASE_DIR=$HOME/droonga # droonga-engine - # droonga-http-server --port=10041 \ - --receive-host-name=$host \ - --droonga-engine-host-name=$host \ - --environment=production \ - --cache-size=-1 \ - --daemon \ - --pid-file=$DROONGA_BASE_DIR/droonga-http-server.pid + # droonga-http-server --cache-size=-1 Currently, the new node doesn't work as a node of the cluster, because it doesn't appear in the `catalog.json`. Even if you send requests to the new node, it just forwards all of them to other existing members of the cluster. @@ -160,7 +155,6 @@ If you are reading this tutorial sequentially after the [previous topic](../dump To add a new replica node to an existing cluster, you just run a command `droonga-engine-join` on one of existing replica nodes or the new replica node, in the directory the `catalog.json` is located, like: (on 192.168.100.52) - # cd ~/droonga # droonga-engine-join --host=192.168.100.52 \ --replica-source-host=192.168.100.50 Joining new replica to the cluster... @@ -304,24 +298,18 @@ Next, setup the new replica. Install required packages, generate the `catalog.json`, and start services. (on 192.168.100.52) - # host=192.168.100.52 # export DROONGA_BASE_DIR=$HOME/droonga - # echo "host: $host" > $DROONGA_BASE_DIR/droonga-engine.yaml + # echo "host: 192.168.100.52" > $DROONGA_BASE_DIR/droonga-engine.yaml + # echo "port: 10041" > $DROONGA_BASE_DIR/droonga-http-server.yaml + # echo "environment: production" >> $DROONGA_BASE_DIR/droonga-http-server.yaml # droonga-engine-catalog-generate --hosts=$host \ --output=$DROONGA_BASE_DIR/catalog.json # droonga-engine - # droonga-http-server --port=10041 \ - --receive-host-name=$host \ - --droonga-engine-host-name=$host \ - --environment=production \ - --cache-size=-1 \ - --daemon \ - --pid-file=$DROONGA_BASE_DIR/droonga-http-server.pid + # droonga-http-server --cache-size=-1 Then, join the node to the cluster. (on 192.168.100.52) - # cd ~/droonga # droonga-engine-join --host=192.168.100.52 \ --replica-source-host=192.168.100.50 Modified: tutorial/1.0.6/basic/index.md (+24 -6) =================================================================== --- tutorial/1.0.6/basic/index.md 2014-08-29 14:46:58 +0900 (636ef73) +++ tutorial/1.0.6/basic/index.md 2014-08-29 16:56:50 +0900 (e964cb6) @@ -916,18 +916,36 @@ Next, setup a protocol adapter for clients to accept search requests via HTTP. ## Setup an HTTP Protocol Adapter -Let's use the `droonga-http-server` as an HTTP protocol adapter. It is an npm package for the Node.js. +Let's use the `droonga-http-server` as an HTTP protocol adapter. ### Install the droonga-http-server +It is an npm package for the Node.js so you can install it by `npm` command easily: + # npm install -g droonga-http-server -Then, run it. +Next, put a configuration file `droonga-http-server.yaml` into the configuration directory specified by the environment variable `DROONGA_BASE_DIR`. + +droonga-http-server.yaml: + + port: 10041 + environment: production + +Because there is `droogna-engine.yaml` and droonga-http-server automatically loads some information from `droogna-engine.yaml`, you only have to put very few information to the `droonga-http-server.yaml`. +If no droonga-engine is working on the computer, you have to specify required information completely, to communicate with a droonga-engine server. +For example, if the computer is `192.168.100.51` and there is a droonga-engine server `192.168.100.50`, then `droonga-http-server.yaml` on `192.168.100.51` should be: + +droonga-http-server.yaml: + + port: 10041 + environment: production + engine: + host: 192.168.100.50 + receiver_host: 192.168.100.51 + +OK, let's run it. - # droonga-http-server --receive-host-name=192.168.100.50 \ - --droonga-engine-host-name=192.168.100.50 \ - --daemon \ - --pid-file $DROONGA_BASE_DIR/droonga-http-server.pid + # droonga-http-server ### Search request via HTTP Modified: tutorial/1.0.6/groonga/index.md (+10 -17) =================================================================== --- tutorial/1.0.6/groonga/index.md 2014-08-29 14:46:58 +0900 (19ef922) +++ tutorial/1.0.6/groonga/index.md 2014-08-29 16:56:50 +0900 (f303130) @@ -113,6 +113,12 @@ Assume that you have two computers: `192.168.100.50` and `192.168.100.51`. # scp ~/droonga/catalog.json 192.168.100.51:~/droonga/ (Or, of course, you can generate same `catalog.json` on each computer, instead of copying.) + + 7. Create a `droonga-http-server.yaml` in the directory, *on each computer*. + It includes information to work droonga-http-server well. + + # echo "port: 10041" > ~/droonga/droonga-http-server.yaml + # echo "environment: production" >> ~/droonga/droonga-http-server.yaml All Droonga nodes for your Droonga cluster are prepared by steps described above. Let's continue to the next step. @@ -129,25 +135,12 @@ On the other hand, you have to run multiple servers for each Droonga node to use To start them, run commands like following on each Droonga node: - # host=192.168.100.50 # export DROONGA_BASE_DIR=$HOME/droonga # droonga-engine - # droonga-http-server --port=10041 \ - --receive-host-name=$host \ - --droonga-engine-host-name=$host \ - --environment=production \ - --cache-size=-1 \ - --daemon \ - --pid-file=$DROONGA_BASE_DIR/droonga-http-server.pid - -Note that you have to specify the host name of the Droonga node itself via some options. -It will be used to communicate with other Droonga nodes in the cluster. -So you have to specify different host name on another Droonga node, like: - - # host=192.168.100.51 - # export DROONGA_BASE_DIR=$HOME/droonga - # droonga-engine - ... + # droonga-http-server --cache-size=-1 + +The option `--cache-size=-1` for `droonga-http-server` is just for avoiding that you see cached result unexpectedly, after you modify some data in the cluster. +On an actual production environment, you should not specify it. By the command two nodes construct a cluster and they monitor each other. If one of nodes dies and there is any still alive node, survivor(s) will work as the Droonga cluster. -------------- next part -------------- HTML����������������������������...Download