]> git.pld-linux.org Git - packages/cassandra-bin.git/commitdiff
- Version 3.0.12
authorMateusz Korniak <matkor@pld-linux.org>
Mon, 13 Mar 2017 09:33:18 +0000 (10:33 +0100)
committerMateusz Korniak <matkor@pld-linux.org>
Mon, 13 Mar 2017 09:33:18 +0000 (10:33 +0100)
- systemd required now, systemd service replaces broken SysV init

cassandra-bin-cqlsh_path_fix.patch [deleted file]
cassandra-bin-pld-env.patch [new file with mode: 0644]
cassandra-bin-pld_logging.patch [deleted file]
cassandra-bin.spec
cassandra.service [new file with mode: 0644]

diff --git a/cassandra-bin-cqlsh_path_fix.patch b/cassandra-bin-cqlsh_path_fix.patch
deleted file mode 100644 (file)
index 991cf3d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./bin/cqlsh.patch_fix      2014-10-21 16:31:37.000000000 +0200
-+++ ./bin/cqlsh        2015-01-12 23:25:27.805713525 +0100
-@@ -74,7 +74,7 @@ CASSANDRA_PATH = os.path.join(os.path.di
- ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')]
- myplatform = platform.system()
- if myplatform == 'Linux':
--    ZIPLIB_DIRS.append('/usr/share/cassandra/lib')
-+    ZIPLIB_DIRS.append('/usr/share/cassandra')
- if os.environ.get('CQLSH_NO_BUNDLED', ''):
-     ZIPLIB_DIRS = ()
diff --git a/cassandra-bin-pld-env.patch b/cassandra-bin-pld-env.patch
new file mode 100644 (file)
index 0000000..56aca29
--- /dev/null
@@ -0,0 +1,11 @@
+--- apache-cassandra-3.0.10/conf/cassandra-env.ps1.pld-env     2016-12-12 16:51:23.612423230 +0100
++++ apache-cassandra-3.0.10/conf/cassandra-env.ps1     2016-12-12 16:53:06.880817179 +0100
+@@ -311,7 +311,7 @@ Function SetCassandraEnvironment
+     $env:CASSANDRA_CONF = "$env:CASSANDRA_HOME\conf"\r
+     $env:CASSANDRA_PARAMS="-Dcassandra -Dlogback.configurationFile=logback.xml"\r
\r
+-    $logdir = "$env:CASSANDRA_HOME\logs"\r
++    $logdir = "/var/log/cassandra"\r
+     $storagedir = "$env:CASSANDRA_HOME\data"\r
+     $env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + " -Dcassandra.logdir=""$logdir"" -Dcassandra.storagedir=""$storagedir"""\r
\r
diff --git a/cassandra-bin-pld_logging.patch b/cassandra-bin-pld_logging.patch
deleted file mode 100644 (file)
index ca20182..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- apache-cassandra-2.1.11/conf/logback.xml.pld_logging       2015-10-21 16:21:19.880490844 +0200
-+++ apache-cassandra-2.1.11/conf/logback.xml   2015-10-21 16:22:17.896836142 +0200
-@@ -20,9 +20,9 @@
- <configuration scan="true">
-   <jmxConfigurator />
-   <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
--    <file>${cassandra.logdir}/system.log</file>
-+        <file>/var/log/cassandra/system.log</file>
-     <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
--      <fileNamePattern>${cassandra.logdir}/system.log.%i.zip</fileNamePattern>
-+          <fileNamePattern>/var/log/cassandra/system.log.%i.zip</fileNamePattern>
-       <minIndex>1</minIndex>
-       <maxIndex>20</maxIndex>
-     </rollingPolicy>
-@@ -49,5 +49,4 @@
-     <appender-ref ref="STDOUT" />
-   </root>
-   
--  <logger name="com.thinkaurelius.thrift" level="ERROR"/>
- </configuration>
index 6c7a6e09db9d75f4eecb362b1f7eaa204b877d4d..1437b4d1a29c197b2f51a7d533e4e9659a924144 100644 (file)
@@ -1,39 +1,37 @@
-# TODO: Fix .init cassandra status does not work now.
-# TODO: Fix .init stop routine it is now subset of PLD default one
 # TODO: Fix of data/ cassandra created dirs/files privilages (now they are all readable)
 # TODO: Consider adding
 #              cassandra       -       memlock unlimited
 #   to /etc/security/limits.conf ?
 # TODO: C java-jna is only valid with openjdk8-jre ?
-#   cassandra running java from openjdk8-jre-8u66.b02-2.x86_64  fails with  java-jna-4.2.1-1.x86_64 but without clamis JNA to work in logs 
+#   cassandra running java from openjdk8-jre-8u66.b02-2.x86_64  fails with  java-jna-4.2.1-1.x86_64 but without clamis JNA to work in logs
 
 %define        shname cassandra
 %include       /usr/lib/rpm/macros.java
 Summary:       Cassandra database binary package
 Summary(pl.UTF-8):     Binarna redystrybucja bazy danych Cassandra
 Name:          cassandra-bin
-Version:       2.1.16
-Release:       1
+Version:       3.0.12
+Release:       0.1
 License:       ASF
 Group:         Applications/Databases
 Source0:       ftp://ftp.task.gda.pl/pub/www/apache/dist/cassandra/%{version}/apache-cassandra-%{version}-bin.tar.gz
-# Source0-md5: cc11eadd767e0200d412b7a0bde6a9f5
+# Source0-md5: 71ebbfdae273a59ca202c4019e1f74a7
 Source1:       cassandra.in.sh
-Source2:       %{shname}.init
 Source3:       %{name}.tmpfiles
+Source4:       %{shname}.service
 Patch0:                %{name}-jamm_path_fix.patch
-Patch1:                %{name}-cqlsh_path_fix.patch
-Patch2:                %{name}-pld_logging.patch
+Patch3:                %{name}-pld-env.patch
+
 URL:           http://cassandra.apache.org/
 BuildRequires: python-distribute
 BuildRequires: rpm-javaprov
 BuildRequires: rpm-pythonprov
 BuildRequires: rpmbuild(macros) >= 1.710
-Requires(post,preun):  /sbin/chkconfig
+Requires(post,preun,postun):   systemd-units >= 38
+Requires:      jre >= 1.7
 Requires:      python
 Requires:      python-modules
-Requires:      rc-scripts
-Requires:      jre >= 1.7 
+Requires:      systemd-units >= 0.38
 Conflicts:     java-jna
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -52,8 +50,9 @@ oparty na ColumnFamily, bogatszy niż typowe systemy klucza i wartości.
 %prep
 %setup -q -n apache-cassandra-%{version}
 %patch0 -p1
-%patch1 -p1
-%patch2 -p1
+%patch3 -p1
+# Fix logging dir
+%{__sed} -i -e 's#$CASSANDRA_HOME/logs#/var/log/cassandra#g' bin/cassandra
 
 %build
 # current version of cqlsh supports only python 2.
@@ -63,22 +62,21 @@ cd ..
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d/,%{_sysconfdir}/%{shname},%{_bindir},%{_sbindir},%{_datadir}/%{shname}} \
+install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{shname},%{_bindir},%{_sbindir},%{_datadir}/%{shname}} \
        $RPM_BUILD_ROOT/var/{lib/%{shname}/{commitlog,conf,data,saved_caches},{log,run}/%{shname}} \
