mirror of https://github.com/apache/cassandra
Use $CASSANDRA_HOME for default paths instead of /var
Patch by Tyler Hobbs; reviewed by Brandon Williams and Joshua McKenzie for CASSANDRA-7136
This commit is contained in:
parent
4722fe70aa
commit
60be74230e
|
|
@ -6,6 +6,7 @@
|
||||||
* Reduce run time for CQL tests (CASSANDRA-7327)
|
* Reduce run time for CQL tests (CASSANDRA-7327)
|
||||||
* Fix heap size calculation on Windows (CASSANDRA-7352)
|
* Fix heap size calculation on Windows (CASSANDRA-7352)
|
||||||
* RefCount native frames from netty (CASSANDRA-7245)
|
* RefCount native frames from netty (CASSANDRA-7245)
|
||||||
|
* Use tarball dir instead of /var for default paths (CASSANDRA-7136)
|
||||||
Merged from 2.0:
|
Merged from 2.0:
|
||||||
* Add per-CF range read request latency metrics (CASSANDRA-7338)
|
* Add per-CF range read request latency metrics (CASSANDRA-7338)
|
||||||
* Fix NPE in StreamTransferTask.createMessageForRetry() (CASSANDRA-7323)
|
* Fix NPE in StreamTransferTask.createMessageForRetry() (CASSANDRA-7323)
|
||||||
|
|
|
||||||
10
NEWS.txt
10
NEWS.txt
|
|
@ -18,6 +18,16 @@ using the provided 'sstableupgrade' tool.
|
||||||
|
|
||||||
New features
|
New features
|
||||||
------------
|
------------
|
||||||
|
- Default data and log locations have changed. If not set in
|
||||||
|
cassandra.yaml, the data file directory, commitlog directory,
|
||||||
|
and saved caches directory will default to $CASSANDRA_HOME/data/data,
|
||||||
|
$CASSANDRA_HOME/data/commitlog, and $CASSANDRA_HOME/data/saved_caches,
|
||||||
|
respectively. The log directory now defaults to $CASSANDRA_HOME/logs.
|
||||||
|
If not set, $CASSANDRA_HOME, defaults to the top-level directory of
|
||||||
|
the installation.
|
||||||
|
Note that this should only affect source checkouts and tarballs.
|
||||||
|
Deb and RPM packages will continue to use /var/lib/cassandra and
|
||||||
|
/var/log/cassandra in cassandra.yaml.
|
||||||
- SSTable data directory name is slightly changed. Each directory will
|
- SSTable data directory name is slightly changed. Each directory will
|
||||||
have hex string appended after CF name, e.g.
|
have hex string appended after CF name, e.g.
|
||||||
ks/cf-5be396077b811e3a3ab9dc4b9ac088d/
|
ks/cf-5be396077b811e3a3ab9dc4b9ac088d/
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ launch_service()
|
||||||
props="$3"
|
props="$3"
|
||||||
class="$4"
|
class="$4"
|
||||||
cassandra_parms="-Dlogback.configurationFile=logback.xml"
|
cassandra_parms="-Dlogback.configurationFile=logback.xml"
|
||||||
|
cassandra_parms="$cassandra_parms -Dcassandra.logdir=$CASSANDRA_HOME/logs -Dcassandra.storagedir=$CASSANDRA_HOME/data"
|
||||||
|
|
||||||
if [ "x$pidpath" != "x" ]; then
|
if [ "x$pidpath" != "x" ]; then
|
||||||
cassandra_parms="$cassandra_parms -Dcassandra-pidfile=$pidpath"
|
cassandra_parms="$cassandra_parms -Dcassandra-pidfile=$pidpath"
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ goto :eof
|
||||||
REM Include the build\classes\main directory so it works in development
|
REM Include the build\classes\main directory so it works in development
|
||||||
set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main";"%CASSANDRA_HOME%\build\classes\thrift"
|
set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main";"%CASSANDRA_HOME%\build\classes\thrift"
|
||||||
set CASSANDRA_PARAMS=-Dcassandra -Dcassandra-foreground=yes
|
set CASSANDRA_PARAMS=-Dcassandra -Dcassandra-foreground=yes
|
||||||
|
set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% "-Dcassandra.logdir=%CASSANDRA_HOME%\logs" "-Dcassandra.storagedir=%CASSANDRA_HOME%\data"
|
||||||
if /i "%ARG%" == "INSTALL" goto doInstallOperation
|
if /i "%ARG%" == "INSTALL" goto doInstallOperation
|
||||||
if /i "%ARG%" == "UNINSTALL" goto doInstallOperation
|
if /i "%ARG%" == "UNINSTALL" goto doInstallOperation
|
||||||
goto runDaemon
|
goto runDaemon
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,10 @@ Function Main
|
||||||
SetCassandraEnvironment
|
SetCassandraEnvironment
|
||||||
$pidfile = "$env:CASSANDRA_HOME/$pidfile"
|
$pidfile = "$env:CASSANDRA_HOME/$pidfile"
|
||||||
|
|
||||||
|
$logdir = "$env:CASSANDRA_HOME/logs"
|
||||||
|
$storagedir = "$env:CASSANDRA_HOME/data"
|
||||||
|
$env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + " -Dcassandra.logdir=$logdir -Dcassandra.storagedir=$storagedir"
|
||||||
|
|
||||||
# Other command line params
|
# Other command line params
|
||||||
if ($H)
|
if ($H)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -93,12 +93,14 @@ partitioner: org.apache.cassandra.dht.Murmur3Partitioner
|
||||||
# Directories where Cassandra should store data on disk. Cassandra
|
# Directories where Cassandra should store data on disk. Cassandra
|
||||||
# will spread data evenly across them, subject to the granularity of
|
# will spread data evenly across them, subject to the granularity of
|
||||||
# the configured compaction strategy.
|
# the configured compaction strategy.
|
||||||
data_file_directories:
|
# If not set, the default directory is $CASSANDRA_HOME/data/data.
|
||||||
- /var/lib/cassandra/data
|
# data_file_directories:
|
||||||
|
# - /var/lib/cassandra/data
|
||||||
|
|
||||||
# commit log. when running on magnetic HDD, this should be a
|
# commit log. when running on magnetic HDD, this should be a
|
||||||
# separate spindle than the data directories.
|
# separate spindle than the data directories.
|
||||||
commitlog_directory: /var/lib/cassandra/commitlog
|
# If not set, the default directory is $CASSANDRA_HOME/data/commitlog.
|
||||||
|
# commitlog_directory: /var/lib/cassandra/commitlog
|
||||||
|
|
||||||
# policy for data disk failures:
|
# policy for data disk failures:
|
||||||
# stop_paranoid: shut down gossip and Thrift even for single-sstable errors.
|
# stop_paranoid: shut down gossip and Thrift even for single-sstable errors.
|
||||||
|
|
@ -200,7 +202,8 @@ counter_cache_save_period: 7200
|
||||||
# memory_allocator: NativeAllocator
|
# memory_allocator: NativeAllocator
|
||||||
|
|
||||||
# saved caches
|
# saved caches
|
||||||
saved_caches_directory: /var/lib/cassandra/saved_caches
|
# If not set, the default directory is $CASSANDRA_HOME/data/saved_caches.
|
||||||
|
# saved_caches_directory: /var/lib/cassandra/saved_caches
|
||||||
|
|
||||||
# commitlog_sync may be either "periodic" or "batch."
|
# commitlog_sync may be either "periodic" or "batch."
|
||||||
# When in batch mode, Cassandra won't ack writes until the commit log
|
# When in batch mode, Cassandra won't ack writes until the commit log
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@
|
||||||
<configuration scan="true">
|
<configuration scan="true">
|
||||||
<jmxConfigurator />
|
<jmxConfigurator />
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<file>/var/log/cassandra/system.log</file>
|
<file>${cassandra.logdir}/system.log</file>
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||||
<fileNamePattern>/var/log/cassandra/system.log.%i.zip</fileNamePattern>
|
<fileNamePattern>${cassandra.logdir}/system.log.%i.zip</fileNamePattern>
|
||||||
<minIndex>1</minIndex>
|
<minIndex>1</minIndex>
|
||||||
<maxIndex>20</maxIndex>
|
<maxIndex>20</maxIndex>
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ Section: misc
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: Eric Evans <eevans@apache.org>
|
Maintainer: Eric Evans <eevans@apache.org>
|
||||||
Uploaders: Sylvain Lebresne <slebresne@apache.org>
|
Uploaders: Sylvain Lebresne <slebresne@apache.org>
|
||||||
Build-Depends: debhelper (>= 5), openjdk-7-jdk | java7-jdk, ant (>= 1.7), ant-optional (>= 1.7), python-support
|
Build-Depends: debhelper (>= 5), openjdk-7-jdk | java7-jdk, ant (>= 1.7), ant-optional (>= 1.7), python-support, dpatch
|
||||||
Homepage: http://cassandra.apache.org
|
Homepage: http://cassandra.apache.org
|
||||||
Vcs-Git: http://git-wip-us.apache.org/repos/asf/cassandra.git
|
Vcs-Git: http://git-wip-us.apache.org/repos/asf/cassandra.git
|
||||||
Vcs-Browser: https://git-wip-us.apache.org/repos/asf?p=cassandra.git
|
Vcs-Browser: https://git-wip-us.apache.org/repos/asf?p=cassandra.git
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
#! /bin/sh /usr/share/dpatch/dpatch-run
|
||||||
|
## 001cassandra_yaml_dirs.dpatch by Tyler Hobbs <tyler@datastax.com>
|
||||||
|
##
|
||||||
|
## All lines beginning with `## DP:' are a description of the patch.
|
||||||
|
## DP: No description.
|
||||||
|
|
||||||
|
@DPATCH@
|
||||||
|
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' cassandra~/conf/cassandra.yaml cassandra/conf/cassandra.yaml
|
||||||
|
--- cassandra~/conf/cassandra.yaml 2014-06-05 13:36:22.000000000 -0500
|
||||||
|
+++ cassandra/conf/cassandra.yaml 2014-06-05 13:39:20.569034040 -0500
|
||||||
|
@@ -94,13 +94,13 @@
|
||||||
|
# will spread data evenly across them, subject to the granularity of
|
||||||
|
# the configured compaction strategy.
|
||||||
|
# If not set, the default directory is $CASSANDRA_HOME/data/data.
|
||||||
|
-# data_file_directories:
|
||||||
|
-# - /var/lib/cassandra/data
|
||||||
|
+data_file_directories:
|
||||||
|
+ - /var/lib/cassandra/data
|
||||||
|
|
||||||
|
# commit log. when running on magnetic HDD, this should be a
|
||||||
|
# separate spindle than the data directories.
|
||||||
|
# If not set, the default directory is $CASSANDRA_HOME/data/commitlog.
|
||||||
|
-# commitlog_directory: /var/lib/cassandra/commitlog
|
||||||
|
+commitlog_directory: /var/lib/cassandra/commitlog
|
||||||
|
|
||||||
|
# policy for data disk failures:
|
||||||
|
# stop_paranoid: shut down gossip and Thrift even for single-sstable errors.
|
||||||
|
@@ -203,7 +203,7 @@
|
||||||
|
|
||||||
|
# saved caches
|
||||||
|
# If not set, the default directory is $CASSANDRA_HOME/data/saved_caches.
|
||||||
|
-# saved_caches_directory: /var/lib/cassandra/saved_caches
|
||||||
|
+saved_caches_directory: /var/lib/cassandra/saved_caches
|
||||||
|
|
||||||
|
# commitlog_sync may be either "periodic" or "batch."
|
||||||
|
# When in batch mode, Cassandra won't ack writes until the commit log
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
001cassandra_yaml_dirs.dpatch
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
# Uncomment to enable verbose mode.
|
# Uncomment to enable verbose mode.
|
||||||
#export DH_VERBOSE=1
|
#export DH_VERBOSE=1
|
||||||
|
|
||||||
|
include /usr/share/dpatch/dpatch.make
|
||||||
|
|
||||||
ANT = /usr/bin/ant
|
ANT = /usr/bin/ant
|
||||||
VERSION = $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)/\1/p')
|
VERSION = $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)/\1/p')
|
||||||
|
|
||||||
|
|
@ -10,7 +12,7 @@ test:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
$(ANT) test
|
$(ANT) test
|
||||||
|
|
||||||
clean:
|
clean: unpatch
|
||||||
dh_testdir
|
dh_testdir
|
||||||
dh_testroot
|
dh_testroot
|
||||||
$(ANT) realclean
|
$(ANT) realclean
|
||||||
|
|
@ -22,7 +24,7 @@ clean:
|
||||||
dh_clean
|
dh_clean
|
||||||
|
|
||||||
build: build-stamp
|
build: build-stamp
|
||||||
build-stamp:
|
build-stamp: patch-stamp
|
||||||
dh_testdir
|
dh_testdir
|
||||||
printf "version=%s" $(VERSION) > build.properties
|
printf "version=%s" $(VERSION) > build.properties
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -452,36 +452,48 @@ public class DatabaseDescriptor
|
||||||
throw new ConfigurationException("in_memory_compaction_limit_in_mb must be a positive integer");
|
throw new ConfigurationException("in_memory_compaction_limit_in_mb must be a positive integer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if data dirs, commitlog dir, or saved caches dir are set in cassandra.yaml, use that. Otherwise,
|
||||||
|
// use -Dcassandra.storagedir (set in cassandra-env.sh) as the parent dir for data/, commitlog/, and saved_caches/
|
||||||
|
if (conf.commitlog_directory == null)
|
||||||
|
{
|
||||||
|
conf.commitlog_directory = System.getProperty("cassandra.storagedir", null);
|
||||||
|
if (conf.commitlog_directory == null)
|
||||||
|
throw new ConfigurationException("commitlog_directory is missing and -Dcassandra.storagedir is not set");
|
||||||
|
conf.commitlog_directory += File.separator + "commitlog";
|
||||||
|
}
|
||||||
|
if (conf.saved_caches_directory == null)
|
||||||
|
{
|
||||||
|
conf.saved_caches_directory = System.getProperty("cassandra.storagedir", null);
|
||||||
|
if (conf.saved_caches_directory == null)
|
||||||
|
throw new ConfigurationException("saved_caches_directory is missing and -Dcassandra.storagedir is not set");
|
||||||
|
conf.saved_caches_directory += File.separator + "saved_caches";
|
||||||
|
}
|
||||||
|
if (conf.data_file_directories == null)
|
||||||
|
{
|
||||||
|
String defaultDataDir = System.getProperty("cassandra.storagedir", null);
|
||||||
|
if (defaultDataDir == null)
|
||||||
|
throw new ConfigurationException("data_file_directories is not missing and -Dcassandra.storagedir is not set");
|
||||||
|
conf.data_file_directories = new String[]{ defaultDataDir + File.separator + "data" };
|
||||||
|
}
|
||||||
|
|
||||||
|
/* data file and commit log directories. they get created later, when they're needed. */
|
||||||
|
for (String datadir : conf.data_file_directories)
|
||||||
|
{
|
||||||
|
if (datadir.equals(conf.commitlog_directory))
|
||||||
|
throw new ConfigurationException("commitlog_directory must not be the same as any data_file_directories");
|
||||||
|
if (datadir.equals(conf.saved_caches_directory))
|
||||||
|
throw new ConfigurationException("saved_caches_directory must not be the same as any data_file_directories");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conf.commitlog_directory.equals(conf.saved_caches_directory))
|
||||||
|
throw new ConfigurationException("saved_caches_directory must not be the same as the commitlog_directory");
|
||||||
|
|
||||||
if (conf.concurrent_compactors == null)
|
if (conf.concurrent_compactors == null)
|
||||||
conf.concurrent_compactors = Math.min(8, Math.max(2, Math.min(FBUtilities.getAvailableProcessors(), conf.data_file_directories.length)));
|
conf.concurrent_compactors = Math.min(8, Math.max(2, Math.min(FBUtilities.getAvailableProcessors(), conf.data_file_directories.length)));
|
||||||
|
|
||||||
if (conf.concurrent_compactors <= 0)
|
if (conf.concurrent_compactors <= 0)
|
||||||
throw new ConfigurationException("concurrent_compactors should be strictly greater than 0");
|
throw new ConfigurationException("concurrent_compactors should be strictly greater than 0");
|
||||||
|
|
||||||
/* data file and commit log directories. they get created later, when they're needed. */
|
|
||||||
if (conf.commitlog_directory != null && conf.data_file_directories != null && conf.saved_caches_directory != null)
|
|
||||||
{
|
|
||||||
for (String datadir : conf.data_file_directories)
|
|
||||||
{
|
|
||||||
if (datadir.equals(conf.commitlog_directory))
|
|
||||||
throw new ConfigurationException("commitlog_directory must not be the same as any data_file_directories");
|
|
||||||
if (datadir.equals(conf.saved_caches_directory))
|
|
||||||
throw new ConfigurationException("saved_caches_directory must not be the same as any data_file_directories");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conf.commitlog_directory.equals(conf.saved_caches_directory))
|
|
||||||
throw new ConfigurationException("saved_caches_directory must not be the same as the commitlog_directory");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (conf.commitlog_directory == null)
|
|
||||||
throw new ConfigurationException("commitlog_directory missing");
|
|
||||||
if (conf.data_file_directories == null)
|
|
||||||
throw new ConfigurationException("data_file_directories missing; at least one data directory must be specified");
|
|
||||||
if (conf.saved_caches_directory == null)
|
|
||||||
throw new ConfigurationException("saved_caches_directory missing");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conf.initial_token != null)
|
if (conf.initial_token != null)
|
||||||
for (String token : tokensFromString(conf.initial_token))
|
for (String token : tokensFromString(conf.initial_token))
|
||||||
partitioner.getTokenFactory().validate(token);
|
partitioner.getTokenFactory().validate(token);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue