springboard 0.18.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +63 -0
  5. data/Rakefile +23 -0
  6. data/bin/elasticsearch +18 -0
  7. data/bin/es_plugin +3 -0
  8. data/lib/springboard/generators/USAGE +9 -0
  9. data/lib/springboard/generators/config_generator.rb +24 -0
  10. data/lib/springboard/generators/templates/elasticsearch.in.sh +47 -0
  11. data/lib/springboard/generators/templates/elasticsearch.yml +7 -0
  12. data/lib/springboard/generators/templates/logging.yml +30 -0
  13. data/lib/springboard/railtie.rb +13 -0
  14. data/lib/springboard/tasks.rb +8 -0
  15. data/lib/springboard/version.rb +3 -0
  16. data/lib/springboard.rb +1 -0
  17. data/springboard.gemspec +18 -0
  18. data/vendor/elasticsearch/LICENSE.txt +537 -0
  19. data/vendor/elasticsearch/NOTICE.txt +12 -0
  20. data/vendor/elasticsearch/README.textile +223 -0
  21. data/vendor/elasticsearch/bin/elasticsearch +181 -0
  22. data/vendor/elasticsearch/bin/elasticsearch.in.sh +47 -0
  23. data/vendor/elasticsearch/bin/plugin +31 -0
  24. data/vendor/elasticsearch/config/elasticsearch.yml +337 -0
  25. data/vendor/elasticsearch/config/logging.yml +44 -0
  26. data/vendor/elasticsearch/lib/elasticsearch-0.18.7.jar +0 -0
  27. data/vendor/elasticsearch/lib/jline-0.9.94.jar +0 -0
  28. data/vendor/elasticsearch/lib/jna-3.2.7.jar +0 -0
  29. data/vendor/elasticsearch/lib/log4j-1.2.16.jar +0 -0
  30. data/vendor/elasticsearch/lib/lucene-analyzers-3.5.0.jar +0 -0
  31. data/vendor/elasticsearch/lib/lucene-core-3.5.0.jar +0 -0
  32. data/vendor/elasticsearch/lib/lucene-highlighter-3.5.0.jar +0 -0
  33. data/vendor/elasticsearch/lib/lucene-memory-3.5.0.jar +0 -0
  34. data/vendor/elasticsearch/lib/lucene-queries-3.5.0.jar +0 -0
  35. data/vendor/elasticsearch/lib/sigar/libsigar-amd64-freebsd-6.so +0 -0
  36. data/vendor/elasticsearch/lib/sigar/libsigar-amd64-linux.so +0 -0
  37. data/vendor/elasticsearch/lib/sigar/libsigar-amd64-solaris.so +0 -0
  38. data/vendor/elasticsearch/lib/sigar/libsigar-ia64-linux.so +0 -0
  39. data/vendor/elasticsearch/lib/sigar/libsigar-sparc-solaris.so +0 -0
  40. data/vendor/elasticsearch/lib/sigar/libsigar-sparc64-solaris.so +0 -0
  41. data/vendor/elasticsearch/lib/sigar/libsigar-universal-macosx.dylib +0 -0
  42. data/vendor/elasticsearch/lib/sigar/libsigar-universal64-macosx.dylib +0 -0
  43. data/vendor/elasticsearch/lib/sigar/libsigar-x86-freebsd-5.so +0 -0
  44. data/vendor/elasticsearch/lib/sigar/libsigar-x86-freebsd-6.so +0 -0
  45. data/vendor/elasticsearch/lib/sigar/libsigar-x86-linux.so +0 -0
  46. data/vendor/elasticsearch/lib/sigar/libsigar-x86-solaris.so +0 -0
  47. data/vendor/elasticsearch/lib/sigar/sigar-1.6.4.jar +0 -0
  48. metadata +114 -0