-       $RPM_BUILD_ROOT%{systemdtmpfilesdir}
+       $RPM_BUILD_ROOT%{systemdtmpfilesdir} $RPM_BUILD_ROOT/%{systemdunitdir}
 
-cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/cassandra
+cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/%{shname}.service
 
 rm bin/*.bat
-cp -p bin/{cqlsh,*sstable*,*tool,cassandra-cli} $RPM_BUILD_ROOT%{_bindir}
+cp -p bin/{cqlsh*,*sstable*,*tool} $RPM_BUILD_ROOT%{_bindir}
 cp -p bin/cassandra $RPM_BUILD_ROOT%{_sbindir}
 cp -p %{SOURCE1} lib/*.jar $RPM_BUILD_ROOT%{_datadir}/%{shname}
 # use bundled libs for python-cql - from cqlsh doc
 # cp -p %{SOURCE1} lib/cql-internal-only-1.4.2.zip $RPM_BUILD_ROOT%{_datadir}/%{shname}
 # cp -p %{SOURCE1} lib/thrift-python-internal-only-0.9.1.zip $RPM_BUILD_ROOT%{_datadir}/%{shname}
 cp -p %{SOURCE1} lib/*.zip $RPM_BUILD_ROOT%{_datadir}/%{shname}
-cp -p conf/{*.properties,*.yaml,*.xml,cassandra-env.sh,hotspot_compiler,README.txt} $RPM_BUILD_ROOT/var/lib/%{shname}/conf
-# ,triggers
+cp -p conf/{*.properties,*.yaml,*.xml,cassandra-env.sh,hotspot_compiler,jvm.options,README.txt} $RPM_BUILD_ROOT/var/lib/%{shname}/conf
 install -d $RPM_BUILD_ROOT/var/lib/%{shname}/conf/triggers
 cp -p conf/triggers/*.txt  $RPM_BUILD_ROOT/var/lib/%{shname}/conf/triggers
 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{shname}.conf
@@ -95,37 +93,39 @@ rm -rf $RPM_BUILD_ROOT
 %useradd -M -o -r -u 259 -d /var/lib/%{shname} -s /bin/sh -g cassandra -c "Cassandra Server" cassandra
 
 %post
-/sbin/chkconfig --add cassandra
-%service cassandra restart
+%systemd_post %{shname}.service
 
 %preun
+%systemd_preun %{shname}.service
+
+%postun
+%systemd_reload
 if [ "$1" = "0" ]; then
-       %service cassandra stop
-       /sbin/chkconfig --del cassandra
+       %userremove %{shname}
+       %groupremove %{shname}
 fi
 
 %files
 %defattr(644,root,root,755)
 %doc CHANGES.txt LICENSE.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}/cqlsh
+%{_bindir}/cqlsh.py
 %attr(755,root,root) %{_bindir}/nodetool
-# %attr(755,root,root) %{_bindir}/json2sstable
-## %attr(755,root,root) %{_bindir}/sstable2json
 %attr(755,root,root) %{_bindir}/sstablescrub
-%attr(755,root,root) %{_bindir}/sstablekeys
 %attr(755,root,root) %{_bindir}/sstableloader
-## %attr(755,root,root) %{_bindir}/sstablesplit
 %attr(755,root,root) %{_bindir}/sstableupgrade
+%attr(755,root,root) %{_bindir}/sstableutil
+%attr(755,root,root) %{_bindir}/sstableverify
 %attr(755,root,root) %{_sbindir}/cassandra
 %{_datadir}/%{shname}
+%{systemdunitdir}/%{shname}.service
 %{systemdtmpfilesdir}/%{shname}.conf
 %attr(750,cassandra,cassandra) %dir /var/lib/%{shname}
 %attr(750,root,cassandra) %dir /var/lib/%{shname}/conf
 %attr(640,root,cassandra) %config(noreplace) %verify(not md5 mtime size) /var/lib/%{shname}/conf/*.properties
 %attr(755,root,cassandra) %config(noreplace) %verify(not md5 mtime size) /var/lib/%{shname}/conf/*.sh
 %attr(640,root,cassandra) /var/lib/%{shname}/conf/*.txt
+%attr(640,root,cassandra) /var/lib/%{shname}/conf/jvm.options
 %attr(640,root,cassandra) %config(noreplace) %verify(not md5 mtime size) /var/lib/%{shname}/conf/*.yaml
 %attr(640,root,cassandra) %config(noreplace) %verify(not md5 mtime size) /var/lib/%{shname}/conf/*.xml
 %attr(640,root,cassandra) %config(noreplace) %verify(not md5 mtime size) /var/lib/%{shname}/conf/hotspot_compiler
diff --git a/cassandra.service b/cassandra.service
new file mode 100644 (file)
index 0000000..54b8871
--- /dev/null
@@ -0,0 +1,30 @@
+[Unit]
+Description=Cassandra node
+After=network.target
+
+[Service]
+User=cassandra
+Group=cassandra
+
+Type=forking
+PIDFile=/var/run/cassandra/cassandra.pid
+ExecStart=/usr/sbin/cassandra -p /var/run/cassandra/cassandra.pid 
+
+ExecStop=/usr/bin/nodetool flush
+ExecStop=/usr/bin/nodetool drain
+SuccessExitStatus=143
+
+StandardOutput=journal
+StandardError=journal
+LimitNOFILE=100000
+LimitMEMLOCK=infinity
+LimitNPROC=32768
+LimitAS=infinity
+
+RestartSec=10s
+
+# Restarts on abnormal termination
+Restart=on-abort
+
+[Install]
+WantedBy=default.target
\ No newline at end of file
This page took 0.05899 seconds and 4 git commands to generate.