]> git.pld-linux.org Git - packages/cassandra-bin.git/commitdiff
- Initial. NFY. Needs some polishing.
authorMateusz Korniak <matkor@pld-linux.org>
Tue, 28 Dec 2010 15:40:36 +0000 (15:40 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    cassandra-bin.spec -> 1.1
    cassandra.in.sh -> 1.1
    cassandra.init -> 1.1

cassandra-bin.spec [new file with mode: 0644]
cassandra.in.sh [new file with mode: 0644]
cassandra.init [new file with mode: 0644]

diff --git a/cassandra-bin.spec b/cassandra-bin.spec
new file mode 100644 (file)
index 0000000..f7548a8
--- /dev/null
@@ -0,0 +1,124 @@
+%include       /usr/lib/rpm/macros.java
+# TODO: Fix .init  cassandra status does not work now.
+
+Summary:       Cassandra database binary package.
+Summary(pl.UTF-8):     Baza danych Cassandra wersja binarna
+Name:          cassandra-bin
+%define     shname cassandra
+Version:       0.7.0
+%define     rccode rc3
+Release:       0.%{rccode}.0.1
+License:       ASF
+Group:         Applications/Databases
+Source0:       http://mirror.nyi.net/apache//cassandra/%{version}/apache-cassandra-%{version}-%{rccode}-bin.tar.gz
+# Source0-md5: 8e5cfc07178cd57e05ef81cad18ef170
+Source1:    cassandra.in.sh
+Source2:    %{shname}.init
+URL:           http://cassandra.apache.org/
+BuildRequires: rpm-javaprov
+BuildRequires: rpmbuild(macros) >= 1.300
+BuildArch:     noarch
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Cassandra brings together the distributed systems technologies from Dynamo
+and the data model from Google's BigTable. Like Dynamo, Cassandra is
+eventually consistent. Like BigTable, Cassandra provides a ColumnFamily-based
+data model richer than typical key/value systems.
+
+%description -l pl.UTF-8
+TODO
+
+%prep
+%setup -q -n apache-cassandra-%{version}-%{rccode}
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_javadir}
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{shname}/
+mkdir -p $RPM_BUILD_ROOT/usr/share/%{shname}
+# /usr/share/%{shname}/conf -> /etc/%{shname}/ - We do not want that , lets be ale to use many instances of cassandra like we do with postgresql
+# TODO: /usr/share/%{shname}/conf -> /var/lib/cassandra/conf
+# TODO: root:cassandra conf/*
+# mkdir -p $RPM_BUILD_ROOT/usr/share/%{shname}/conf
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d/
+cp -p %{SOURCE1}  $RPM_BUILD_ROOT/usr/share/%{shname}
+# cp -p contrib/redhat/%{name} $RPM_BUILD_ROOT/etc/rc.d/init.d/
+cp -p lib/*.jar $RPM_BUILD_ROOT/usr/share/%{shname}
+mkdir -p $RPM_BUILD_ROOT/usr/sbin
+cp -p bin/cassandra $RPM_BUILD_ROOT/usr/sbin
+mkdir -p $RPM_BUILD_ROOT/usr/bin
+cp -p bin/cassandra-cli $RPM_BUILD_ROOT/usr/bin
+cp -p bin/nodetool $RPM_BUILD_ROOT/usr/bin
+cp -p bin/clustertool $RPM_BUILD_ROOT/usr/bin
+cp -p bin/json2sstable $RPM_BUILD_ROOT/usr/bin
+cp -p bin/sstable2json $RPM_BUILD_ROOT/usr/bin
+cp -p bin/schematool $RPM_BUILD_ROOT/usr/bin
+cp -p bin/config-converter $RPM_BUILD_ROOT/usr/bin
+cp -p bin/sstablekeys $RPM_BUILD_ROOT/usr/bin
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/cassandra
+mkdir -p $RPM_BUILD_ROOT/var/lib/%{shname}/commitlog
+mkdir -p $RPM_BUILD_ROOT/var/lib/%{shname}/data
+mkdir -p $RPM_BUILD_ROOT/var/lib/%{shname}/saved_caches
+mkdir -p $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/log4j-server.properties $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/cassandra.yaml $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/cassandra-env.sh $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/access.properties $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/passwd.properties $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/cassandra-topology.properties $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+cp -p conf/README.txt $RPM_BUILD_ROOT/var/lib/%{shname}/conf
+mkdir -p $RPM_BUILD_ROOT/var/run/%{shname}
+mkdir -p $RPM_BUILD_ROOT/var/log/%{shname}
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+# TODO:
+%groupadd -g 259 -r cassandra
+%useradd -M -o -r -u 259 -d /var/lib/%{shname} -s /bin/sh -g cassandra -c "Cassandra Server" cassandra
+
+# TODO:
+%preun
+if [ "$1" = "0" ]; then
+    %service cassandra stop
+    /sbin/chkconfig --del cassandra
+fi
+
+# %post upstart
+# %upstart_post cassandra
+
+# %postun upstart
+# %upstart_postun cassandra
+
+
+
+%files
+%defattr(644,root,root,755)
+%doc CHANGES.txt LICENSE.txt README.txt NEWS.txt NOTICE.txt
+%attr(754,root,root) /etc/rc.d/init.d/cassandra
+%attr(755,root,root) %{_bindir}/cassandra-cli
+%attr(755,root,root) %{_bindir}/nodetool
+%attr(755,root,root) %{_bindir}/clustertool
+%attr(755,root,root) %{_bindir}/json2sstable
+%attr(755,root,root) %{_bindir}/sstable2json
+%attr(755,root,root) %{_bindir}/schematool
+%attr(755,root,root) %{_bindir}/config-converter
+%attr(755,root,root) %{_bindir}/sstablekeys
+%attr(755,root,root) %{_sbindir}/cassandra
+# %attr(755,root,root) /etc/rc.d/init.d/%{name}
+# %attr(754,root,root) /etc/rc.d/init.d/postgresql
+# %attr(755,root,root) 
+/usr/share/%{shname}
+%attr(750,cassandra,cassandra) %dir /var/lib/%{shname}
+%attr(750,root,cassandra) %dir /var/lib/%{shname}/conf
+%attr(640,root,cassandra) /var/lib/%{shname}/conf/*.yaml
+%attr(640,root,cassandra) /var/lib/%{shname}/conf/*.txt
+%attr(640,root,cassandra) /var/lib/%{shname}/conf/*.properties
+%attr(755,root,cassandra) /var/lib/%{shname}/conf/*.sh
+%attr(750,cassandra,cassandra) %dir /var/run/%{shname}
+%attr(750,cassandra,cassandra) %dir /var/log/%{shname}
diff --git a/cassandra.in.sh b/cassandra.in.sh
new file mode 100644 (file)
index 0000000..109328c
--- /dev/null
@@ -0,0 +1,54 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# File modified for PLD Linux.
+# Sets minimal configs necessary to run cassandra and cassandra CLI from 
+# /usr/share/cassandra/*.jar
+# Should easily allow to run multibple cassandra instaces by only providing
+# $CASSANDRA_HOME
+
+if [ "x$CASSANDRA_HOME" = "x" ]; then
+    CASSANDRA_HOME=/var/lib/cassandra
+fi
+
+# The directory where Cassandra's configs live (required)
+if [ "x$CASSANDRA_CONF" = "x" ]; then
+    CASSANDRA_CONF=$CASSANDRA_HOME/conf
+fi
+
+# This can be the path to a jar file, or a directory containing the 
+# compiled classes. NOTE: This isn't needed by the startup script,
+# it's just used here in constructing the classpath.
+# cassandra_bin=$CASSANDRA_HOME/build/classes
+# cassandra_bin=/usr/share/cassandra
+
+# JAVA_HOME can optionally be set here
+#JAVA_HOME=/usr/local/jdk6
+
+# The java classpath (required)
+CLASSPATH=$CASSANDRA_CONF # :$cassandra_bin
+
+# for jar in $CASSANDRA_HOME/lib/*.jar; do
+#    CLASSPATH=$CLASSPATH:$jar
+# done
+
+
+# for jar in /usr/share/cassandra/*.jar; do
+#     CLASSPATH=$CLASSPATH:$jar
+# done
+CLASSPATH=$CLASSPATH:/usr/share/cassandra/*
+print "DEBUG: CLASSPATH: $CLASSPATH"
+
diff --git a/cassandra.init b/cassandra.init
new file mode 100644 (file)
index 0000000..2bcf28f
--- /dev/null
@@ -0,0 +1,95 @@
+#!/bin/sh
+#
+# glusterfsd   Cassandra 
+#
+# chkconfig:   345 14 89
+#
+# description: Cassandra database node
+#
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+
+# Get service config - may override defaults
+# [ -f /etc/sysconfig/cassandra ] && . /etc/sysconfig/cassandra
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down cassandra
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+test -x /usr/sbin/cassandra  || exit 0
+
+start() {
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/cassandra ]; then
+               msg_starting cassandra
+               daemon /usr/sbin/cassandra  -p /var/run/cassandra.pid  
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cassandra
+       else
+               msg_already_running cassandra
+       fi
+}
+
+
+stop() {
+       if [ -f /var/lock/subsys/cassandra ]; then
+               # Stop daemons.
+               msg_stopping cassandra
+               killproc --pidfile /var/run/cassandra.pid cassandra -TERM
+               rm -f /var/lock/subsys/cassandra
+       else
+               msg_not_running cassandra
+       fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/cassandra ]; then
+               stop
+               start
+       else
+               msg_not_running cassandra
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
+  status) 
+       # Does not work with /usr/sbin/cassandra for some reason
+       status cassandra
+       ;;
+  *)
+       # msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload}"
+       exit 3
+esac
+
+exit $RETVAL
This page took 0.099638 seconds and 4 git commands to generate.