@@ -0,0 +1,12 @@
1
+ ElasticSearch
2
+ Copyright 2009-2011 Elastic Search and Shay Banon
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
6
+
7
+ This product makes use of the google-collections library from
8
+ http://code.google.com/p/google-collections/.
9
+ Copyright (C) 2008 Google Inc.
10
+
11
+ Yaml support uses SnakeYaml Copyright of Andrey Somov under the
12
+ Apache 2 License.
@@ -0,0 +1,223 @@
1
+ h1. ElasticSearch
2
+
3
+ h2. A Distributed RESTful Search Engine
4
+
5
+ h3. "http://www.elasticsearch.org":http://www.elasticsearch.org
6
+
7
+ ElasticSearch is a distributed RESTful search engine built for the cloud. Features include:
8
+
9
+ * Distributed and Highly Available Search Engine.
10
+ ** Each index is fully sharded with a configurable number of shards.
11
+ ** Each shard can have one or more replicas.
12
+ ** Read / Search operations performed on either one of the replica shard.
13
+ * Multi Tenant with Multi Types.
14
+ ** Support for more than one index.
15
+ ** Support for more than one type per index.
16
+ ** Index level configuration (number of shards, index storage, ...).
17
+ * Various set of APIs
18
+ ** HTTP RESTful API
19
+ ** Native Java API.
20
+ ** All APIs perform automatic node operation rerouting.
21
+ * Document oriented
22
+ ** No need for upfront schema definition.
23
+ ** Schema can be defined per type for customization of the indexing process.
24
+ * Reliable, Asynchronous Write Behind for long term persistency.
25
+ * (Near) Real Time Search.
26
+ * Built on top of Lucene
27
+ ** Each shard is a fully functional Lucene index
28
+ ** All the power of Lucene easily exposed through simple configuration / plugins.
29
+ * Per operation consistency
30
+ ** Single document level operations are atomic, consistent, isolated and durable.
31
+ * Open Source under Apache 2 License.
32
+
33
+ h2. Getting Started
34
+
35
+ First of all, DON'T PANIC. It will take 5 minutes to get the gist of what ElasticSearch is all about.
36
+
37
+ h3. Installation
38
+
39
+ * Download and unzip the ElasticSearch installation.
40
+ * Run @bin/elasticsearch -f@ on unix, or @bin/elasticsearch.bat@ on windows.
41
+ * Run @curl -X GET http://localhost:9200/@.
42
+ * Start more servers ...
43
+
44
+ h3. Indexing
45
+
46
+ Lets try and index some twitter like information. First, lets create a twitter user, and add some tweets (the @twitter@ index will be created automatically):
47
+
48
+ <pre>
49
+ curl -XPUT 'http://localhost:9200/twitter/user/kimchy' -d '{ "name" : "Shay Banon" }'
50
+
51
+ curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '
52
+ {
53
+ "user": "kimchy",
54
+ "postDate": "2009-11-15T13:12:00",
55
+ "message": "Trying out Elastic Search, so far so good?"
56
+ }'
57
+
58
+ curl -XPUT 'http://localhost:9200/twitter/tweet/2' -d '
59
+ {
60
+ "user": "kimchy",
61
+ "postDate": "2009-11-15T14:12:12",
62
+ "message": "Another tweet, will it be indexed?"
63
+ }'
64
+ </pre>
65
+
66
+ Now, lets see if the information was added by GETting it:
67
+
68
+ <pre>
69
+ curl -XGET 'http://localhost:9200/twitter/user/kimchy?pretty=true'
70
+ curl -XGET 'http://localhost:9200/twitter/tweet/1?pretty=true'
71
+ curl -XGET 'http://localhost:9200/twitter/tweet/2?pretty=true'
72
+ </pre>
73
+
74
+ h3. Searching
75
+
76
+ Mmm search..., shouldn't it be elastic?
77
+ Lets find all the tweets that @kimchy@ posted:
78
+
79
+ <pre>
80
+ curl -XGET 'http://localhost:9200/twitter/tweet/_search?q=user:kimchy&pretty=true'
81
+ </pre>
82
+
83
+ We can also use the JSON query language ElasticSearch provides instead of a query string:
84
+
85
+ <pre>
86
+ curl -XGET 'http://localhost:9200/twitter/tweet/_search?pretty=true' -d '
87
+ {
88
+ "query" : {
89
+ "text" : { "user": "kimchy" }
90
+ }
91
+ }'
92
+ </pre>
93
+
94
+ Just for kicks, lets get all the documents stored (we should see the user as well):
95
+
96
+ <pre>
97
+ curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -d '
98
+ {
99
+ "query" : {
100
+ "matchAll" : {}
101
+ }
102
+ }'
103
+ </pre>
104
+
105
+ We can also do range search (the @postDate@ was automatically identified as date)
106
+
107
+ <pre>
108
+ curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -d '
109
+ {
110
+ "query" : {
111
+ "range" : {
112
+ "postDate" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:00:00" }
113
+ }
114
+ }
115
+ }'
116
+ </pre>
117
+
118
+ There are many more options to perform search, after all, its a search product no? All the familiar Lucene queries are available through the JSON query language, or through the query parser.
119
+
120
+ h3. Multi Tenant - Indices and Types
121
+
122
+ Maan, that twitter index might get big (in this case, index size == valuation). Lets see if we can structure our twitter system a bit differently in order to support such large amount of data.
123
+
124
+ ElasticSearch support multiple indices, as well as multiple types per index. In the previous example we used an index called @twitter@, with two types, @user@ and @tweet@.
125
+
126
+ Another way to define our simple twitter system is to have a different index per user (though note that an index has an overhead). Here is the indexing curl's in this case:
127
+
128
+ <pre>
129
+ curl -XPUT 'http://localhost:9200/kimchy/info/1' -d '{ "name" : "Shay Banon" }'
130
+
131
+ curl -XPUT 'http://localhost:9200/kimchy/tweet/1' -d '
132
+ {
133
+ "user": "kimchy",
134
+ "postDate": "2009-11-15T13:12:00",
135
+ "message": "Trying out Elastic Search, so far so good?"
136
+ }'
137
+
138
+ curl -XPUT 'http://localhost:9200/kimchy/tweet/2' -d '
139
+ {
140
+ "user": "kimchy",
141
+ "postDate": "2009-11-15T14:12:12",
142
+ "message": "Another tweet, will it be indexed?"
143
+ }'
144
+ </pre>
145
+
146
+ The above index information into the @kimchy@ index, with two types, @info@ and @tweet@. Each user will get his own special index.
147
+
148
+ Complete control on the index level is allowed. As an example, in the above case, we would want to change from the default 5 shards with 1 replica per index, to only 1 shard with 1 replica per index (== per twitter user). Here is how this can be done (the configuration can be in yaml as well):
149
+
150
+ <pre>
151
+ curl -XPUT http://localhost:9200/another_user/ -d '
152
+ {
153
+ "index" : {
154
+ "numberOfShards" : 1,
155
+ "numberOfReplicas" : 1
156
+ }
157
+ }'
158
+ </pre>
159
+
160
+ Search (and similar operations) are multi index aware. This means that we can easily search on more than one
161
+ index (twitter user), for example:
162
+
163
+ <pre>
164
+ curl -XGET 'http://localhost:9200/kimchy,another_user/_search?pretty=true' -d '
165
+ {
166
+ "query" : {
167
+ "matchAll" : {}
168
+ }
169
+ }'
170
+ </pre>
171
+
172
+ Or on all the indices:
173
+
174
+ <pre>
175
+ curl -XGET 'http://localhost:9200/_search?pretty=true' -d '
176
+ {
177
+ "query" : {
178
+ "matchAll" : {}
179
+ }
180
+ }'
181
+ </pre>
182
+
183
+ {One liner teaser}: And the cool part about that? You can easily search on multiple twitter users (indices), with different boost levels per user (index), making social search so much simpler (results from my friends rank higher than results from my friends friends).
184
+
185
+ h3. Distributed, Highly Available
186
+
187
+ Lets face it, things will fail....
188
+
189
+ ElasticSearch is a highly available and distributed search engine. Each index is broken down into shards, and each shard can have one or more replica. By default, an index is created with 5 shards and 1 replica per shard (5/1). There are many topologies that can be used, including 1/10 (improve search performance), or 20/1 (improve indexing performance, with search executed in a map reduce fashion across shards).
190
+
191
+ In order to play with Elastic Search distributed nature, simply bring more nodes up and shut down nodes. The system will continue to serve requests (make sure you use the correct http port) with the latest data indexed.
192
+
193
+ h3. Where to go from here?
194
+
195
+ We have just covered a very small portion of what ElasticSearch is all about. For more information, please refer to: .
196
+
197
+ h3. Building from Source
198
+
199
+ ElasticSearch uses "Gradle":http://www.gradle.org for its build system.
200
+
201
+ In order to create a distribution, simply run the @./gradlew@ command in the cloned directory.
202
+
203
+ The distribution will be created under @build/distributions@.
204
+
205
+ h1. License
206
+
207
+ <pre>
208
+ This software is licensed under the Apache 2 license, quoted below.
209
+
210
+ Copyright 2009-2011 Shay Banon and ElasticSearch <http://www.elasticsearch.com>
211
+
212
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
213
+ use this file except in compliance with the License. You may obtain a copy of
214
+ the License at
215
+
216
+ http://www.apache.org/licenses/LICENSE-2.0
217
+
218
+ Unless required by applicable law or agreed to in writing, software
219
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
220
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
221
+ License for the specific language governing permissions and limitations under
222
+ the License.
223
+ </pre>
@@ -0,0 +1,181 @@
1
+ #!/bin/sh
2
+
3
+ # OPTIONS:
4
+ # -f: start in the foreground
5
+ # -p <filename>: log the pid to a file (useful to kill it later)
6
+
7
+ # CONTROLLING STARTUP:
8
+ #
9
+ # This script relies on few environment variables to determine startup
10
+ # behavior, those variables are:
11
+ #
12
+ # ES_CLASSPATH -- A Java classpath containing everything necessary to run.
13
+ # JAVA_OPTS -- Additional arguments to the JVM for heap size, etc
14
+ # ES_JAVA_OPTS -- External Java Opts on top of the defaults set
15
+ #
16
+ #
17
+ # Optionally, exact memory values can be set using the following values, note,
18
+ # they can still be set using the `ES_JAVA_OPTS`. Sample format include "512m", and "10g".
19
+ #
20
+ # ES_MIN_MEM -- The minimum number of memory to allocate.
21
+ # ES_MAX_MEM -- The maximum number of memory to allocate.
22
+ #
23
+ # As a convenience, a fragment of shell is sourced in order to set one or
24
+ # more of these variables. This so-called `include' can be placed in a
25
+ # number of locations and will be searched for in order. The lowest
26
+ # priority search path is the same directory as the startup script, and
27
+ # since this is the location of the sample in the project tree, it should
28
+ # almost work Out Of The Box.
29
+ #
30
+ # Any serious use-case though will likely require customization of the
31
+ # include. For production installations, it is recommended that you copy
32
+ # the sample to one of /usr/share/elasticsearch/elasticsearch.in.sh,
33
+ # /usr/local/share/elasticsearch/elasticsearch.in.sh, or
34
+ # /opt/elasticsearch/elasticsearch.in.sh and make your modifications there.
35
+ #
36
+ # Another option is to specify the full path to the include file in the
37
+ # environment. For example:
38
+ #
39
+ # $ ES_INCLUDE=/path/to/in.sh elasticsearch -p /var/run/es.pid
40
+ #
41
+ # Note: This is particularly handy for running multiple instances on a
42
+ # single installation, or for quick tests.
43
+ #
44
+ # If you would rather configure startup entirely from the environment, you
45
+ # can disable the include by exporting an empty ES_INCLUDE, or by
46
+ # ensuring that no include files exist in the aforementioned search list.
47
+ # Be aware that you will be entirely responsible for populating the needed
48
+ # environment variables.
49
+
50
+ CDPATH=""
51
+ SCRIPT="$0"
52
+
53
+ # SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
54
+ while [ -h "$SCRIPT" ] ; do
55
+ ls=`ls -ld "$SCRIPT"`
56
+ # Drop everything prior to ->
57
+ link=`expr "$ls" : '.*-> \(.*\)$'`
58
+ if expr "$link" : '/.*' > /dev/null; then
59
+ SCRIPT="$link"
60
+ else
61
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
62
+ fi
63
+ done
64
+
65
+ # determine elasticsearch home
66
+ ES_HOME=`dirname "$SCRIPT"`/..
67
+
68
+ # make ELASTICSEARCH_HOME absolute
69
+ ES_HOME=`cd "$ES_HOME"; pwd`
70
+
71
+
72
+ if [ -x "$JAVA_HOME/bin/java" ]; then
73
+ JAVA=$JAVA_HOME/bin/java
74
+ else
75
+ JAVA=`which java`
76
+ fi
77
+
78
+ # If an include wasn't specified in the environment, then search for one...
79
+ if [ "x$ES_INCLUDE" = "x" ]; then
80
+ # Locations (in order) to use when searching for an include file.
81
+ for include in /usr/share/elasticsearch/elasticsearch.in.sh \
82
+ /usr/local/share/elasticsearch/elasticsearch.in.sh \
83
+ /opt/elasticsearch/elasticsearch.in.sh \
84
+ ~/.elasticsearch.in.sh \
85
+ `dirname "$0"`/elasticsearch.in.sh; do
86
+ if [ -r "$include" ]; then
87
+ . "$include"
88
+ break
89
+ fi
90
+ done
91
+ # ...otherwise, source the specified include.
92
+ elif [ -r "$ES_INCLUDE" ]; then
93
+ . "$ES_INCLUDE"
94
+ fi
95
+
96
+ if [ -z "$ES_CLASSPATH" ]; then
97
+ echo "You must set the ES_CLASSPATH var" >&2
98
+ exit 1
99
+ fi
100
+
101
+ # Special-case path variables.
102
+ case `uname` in
103
+ CYGWIN*)
104
+ ES_CLASSPATH=`cygpath -p -w "$ES_CLASSPATH"`
105
+ ES_HOME=`cygpath -p -w "$ES_HOME"`
106
+ ;;
107
+ esac
108
+
109
+ launch_service()
110
+ {
111
+ pidpath=$1
112
+ foreground=$2
113
+ props=$3
114
+ es_parms="-Delasticsearch -Des.path.home=$ES_HOME"
115
+
116
+ if [ "x$pidpath" != "x" ]; then
117
+ es_parms="$es_parms -Des-pidfile=$pidpath"
118
+ fi
119
+
120
+ # The es-daemon option will tell ElasticSearch to close stdout/stderr,
121
+ # but it's up to us not to background.
122
+ if [ "x$foreground" != "x" ]; then
123
+ es_parms="$es_parms -Des-foreground=yes"
124
+ exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS $es_parms -cp $ES_CLASSPATH $props \
125
+ org.elasticsearch.bootstrap.ElasticSearch
126
+ else
127
+ # Startup ElasticSearch, background it, and write the pid.
128
+ exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS $es_parms -cp $ES_CLASSPATH $props \
129
+ org.elasticsearch.bootstrap.ElasticSearch <&- &
130
+ [ ! -z "$pidpath" ] && printf '%d' $! > "$pidpath"
131
+ fi
132
+
133
+ return $?
134
+ }
135
+
136
+ # Parse any command line options.
137
+ args=`getopt vfhp:D:X: "$@"`
138
+ eval set -- "$args"
139
+
140
+ while true; do
141
+ case $1 in
142
+ -v)
143
+ "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS $es_parms -cp $ES_CLASSPATH $props \
144
+ org.elasticsearch.Version
145
+ exit 0
146
+ ;;
147
+ -p)
148
+ pidfile="$2"
149
+ shift 2
150
+ ;;
151
+ -f)
152
+ foreground="yes"
153
+ shift
154
+ ;;
155
+ -h)
156
+ echo "Usage: $0 [-f] [-h] [-p pidfile]"
157
+ exit 0
158
+ ;;
159
+ -D)
160
+ properties="$properties -D$2"
161
+ shift 2
162
+ ;;
163
+ -X)
164
+ properties="$properties -X$2"
165
+ shift 2
166
+ ;;
167
+ --)
168
+ shift
169
+ break
170
+ ;;
171
+ *)
172
+ echo "Error parsing arguments!" >&2
173
+ exit 1
174
+ ;;
175
+ esac
176
+ done
177
+
178
+ # Start up the service
179
+ launch_service "$pidfile" "$foreground" "$properties"
180
+
181
+ exit $?
@@ -0,0 +1,47 @@
1
+ ES_CLASSPATH=$ES_CLASSPATH:$ES_HOME/lib/*:$ES_HOME/lib/sigar/*
2
+
3
+ if [ "x$ES_MIN_MEM" = "x" ]; then
4
+ ES_MIN_MEM=256m
5
+ fi
6
+ if [ "x$ES_MAX_MEM" = "x" ]; then
7
+ ES_MAX_MEM=1g
8
+ fi
9
+
10
+ # min and max heap sizes should be set to the same value to avoid
11
+ # stop-the-world GC pauses during resize, and so that we can lock the
12
+ # heap in memory on startup to prevent any of it from being swapped
13
+ # out.
14
+ JAVA_OPTS="$JAVA_OPTS -Xms${ES_MIN_MEM}"
15
+ JAVA_OPTS="$JAVA_OPTS -Xmx${ES_MAX_MEM}"
16
+
17
+ # reduce the per-thread stack size
18
+ JAVA_OPTS="$JAVA_OPTS -Xss128k"
19
+
20
+ # Force the JVM to use IPv4 stack
21
+ # JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
22
+
23
+ # Enable aggressive optimizations in the JVM
24
+ # - Disabled by default as it might cause the JVM to crash
25
+ # JAVA_OPTS="$JAVA_OPTS -XX:+AggressiveOpts"
26
+
27
+ JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
28
+ JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
29
+ JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled"
30
+ JAVA_OPTS="$JAVA_OPTS -XX:SurvivorRatio=8"
31
+ JAVA_OPTS="$JAVA_OPTS -XX:MaxTenuringThreshold=1"
32
+ JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75"
33
+ JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
34
+
35
+ # GC logging options -- uncomment to enable
36
+ # JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails"
37
+ # JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps"
38
+ # JAVA_OPTS="$JAVA_OPTS -XX:+PrintClassHistogram"
39
+ # JAVA_OPTS="$JAVA_OPTS -XX:+PrintTenuringDistribution"
40
+ # JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCApplicationStoppedTime"
41
+ # JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/elasticsearch/gc.log"
42
+
43
+ # Causes the JVM to dump its heap on OutOfMemory.
44
+ JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
45
+ # The path to the heap dump location, note directory must exists and have enough
46
+ # space for a full heap dump.
47
+ #JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof"