diff options
author | Daniel Romero <infoslack@gmail.com> | 2014-01-21 23:34:58 +0700 |
---|---|---|
committer | Erik Hanson <erik@slackbuilds.org> | 2014-01-29 23:21:10 -0600 |
commit | 2554c2c42c4c7a3bac4f114049a7eb3a8b97c3dc (patch) | |
tree | 68460cf313a3a9f3405db3384aea6a78f237224b /system/elasticsearch | |
parent | 86aa649653ef483e21648f7ea7ab52f1b39d2f33 (diff) | |
download | slackbuilds-2554c2c42c4c7a3bac4f114049a7eb3a8b97c3dc.tar.gz |
system/elasticsearch: Added (distributed RESTful search engine).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/elasticsearch')
-rw-r--r-- | system/elasticsearch/README | 42 | ||||
-rw-r--r-- | system/elasticsearch/default/elasticsearch | 38 | ||||
-rw-r--r-- | system/elasticsearch/doinst.sh | 12 | ||||
-rw-r--r-- | system/elasticsearch/elasticsearch.SlackBuild | 124 | ||||
-rw-r--r-- | system/elasticsearch/elasticsearch.info | 10 | ||||
-rw-r--r-- | system/elasticsearch/rc.elasticsearch | 77 | ||||
-rw-r--r-- | system/elasticsearch/slack-desc | 19 |
7 files changed, 322 insertions, 0 deletions
diff --git a/system/elasticsearch/README b/system/elasticsearch/README new file mode 100644 index 0000000000..4bddb37716 --- /dev/null +++ b/system/elasticsearch/README @@ -0,0 +1,42 @@ +ElasticSearch + +A Distributed RESTful Search Engine +http://www.elasticsearch.org + +ElasticSearch is a distributed RESTful search engine built for the cloud. + +Features include: + +Distributed and Highly Available Search Engine. + Each index is fully sharded with a configurable number of shards. + Each shard can have one or more replicas. + Read / Search operations performed on either one of the replica shard. + +Multi Tenant with Multi Types. + Support for more than one index. + Support for more than one type per index. + Index level configuration (number of shards, index storage, …). + +Various set of APIs + HTTP RESTful API + Native Java API. + All APIs perform automatic node operation rerouting. + +Document oriented + No need for upfront schema definition. + Schema can be defined per type for customization of the indexing process. + +Reliable, Asynchronous Write Behind for long term persistency. +(Near) Real Time Search. + +Built on top of Lucene + Each shard is a fully functional Lucene index + All the power of Lucene easily exposed through simple configuration / plugins + +Per operation consistency + Single document level operations are atomic, consistent, isolated and durable + +This script requires a 'elasticsearch' user/group to exist before running. +The recommended UID/GID is 280. You can create these like so: +groupadd -g 280 elasticsearch +useradd -u 280 -g elasticsearch -s /bin/sh elasticsearch diff --git a/system/elasticsearch/default/elasticsearch b/system/elasticsearch/default/elasticsearch new file mode 100644 index 0000000000..0b837dca26 --- /dev/null +++ b/system/elasticsearch/default/elasticsearch @@ -0,0 +1,38 @@ +# Run ElasticSearch as this user ID and group ID +#ES_USER=elasticsearch +#ES_GROUP=elasticsearch + +# Heap Size (defaults to 256m min, 1g max) +#ES_HEAP_SIZE=2g + +# Heap new generation +#ES_HEAP_NEWSIZE= + +# max direct memory +#ES_DIRECT_SIZE= + +# Maximum number of open files, defaults to 65535. +#MAX_OPEN_FILES=65535 + +# Maximum locked memory size. Set to "unlimited" if you use the +# bootstrap.mlockall option in elasticsearch.yml. You must also set +# ES_HEAP_SIZE. +#MAX_LOCKED_MEMORY=unlimited + +# ElasticSearch log directory +#LOG_DIR=/var/log/elasticsearch + +# ElasticSearch data directory +#DATA_DIR=/var/lib/elasticsearch + +# ElasticSearch work directory +#WORK_DIR=/tmp/elasticsearch + +# ElasticSearch configuration directory +#CONF_DIR=/etc/elasticsearch + +# ElasticSearch configuration file (elasticsearch.yml) +#CONF_FILE=/etc/elasticsearch/elasticsearch.yml + +# Additional Java OPTS +#ES_JAVA_OPTS= diff --git a/system/elasticsearch/doinst.sh b/system/elasticsearch/doinst.sh new file mode 100644 index 0000000000..94745093e2 --- /dev/null +++ b/system/elasticsearch/doinst.sh @@ -0,0 +1,12 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + rm $NEW + fi +} + +config etc/rc.d/rc.elasticsearch.new diff --git a/system/elasticsearch/elasticsearch.SlackBuild b/system/elasticsearch/elasticsearch.SlackBuild new file mode 100644 index 0000000000..57140d82f5 --- /dev/null +++ b/system/elasticsearch/elasticsearch.SlackBuild @@ -0,0 +1,124 @@ +#!/bin/sh + +# Slackware build script for ElasticSearch + +# Copyright 2014 Daniel Romero <infoslack@gmail.com>, Fortaleza, CE, BRA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=elasticsearch +VERSION=${VERSION:-0.90.10} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +ES_USER=${ES_USER:-elasticsearch} +ES_UID=${ES_UID:-280} +ES_GROUP=${ES_GROUP:-elasticsearch} +ES_GID=${ES_GID:-280} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +bailout() { + printf "\n You must have a \"elasticsearch\" user and group in order to run this script. + Add them with something like this: + groupadd -g $ES_GID $ES_GROUP + useradd -u $ES_UID -g $ES_GROUP -s /bin/sh $ES_USER\n" + exit 1 +} + +# Check for elasticsearch user and group availability +if ! getent group elasticsearch 2>&1 > /dev/null; then + bailout ; +elif ! getent passwd elasticsearch 2>&1 > /dev/null; then + bailout ; +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION + +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE* NOTICE* README* $PKG/usr/doc/$PRGNAM-$VERSION + +mkdir -p $PKG/usr/share/$PRGNAM/bin +cp bin/* $PKG/usr/share/$PRGNAM/bin + +mkdir -p $PKG/usr/share/$PRGNAM/lib +cp -r lib/* $PKG/usr/share/$PRGNAM/lib + +mkdir -p $PKG/etc/$PRGNAM +cp config/* $PKG/etc/$PRGNAM + +chown -R $ES_USER:$ES_GROUP $PKG/etc/$PRGNAM $PKG/usr/share/$PRGNAM + +mkdir -p $PKG/etc/default +cat $CWD/default/$PRGNAM > $PKG/etc/default/$PRGNAM + +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.elasticsearch > $PKG/etc/rc.d/rc.elasticsearch.new + +# Default directories creation +mkdir -p $PKG/var/log/$PRGNAM +mkdir -p $PKG/var/lib/$PRGNAM/data +chown -R $ES_USER:$ES_GROUP $PKG/var/log/$PRGNAM $PKG/var/lib/$PRGNAM $PKG/var/lib/$PRGNAM/data +chmod 0700 -R $PKG/var/lib/$PRGNAM + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/elasticsearch/elasticsearch.info b/system/elasticsearch/elasticsearch.info new file mode 100644 index 0000000000..e53eca045e --- /dev/null +++ b/system/elasticsearch/elasticsearch.info @@ -0,0 +1,10 @@ +PRGNAM="elasticsearch" +VERSION="0.90.10" +HOMEPAGE="http://www.elasticsearch.org" +DOWNLOAD="https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.10.tar.gz" +MD5SUM="a74bbc6f751ef891c0d3f408dad346cb" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="jdk" +MAINTAINER="Daniel Romero" +EMAIL="infoslack@gmail.com" diff --git a/system/elasticsearch/rc.elasticsearch b/system/elasticsearch/rc.elasticsearch new file mode 100644 index 0000000000..756f58acc0 --- /dev/null +++ b/system/elasticsearch/rc.elasticsearch @@ -0,0 +1,77 @@ +#!/bin/sh +# +# /etc/rc.d/rc.elasticsearch -- startup script Slackware Linux for Elasticsearch +# +# Written by Daniel Romero <infoslack@gmail.com>. +# +# This script requires a 'elasticsearch' user/group to exist before running. +# The recommended UID/GID is 280. You can create these like so: +# groupadd -g 280 elasticsearch +# useradd -u 280 -g elasticsearch -s /bin/sh elasticsearch + +set -e + +# set params +PATH=/bin:/usr/bin:/sbin:/usr/sbin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin +NAME=elasticsearch +DEFAULT=/etc/default/$NAME +ES_HOME=/usr/share/$NAME +ES_USER=$NAME +ES_GROUP=$NAME +LOG_DIR=/var/log/$NAME +DATA_DIR=/var/lib/$NAME +WORK_DIR=$DATA_DIR/data +CONF_DIR=/etc/$NAME +CONF_FILE=$CONF_DIR/elasticsearch.yml +PID_FILE=/var/run/$NAME.pid +DAEMON=$ES_HOME/bin/$NAME +MAX_OPEN_FILES=65535 +DAEMON_OPTS="-p $PID_FILE -Des.default.config=$CONF_FILE -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.work=$WORK_DIR -Des.default.path.conf=$CONF_DIR" + +# overwrite settings from default file +if [ -f "$DEFAULT" ]; then + . "$DEFAULT" +fi + +# Check DAEMON exists +test -x $DAEMON || exit 0 + +case "$1" in + start) + echo "Starting $NAME" + touch "$PID_FILE" && chown "$ES_USER":"$ES_GROUP" "$PID_FILE" + sudo -u $ES_USER sh -c "$DAEMON $DAEMON_OPTS" + ;; + + stop) + if [ -f "$PID_FILE" ]; then + `cat $PID_FILE | xargs kill -9` + if [ $? -eq 1 ]; then + echo "$DESC is not running but pid file exists, cleaning up" + elif [ $? -eq 3 ]; then + PID="`cat $PID_FILE`" + echo "Failed to stop $NAME (pid $PID)" + exit 1 + fi + rm -f "$PID_FILE" + else + echo "(not running)" + fi + echo "Stop $NAME" + ;; + + restart) + if [ -f "$PID_FILE" ]; then + $0 stop + sleep 1 + fi + $0 start + ;; + + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; + +esac +exit 0 diff --git a/system/elasticsearch/slack-desc b/system/elasticsearch/slack-desc new file mode 100644 index 0000000000..0f854ac588 --- /dev/null +++ b/system/elasticsearch/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler-----------------------------------------------| +elasticsearch: elasticsearch (distributed RESTful search engine) +elasticsearch: +elasticsearch: ElasticSearch is a distributed RESTful search engine built for +elasticsearch: the cloud. +elasticsearch: +elasticsearch: Project Site: http://www.elasticsearch.org +elasticsearch: +elasticsearch: +elasticsearch: +elasticsearch: +elasticsearch: |