cassandra-cql 1.1.5 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +9 -12
- data/Gemfile +1 -1
- data/README.md +4 -0
- data/Rakefile +29 -6
- data/lib/cassandra-cql.rb +3 -0
- data/lib/cassandra-cql/1.2.rb +8 -0
- data/lib/cassandra-cql/1.2/result.rb +6 -0
- data/lib/cassandra-cql/1.2/statement.rb +6 -0
- data/lib/cassandra-cql/collections/list.rb +17 -0
- data/lib/cassandra-cql/collections/map.rb +26 -0
- data/lib/cassandra-cql/collections/set.rb +10 -0
- data/lib/cassandra-cql/database.rb +11 -2
- data/lib/cassandra-cql/result.rb +1 -1
- data/lib/cassandra-cql/schema.rb +18 -1
- data/lib/cassandra-cql/statement.rb +20 -9
- data/lib/cassandra-cql/version.rb +2 -2
- data/spec/comparator_spec.rb +2 -2
- data/spec/conf/1.1/cassandra.in.sh +41 -0
- data/spec/conf/1.1/cassandra.yaml +567 -0
- data/spec/conf/1.1/log4j-server.properties +44 -0
- data/spec/conf/1.1/schema.json +72 -0
- data/spec/conf/1.1/schema.txt +57 -0
- data/spec/conf/1.2/cassandra.in.sh +41 -0
- data/spec/conf/1.2/cassandra.yaml +643 -0
- data/spec/conf/1.2/log4j-server.properties +44 -0
- data/spec/conf/1.2/schema.json +72 -0
- data/spec/conf/1.2/schema.txt +57 -0
- data/spec/misc_spec.rb +6 -4
- data/spec/result_spec.rb +16 -2
- data/spec/row_spec.rb +43 -5
- data/spec/rowkey_spec.rb +2 -2
- data/spec/spec_helper.rb +66 -12
- data/spec/statement_spec.rb +41 -16
- data/spec/validation_spec.rb +5 -4
- data/vendor/1.2/gen-rb/cassandra.rb +3013 -0
- data/vendor/1.2/gen-rb/cassandra_constants.rb +13 -0
- data/vendor/1.2/gen-rb/cassandra_types.rb +966 -0
- metadata +21 -5
data/.travis.yml
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
language: ruby
|
2
|
-
services:
|
3
|
-
- cassandra
|
4
2
|
rvm:
|
5
|
-
-
|
6
|
-
|
7
|
-
-
|
8
|
-
|
9
|
-
|
10
|
-
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# script: bundle exec rspec spec
|
3
|
+
- 1.9.3
|
4
|
+
env:
|
5
|
+
- CASSANDRA_VERSION=1.2 CQL_VERSION=3.0.0
|
6
|
+
- CASSANDRA_VERSION=1.2 CQL_VERSION=2.0.0
|
7
|
+
- CASSANDRA_VERSION=1.1 CQL_VERSION=2.0.0
|
8
|
+
- CASSANDRA_VERSION=1.0 CQL_VERSION=2.0.0
|
9
|
+
before_script:
|
10
|
+
- java -version
|
11
|
+
- bundle exec rake 'cassandra:start[daemonize]'
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -72,6 +72,10 @@ So adding a feature like counters just requires teaching the CQL parser to under
|
|
72
72
|
|
73
73
|
# Notes
|
74
74
|
|
75
|
+
## Supported versions of ruby
|
76
|
+
|
77
|
+
As of version 1.2.0, cassandra-cql only supports ruby >= 1.9.
|
78
|
+
|
75
79
|
## Changing Validation on Columns with existing/unvalidatable data
|
76
80
|
|
77
81
|
If you have existing data and change the validation on a column in an incompatible
|
data/Rakefile
CHANGED
@@ -6,8 +6,10 @@ require 'rspec/core'
|
|
6
6
|
require 'rspec/core/rake_task'
|
7
7
|
|
8
8
|
CassandraBinaries = {
|
9
|
-
'0.8' => 'http://archive.apache.org/dist/cassandra/0.8.
|
10
|
-
'1.0' => 'http://archive.apache.org/dist/cassandra/1.0.
|
9
|
+
'0.8' => 'http://archive.apache.org/dist/cassandra/0.8.9/apache-cassandra-0.8.9-bin.tar.gz',
|
10
|
+
'1.0' => 'http://archive.apache.org/dist/cassandra/1.0.9/apache-cassandra-1.0.9-bin.tar.gz',
|
11
|
+
'1.1' => 'http://archive.apache.org/dist/cassandra/1.1.9/apache-cassandra-1.1.9-bin.tar.gz',
|
12
|
+
'1.2' => 'http://archive.apache.org/dist/cassandra/1.2.5/apache-cassandra-1.2.5-bin.tar.gz'
|
11
13
|
}
|
12
14
|
|
13
15
|
CASSANDRA_VERSION = ENV['CASSANDRA_VERSION'] || '1.0'
|
@@ -89,20 +91,39 @@ def running?(pid_file = nil)
|
|
89
91
|
false
|
90
92
|
end
|
91
93
|
|
94
|
+
def listening?(host, port)
|
95
|
+
TCPSocket.new(host, port).close
|
96
|
+
true
|
97
|
+
rescue Errno::ECONNREFUSED => e
|
98
|
+
false
|
99
|
+
end
|
100
|
+
|
92
101
|
namespace :cassandra do
|
93
102
|
desc "Start Cassandra"
|
94
103
|
task :start, [:daemonize] => :java do |t, args|
|
95
104
|
args.with_defaults(:daemonize => true)
|
96
105
|
|
97
106
|
setup_cassandra_version
|
98
|
-
|
99
107
|
env = setup_environment
|
100
108
|
|
101
109
|
Dir.chdir(File.join(CASSANDRA_HOME, "cassandra-#{CASSANDRA_VERSION}")) do
|
102
110
|
sh("env #{env} bin/cassandra #{'-f' unless args.daemonize} -p #{CASSANDRA_PIDFILE}")
|
103
111
|
end
|
104
|
-
|
105
|
-
|
112
|
+
|
113
|
+
if args.daemonize
|
114
|
+
end_time = Time.now + 30
|
115
|
+
host = '127.0.0.1'
|
116
|
+
port = 9160
|
117
|
+
|
118
|
+
until Time.now >= end_time || listening?(host, port)
|
119
|
+
puts "waiting for 127.0.0.1:9160"
|
120
|
+
sleep 0.1
|
121
|
+
end
|
122
|
+
|
123
|
+
unless listening?(host, port)
|
124
|
+
raise "timed out waiting for cassandra to start"
|
125
|
+
end
|
126
|
+
end
|
106
127
|
end
|
107
128
|
|
108
129
|
desc "Stop Cassandra"
|
@@ -137,7 +158,9 @@ end
|
|
137
158
|
|
138
159
|
desc "Check Java version"
|
139
160
|
task :java do
|
140
|
-
|
161
|
+
is_java16 = `java -version 2>&1`.split("\n").first =~ /java version "1.6/
|
162
|
+
|
163
|
+
if ['0.6', '0.7'].include?(CASSANDRA_VERSION) && !java16
|
141
164
|
puts "You need to configure your environment for Java 1.6."
|
142
165
|
puts "If you're on OS X, just export the following environment variables:"
|
143
166
|
puts ' JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"'
|
data/lib/cassandra-cql.rb
CHANGED
@@ -37,6 +37,9 @@ require 'cassandra-cql/types/integer_type'
|
|
37
37
|
require 'cassandra-cql/types/long_type'
|
38
38
|
require 'cassandra-cql/types/utf8_type'
|
39
39
|
require 'cassandra-cql/types/uuid_type'
|
40
|
+
require 'cassandra-cql/collections/list'
|
41
|
+
require 'cassandra-cql/collections/map'
|
42
|
+
require 'cassandra-cql/collections/set'
|
40
43
|
require 'cassandra-cql/utility'
|
41
44
|
require 'cassandra-cql/uuid'
|
42
45
|
require 'cassandra-cql/database'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module CassandraCQL
|
2
|
+
module Collections
|
3
|
+
class List
|
4
|
+
def self.cast(value)
|
5
|
+
length = value.unpack('S>').first
|
6
|
+
pos = 2
|
7
|
+
Array.new(length) do
|
8
|
+
value_length = value.byteslice(pos, 2).unpack('S>').first
|
9
|
+
pos += 2
|
10
|
+
element = value.byteslice(pos, value_length)
|
11
|
+
pos += value_length
|
12
|
+
yield element
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module CassandraCQL
|
2
|
+
module Collections
|
3
|
+
class Map
|
4
|
+
def self.cast(value)
|
5
|
+
length = value.unpack('S>').first
|
6
|
+
pos = 2
|
7
|
+
result = {}
|
8
|
+
length.times do
|
9
|
+
key_length = value.byteslice(pos, 2).unpack('S>').first
|
10
|
+
pos += 2
|
11
|
+
key = value.byteslice(pos, key_length)
|
12
|
+
pos += key_length
|
13
|
+
|
14
|
+
val_length = value.byteslice(pos, 2).unpack('S>').first
|
15
|
+
pos += 2
|
16
|
+
val = value.byteslice(pos, val_length)
|
17
|
+
pos += val_length
|
18
|
+
cast_key, cast_val = yield key, val
|
19
|
+
result[cast_key] = cast_val
|
20
|
+
end
|
21
|
+
result
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -39,6 +39,11 @@ module CassandraCQL
|
|
39
39
|
execute("USE #{@keyspace}")
|
40
40
|
end
|
41
41
|
|
42
|
+
def use_cql3?
|
43
|
+
(@cql_version.nil? || @cql_version.split('.').first.to_i >= 3) &&
|
44
|
+
CassandraCQL::Thrift::Client.method_defined?(:execute_cql3_query)
|
45
|
+
end
|
46
|
+
|
42
47
|
def connect!
|
43
48
|
@connection = ThriftClient.new(CassandraCQL::Thrift::Client, @servers, @thrift_client_options)
|
44
49
|
obj = self
|
@@ -48,7 +53,7 @@ module CassandraCQL
|
|
48
53
|
@connection.login(@auth_request) if @auth_request
|
49
54
|
end
|
50
55
|
end
|
51
|
-
|
56
|
+
|
52
57
|
def disconnect!
|
53
58
|
@connection.disconnect! if active?
|
54
59
|
end
|
@@ -96,7 +101,11 @@ module CassandraCQL
|
|
96
101
|
end
|
97
102
|
|
98
103
|
def execute_cql_query(cql, compression=CassandraCQL::Thrift::Compression::NONE)
|
99
|
-
|
104
|
+
if use_cql3?
|
105
|
+
@connection.execute_cql3_query(cql, compression, CassandraCQL::Thrift::ConsistencyLevel::QUORUM) #TODO consistency level
|
106
|
+
else
|
107
|
+
@connection.execute_cql_query(cql, compression)
|
108
|
+
end
|
100
109
|
rescue CassandraCQL::Thrift::InvalidRequestException
|
101
110
|
raise Error::InvalidRequestException.new($!.why)
|
102
111
|
end
|
data/lib/cassandra-cql/result.rb
CHANGED
data/lib/cassandra-cql/schema.rb
CHANGED
@@ -78,7 +78,24 @@ module CassandraCQL
|
|
78
78
|
def self.cast(value, type)
|
79
79
|
return nil if value.nil?
|
80
80
|
|
81
|
-
if
|
81
|
+
if type =~ /^(List|Set|Map)Type\((.+)\)$/
|
82
|
+
collection_type, value_type = $1, $2
|
83
|
+
case collection_type
|
84
|
+
when 'List'
|
85
|
+
CassandraCQL::Collections::List.cast(value) do |element|
|
86
|
+
cast(element, value_type)
|
87
|
+
end
|
88
|
+
when 'Set'
|
89
|
+
CassandraCQL::Collections::Set.cast(value) do |element|
|
90
|
+
cast(element, value_type)
|
91
|
+
end
|
92
|
+
when 'Map'
|
93
|
+
key_type, map_value_type = value_type.split(',')
|
94
|
+
CassandraCQL::Collections::Map.cast(value) do |key, element|
|
95
|
+
[cast(key, key_type), cast(element, map_value_type)]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
elsif CassandraCQL::Types.const_defined?(type)
|
82
99
|
CassandraCQL::Types.const_get(type).cast(value)
|
83
100
|
else
|
84
101
|
CassandraCQL::Types::AbstractType.cast(value)
|
@@ -37,7 +37,7 @@ module CassandraCQL
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def execute(bind_vars=[], options={})
|
40
|
-
sanitized_query = self.class.sanitize(@statement, bind_vars)
|
40
|
+
sanitized_query = self.class.sanitize(@statement, bind_vars, @handle.use_cql3?)
|
41
41
|
compression_type = CassandraCQL::Thrift::Compression::NONE
|
42
42
|
if options[:compression]
|
43
43
|
compression_type = CassandraCQL::Thrift::Compression::GZIP
|
@@ -69,13 +69,22 @@ module CassandraCQL
|
|
69
69
|
obj.gsub("'", "''")
|
70
70
|
end
|
71
71
|
|
72
|
-
def self.quote(obj)
|
72
|
+
def self.quote(obj, use_cql3=false)
|
73
73
|
if obj.kind_of?(Array)
|
74
|
-
obj.map { |member| quote(member) }.join(",")
|
74
|
+
obj.map { |member| quote(member, use_cql3) }.join(",")
|
75
75
|
elsif obj.kind_of?(String)
|
76
76
|
"'" + obj + "'"
|
77
|
+
elsif obj.kind_of?(BigDecimal) and (!use_cql3 or CASSANDRA_VERSION.to_f < 1.2)
|
78
|
+
"'" + obj.to_s + "'"
|
77
79
|
elsif obj.kind_of?(Numeric)
|
78
|
-
obj
|
80
|
+
obj.to_s
|
81
|
+
elsif obj.kind_of?(SimpleUUID::UUID)
|
82
|
+
obj.to_guid
|
83
|
+
#elsif obj.kind_of?(TrueClass) or obj.kind_of?(FalseClass) and use_cql3 and CASSANDRA_VERSION.to_f == 1.2
|
84
|
+
# obj.to_s
|
85
|
+
elsif obj.kind_of?(TrueClass) or obj.kind_of?(FalseClass)
|
86
|
+
#"'" + obj.to_s + "'"
|
87
|
+
obj.to_s
|
79
88
|
else
|
80
89
|
raise Error::UnescapableObject, "Unable to escape object of class #{obj.class}"
|
81
90
|
end
|
@@ -84,14 +93,16 @@ module CassandraCQL
|
|
84
93
|
def self.cast_to_cql(obj)
|
85
94
|
if obj.kind_of?(Array)
|
86
95
|
obj.map { |member| cast_to_cql(member) }
|
87
|
-
elsif obj.kind_of?(
|
96
|
+
elsif obj.kind_of?(Numeric)
|
88
97
|
obj
|
89
98
|
elsif obj.kind_of?(Date)
|
90
99
|
obj.strftime('%Y-%m-%d')
|
91
100
|
elsif obj.kind_of?(Time)
|
92
101
|
(obj.to_f * 1000).to_i
|
93
102
|
elsif obj.kind_of?(SimpleUUID::UUID)
|
94
|
-
obj
|
103
|
+
obj
|
104
|
+
elsif obj.kind_of?(TrueClass) or obj.kind_of?(FalseClass)
|
105
|
+
obj
|
95
106
|
# There are corner cases where this is an invalid assumption but they are extremely rare.
|
96
107
|
# The alternative is to make the user pack the data on their own .. let's not do that until we have to
|
97
108
|
elsif obj.kind_of?(String) and Utility.binary_data?(obj)
|
@@ -101,7 +112,7 @@ module CassandraCQL
|
|
101
112
|
end
|
102
113
|
end
|
103
114
|
|
104
|
-
def self.sanitize(statement, bind_vars=[])
|
115
|
+
def self.sanitize(statement, bind_vars=[], use_cql3=false)
|
105
116
|
# If there are no bind variables, return the statement unaltered
|
106
117
|
return statement if bind_vars.empty?
|
107
118
|
|
@@ -111,8 +122,8 @@ module CassandraCQL
|
|
111
122
|
raise Error::InvalidBindVariable, "Wrong number of bound variables (statement expected #{expected_bind_vars}, was #{bind_vars.size})" if expected_bind_vars != bind_vars.size
|
112
123
|
|
113
124
|
statement.gsub(/\?/) {
|
114
|
-
quote(cast_to_cql(bind_vars.shift))
|
125
|
+
quote(cast_to_cql(bind_vars.shift), use_cql3)
|
115
126
|
}
|
116
127
|
end
|
117
128
|
end
|
118
|
-
end
|
129
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright
|
2
|
+
Copyright 2013 Inside Systems, Inc.
|
3
3
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
you may not use this file except in compliance with the License.
|
@@ -15,5 +15,5 @@ limitations under the License.
|
|
15
15
|
=end
|
16
16
|
|
17
17
|
module CassandraCQL
|
18
|
-
VERSION = "1.
|
18
|
+
VERSION = "1.2.0"
|
19
19
|
end
|
data/spec/comparator_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require File.expand_path('spec_helper.rb', File.dirname(__FILE__))
|
3
3
|
include CassandraCQL
|
4
4
|
|
5
|
-
describe "Comparator Roundtrip tests" do
|
5
|
+
describe "Comparator Roundtrip tests", :cql_version => '2.0.0' do
|
6
6
|
before(:each) do
|
7
7
|
@connection = setup_cassandra_connection
|
8
8
|
end
|
@@ -246,4 +246,4 @@ describe "Comparator Roundtrip tests" do
|
|
246
246
|
test_for_value(2**256)
|
247
247
|
end
|
248
248
|
end
|
249
|
-
end
|
249
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
if [ "x$CASSANDRA_HOME" = "x" ]; then
|
18
|
+
CASSANDRA_HOME=`dirname $0`/..
|
19
|
+
fi
|
20
|
+
|
21
|
+
# The directory where Cassandra's configs live (required)
|
22
|
+
if [ "x$CASSANDRA_CONF" = "x" ]; then
|
23
|
+
CASSANDRA_CONF=$CASSANDRA_HOME/conf
|
24
|
+
fi
|
25
|
+
|
26
|
+
# This can be the path to a jar file, or a directory containing the
|
27
|
+
# compiled classes. NOTE: This isn't needed by the startup script,
|
28
|
+
# it's just used here in constructing the classpath.
|
29
|
+
cassandra_bin=$CASSANDRA_HOME/build/classes/main
|
30
|
+
cassandra_bin=$cassandra_bin:$CASSANDRA_HOME/build/classes/thrift
|
31
|
+
#cassandra_bin=$cassandra_home/build/cassandra.jar
|
32
|
+
|
33
|
+
# JAVA_HOME can optionally be set here
|
34
|
+
#JAVA_HOME=/usr/local/jdk6
|
35
|
+
|
36
|
+
# The java classpath (required)
|
37
|
+
CLASSPATH=$CASSANDRA_CONF:$cassandra_bin
|
38
|
+
|
39
|
+
for jar in $CASSANDRA_HOME/lib/*.jar; do
|
40
|
+
CLASSPATH=$CLASSPATH:$jar
|
41
|
+
done
|
@@ -0,0 +1,567 @@
|
|
1
|
+
# Cassandra storage config YAML
|
2
|
+
|
3
|
+
# NOTE:
|
4
|
+
# See http://wiki.apache.org/cassandra/StorageConfiguration for
|
5
|
+
# full explanations of configuration directives
|
6
|
+
# /NOTE
|
7
|
+
|
8
|
+
# The name of the cluster. This is mainly used to prevent machines in
|
9
|
+
# one logical cluster from joining another.
|
10
|
+
cluster_name: 'Test Cluster'
|
11
|
+
|
12
|
+
# You should always specify InitialToken when setting up a production
|
13
|
+
# cluster for the first time, and often when adding capacity later.
|
14
|
+
# The principle is that each node should be given an equal slice of
|
15
|
+
# the token ring; see http://wiki.apache.org/cassandra/Operations
|
16
|
+
# for more details.
|
17
|
+
#
|
18
|
+
# If blank, Cassandra will request a token bisecting the range of
|
19
|
+
# the heaviest-loaded existing node. If there is no load information
|
20
|
+
# available, such as is the case with a new cluster, it will pick
|
21
|
+
# a random token, which will lead to hot spots.
|
22
|
+
initial_token:
|
23
|
+
|
24
|
+
# See http://wiki.apache.org/cassandra/HintedHandoff
|
25
|
+
hinted_handoff_enabled: true
|
26
|
+
# this defines the maximum amount of time a dead host will have hints
|
27
|
+
# generated. After it has been dead this long, hints will be dropped.
|
28
|
+
max_hint_window_in_ms: 3600000 # one hour
|
29
|
+
# Sleep this long after delivering each hint
|
30
|
+
hinted_handoff_throttle_delay_in_ms: 1
|
31
|
+
|
32
|
+
# The following setting populates the page cache on memtable flush and compaction
|
33
|
+
# WARNING: Enable this setting only when the whole node's data fits in memory.
|
34
|
+
# Defaults to: false
|
35
|
+
# populate_io_cache_on_flush: false
|
36
|
+
|
37
|
+
# authentication backend, implementing IAuthenticator; used to identify users
|
38
|
+
authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
|
39
|
+
|
40
|
+
# authorization backend, implementing IAuthority; used to limit access/provide permissions
|
41
|
+
authority: org.apache.cassandra.auth.AllowAllAuthority
|
42
|
+
|
43
|
+
# The partitioner is responsible for distributing rows (by key) across
|
44
|
+
# nodes in the cluster. Any IPartitioner may be used, including your
|
45
|
+
# own as long as it is on the classpath. Out of the box, Cassandra
|
46
|
+
# provides org.apache.cassandra.dht.RandomPartitioner
|
47
|
+
# org.apache.cassandra.dht.ByteOrderedPartitioner,
|
48
|
+
# org.apache.cassandra.dht.OrderPreservingPartitioner (deprecated),
|
49
|
+
# and org.apache.cassandra.dht.CollatingOrderPreservingPartitioner
|
50
|
+
# (deprecated).
|
51
|
+
#
|
52
|
+
# - RandomPartitioner distributes rows across the cluster evenly by md5.
|
53
|
+
# When in doubt, this is the best option.
|
54
|
+
# - ByteOrderedPartitioner orders rows lexically by key bytes. BOP allows
|
55
|
+
# scanning rows in key order, but the ordering can generate hot spots
|
56
|
+
# for sequential insertion workloads.
|
57
|
+
# - OrderPreservingPartitioner is an obsolete form of BOP, that stores
|
58
|
+
# - keys in a less-efficient format and only works with keys that are
|
59
|
+
# UTF8-encoded Strings.
|
60
|
+
# - CollatingOPP colates according to EN,US rules rather than lexical byte
|
61
|
+
# ordering. Use this as an example if you need custom collation.
|
62
|
+
#
|
63
|
+
# See http://wiki.apache.org/cassandra/Operations for more on
|
64
|
+
# partitioners and token selection.
|
65
|
+
partitioner: org.apache.cassandra.dht.RandomPartitioner
|
66
|
+
|
67
|
+
# directories where Cassandra should store data on disk.
|
68
|
+
data_file_directories:
|
69
|
+
- data/data
|
70
|
+
|
71
|
+
# commit log
|
72
|
+
commitlog_directory: data/commitlog
|
73
|
+
|
74
|
+
# Maximum size of the key cache in memory.
|
75
|
+
#
|
76
|
+
# Each key cache hit saves 1 seek and each row cache hit saves 2 seeks at the
|
77
|
+
# minimum, sometimes more. The key cache is fairly tiny for the amount of
|
78
|
+
# time it saves, so it's worthwhile to use it at large numbers.
|
79
|
+
# The row cache saves even more time, but must store the whole values of
|
80
|
+
# its rows, so it is extremely space-intensive. It's best to only use the
|
81
|
+
# row cache if you have hot rows or static rows.
|
82
|
+
#
|
83
|
+
# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup.
|
84
|
+
#
|
85
|
+
# Default value is empty to make it "auto" (min(5% of Heap (in MB), 100MB)). Set to 0 to disable key cache.
|
86
|
+
key_cache_size_in_mb:
|
87
|
+
|
88
|
+
# Duration in seconds after which Cassandra should
|
89
|
+
# safe the keys cache. Caches are saved to saved_caches_directory as
|
90
|
+
# specified in this configuration file.
|
91
|
+
#
|
92
|
+
# Saved caches greatly improve cold-start speeds, and is relatively cheap in
|
93
|
+
# terms of I/O for the key cache. Row cache saving is much more expensive and
|
94
|
+
# has limited use.
|
95
|
+
#
|
96
|
+
# Default is 14400 or 4 hours.
|
97
|
+
key_cache_save_period: 14400
|
98
|
+
|
99
|
+
# Number of keys from the key cache to save
|
100
|
+
# Disabled by default, meaning all keys are going to be saved
|
101
|
+
# key_cache_keys_to_save: 100
|
102
|
+
|
103
|
+
# Maximum size of the row cache in memory.
|
104
|
+
# NOTE: if you reduce the size, you may not get you hottest keys loaded on startup.
|
105
|
+
#
|
106
|
+
# Default value is 0, to disable row caching.
|
107
|
+
row_cache_size_in_mb: 0
|
108
|
+
|
109
|
+
# Duration in seconds after which Cassandra should
|
110
|
+
# safe the row cache. Caches are saved to saved_caches_directory as specified
|
111
|
+
# in this configuration file.
|
112
|
+
#
|
113
|
+
# Saved caches greatly improve cold-start speeds, and is relatively cheap in
|
114
|
+
# terms of I/O for the key cache. Row cache saving is much more expensive and
|
115
|
+
# has limited use.
|
116
|
+
#
|
117
|
+
# Default is 0 to disable saving the row cache.
|
118
|
+
row_cache_save_period: 0
|
119
|
+
|
120
|
+
# Number of keys from the row cache to save
|
121
|
+
# Disabled by default, meaning all keys are going to be saved
|
122
|
+
# row_cache_keys_to_save: 100
|
123
|
+
|
124
|
+
# The provider for the row cache to use.
|
125
|
+
#
|
126
|
+
# Supported values are: ConcurrentLinkedHashCacheProvider, SerializingCacheProvider
|
127
|
+
#
|
128
|
+
# SerializingCacheProvider serialises the contents of the row and stores
|
129
|
+
# it in native memory, i.e., off the JVM Heap. Serialized rows take
|
130
|
+
# significantly less memory than "live" rows in the JVM, so you can cache
|
131
|
+
# more rows in a given memory footprint. And storing the cache off-heap
|
132
|
+
# means you can use smaller heap sizes, reducing the impact of GC pauses.
|
133
|
+
#
|
134
|
+
# It is also valid to specify the fully-qualified class name to a class
|
135
|
+
# that implements org.apache.cassandra.cache.IRowCacheProvider.
|
136
|
+
#
|
137
|
+
# Defaults to SerializingCacheProvider
|
138
|
+
row_cache_provider: SerializingCacheProvider
|
139
|
+
|
140
|
+
# saved caches
|
141
|
+
saved_caches_directory: data/saved_caches
|
142
|
+
|
143
|
+
# commitlog_sync may be either "periodic" or "batch."
|
144
|
+
# When in batch mode, Cassandra won't ack writes until the commit log
|
145
|
+
# has been fsynced to disk. It will wait up to
|
146
|
+
# commitlog_sync_batch_window_in_ms milliseconds for other writes, before
|
147
|
+
# performing the sync.
|
148
|
+
#
|
149
|
+
# commitlog_sync: batch
|
150
|
+
# commitlog_sync_batch_window_in_ms: 50
|
151
|
+
#
|
152
|
+
# the other option is "periodic" where writes may be acked immediately
|
153
|
+
# and the CommitLog is simply synced every commitlog_sync_period_in_ms
|
154
|
+
# milliseconds.
|
155
|
+
commitlog_sync: periodic
|
156
|
+
commitlog_sync_period_in_ms: 10000
|
157
|
+
|
158
|
+
# The size of the individual commitlog file segments. A commitlog
|
159
|
+
# segment may be archived, deleted, or recycled once all the data
|
160
|
+
# in it (potentally from each columnfamily in the system) has been
|
161
|
+
# flushed to sstables.
|
162
|
+
#
|
163
|
+
# The default size is 32, which is almost always fine, but if you are
|
164
|
+
# archiving commitlog segments (see commitlog_archiving.properties),
|
165
|
+
# then you probably want a finer granularity of archiving; 8 or 16 MB
|
166
|
+
# is reasonable.
|
167
|
+
commitlog_segment_size_in_mb: 32
|
168
|
+
|
169
|
+
# any class that implements the SeedProvider interface and has a
|
170
|
+
# constructor that takes a Map<String, String> of parameters will do.
|
171
|
+
seed_provider:
|
172
|
+
# Addresses of hosts that are deemed contact points.
|
173
|
+
# Cassandra nodes use this list of hosts to find each other and learn
|
174
|
+
# the topology of the ring. You must change this if you are running
|
175
|
+
# multiple nodes!
|
176
|
+
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
|
177
|
+
parameters:
|
178
|
+
# seeds is actually a comma-delimited list of addresses.
|
179
|
+
# Ex: "<ip1>,<ip2>,<ip3>"
|
180
|
+
- seeds: "127.0.0.1"
|
181
|
+
|
182
|
+
# emergency pressure valve: each time heap usage after a full (CMS)
|
183
|
+
# garbage collection is above this fraction of the max, Cassandra will
|
184
|
+
# flush the largest memtables.
|
185
|
+
#
|
186
|
+
# Set to 1.0 to disable. Setting this lower than
|
187
|
+
# CMSInitiatingOccupancyFraction is not likely to be useful.
|
188
|
+
#
|
189
|
+
# RELYING ON THIS AS YOUR PRIMARY TUNING MECHANISM WILL WORK POORLY:
|
190
|
+
# it is most effective under light to moderate load, or read-heavy
|
191
|
+
# workloads; under truly massive write load, it will often be too
|
192
|
+
# little, too late.
|
193
|
+
flush_largest_memtables_at: 0.75
|
194
|
+
|
195
|
+
# emergency pressure valve #2: the first time heap usage after a full
|
196
|
+
# (CMS) garbage collection is above this fraction of the max,
|
197
|
+
# Cassandra will reduce cache maximum _capacity_ to the given fraction
|
198
|
+
# of the current _size_. Should usually be set substantially above
|
199
|
+
# flush_largest_memtables_at, since that will have less long-term
|
200
|
+
# impact on the system.
|
201
|
+
#
|
202
|
+
# Set to 1.0 to disable. Setting this lower than
|
203
|
+
# CMSInitiatingOccupancyFraction is not likely to be useful.
|
204
|
+
reduce_cache_sizes_at: 0.85
|
205
|
+
reduce_cache_capacity_to: 0.6
|
206
|
+
|
207
|
+
# For workloads with more data than can fit in memory, Cassandra's
|
208
|
+
# bottleneck will be reads that need to fetch data from
|
209
|
+
# disk. "concurrent_reads" should be set to (16 * number_of_drives) in
|
210
|
+
# order to allow the operations to enqueue low enough in the stack
|
211
|
+
# that the OS and drives can reorder them.
|
212
|
+
#
|
213
|
+
# On the other hand, since writes are almost never IO bound, the ideal
|
214
|
+
# number of "concurrent_writes" is dependent on the number of cores in
|
215
|
+
# your system; (8 * number_of_cores) is a good rule of thumb.
|
216
|
+
concurrent_reads: 32
|
217
|
+
concurrent_writes: 32
|
218
|
+
|
219
|
+
# Total memory to use for memtables. Cassandra will flush the largest
|
220
|
+
# memtable when this much memory is used.
|
221
|
+
# If omitted, Cassandra will set it to 1/3 of the heap.
|
222
|
+
# memtable_total_space_in_mb: 2048
|
223
|
+
|
224
|
+
# Total space to use for commitlogs. Since commitlog segments are
|
225
|
+
# mmapped, and hence use up address space, the default size is 32
|
226
|
+
# on 32-bit JVMs, and 1024 on 64-bit JVMs.
|
227
|
+
#
|
228
|
+
# If space gets above this value (it will round up to the next nearest
|
229
|
+
# segment multiple), Cassandra will flush every dirty CF in the oldest
|
230
|
+
# segment and remove it. So a small total commitlog space will tend
|
231
|
+
# to cause more flush activity on less-active columnfamilies.
|
232
|
+
# commitlog_total_space_in_mb: 4096
|
233
|
+
|
234
|
+
# This sets the amount of memtable flush writer threads. These will
|
235
|
+
# be blocked by disk io, and each one will hold a memtable in memory
|
236
|
+
# while blocked. If you have a large heap and many data directories,
|
237
|
+
# you can increase this value for better flush performance.
|
238
|
+
# By default this will be set to the amount of data directories defined.
|
239
|
+
#memtable_flush_writers: 1
|
240
|
+
|
241
|
+
# the number of full memtables to allow pending flush, that is,
|
242
|
+
# waiting for a writer thread. At a minimum, this should be set to
|
243
|
+
# the maximum number of secondary indexes created on a single CF.
|
244
|
+
memtable_flush_queue_size: 4
|
245
|
+
|
246
|
+
# Whether to, when doing sequential writing, fsync() at intervals in
|
247
|
+
# order to force the operating system to flush the dirty
|
248
|
+
# buffers. Enable this to avoid sudden dirty buffer flushing from
|
249
|
+
# impacting read latencies. Almost always a good idea on SSD:s; not
|
250
|
+
# necessarily on platters.
|
251
|
+
trickle_fsync: false
|
252
|
+
trickle_fsync_interval_in_kb: 10240
|
253
|
+
|
254
|
+
# TCP port, for commands and data
|
255
|
+
storage_port: 7000
|
256
|
+
|
257
|
+
# SSL port, for encrypted communication. Unused unless enabled in
|
258
|
+
# encryption_options
|
259
|
+
ssl_storage_port: 7001
|
260
|
+
|
261
|
+
# Address to bind to and tell other Cassandra nodes to connect to. You
|
262
|
+
# _must_ change this if you want multiple nodes to be able to
|
263
|
+
# communicate!
|
264
|
+
#
|
265
|
+
# Leaving it blank leaves it up to InetAddress.getLocalHost(). This
|
266
|
+
# will always do the Right Thing *if* the node is properly configured
|
267
|
+
# (hostname, name resolution, etc), and the Right Thing is to use the
|
268
|
+
# address associated with the hostname (it might not be).
|
269
|
+
#
|
270
|
+
# Setting this to 0.0.0.0 is always wrong.
|
271
|
+
listen_address: localhost
|
272
|
+
|
273
|
+
# Address to broadcast to other Cassandra nodes
|
274
|
+
# Leaving this blank will set it to the same value as listen_address
|
275
|
+
# broadcast_address: 1.2.3.4
|
276
|
+
|
277
|
+
# The address to bind the Thrift RPC service to -- clients connect
|
278
|
+
# here. Unlike ListenAddress above, you *can* specify 0.0.0.0 here if
|
279
|
+
# you want Thrift to listen on all interfaces.
|
280
|
+
#
|
281
|
+
# Leaving this blank has the same effect it does for ListenAddress,
|
282
|
+
# (i.e. it will be based on the configured hostname of the node).
|
283
|
+
rpc_address: localhost
|
284
|
+
# port for Thrift to listen for clients on
|
285
|
+
rpc_port: 9160
|
286
|
+
|
287
|
+
# enable or disable keepalive on rpc connections
|
288
|
+
rpc_keepalive: true
|
289
|
+
|
290
|
+
# Cassandra provides three options for the RPC Server:
|
291
|
+
#
|
292
|
+
# sync -> One connection per thread in the rpc pool (see below).
|
293
|
+
# For a very large number of clients, memory will be your limiting
|
294
|
+
# factor; on a 64 bit JVM, 128KB is the minimum stack size per thread.
|
295
|
+
# Connection pooling is very, very strongly recommended.
|
296
|
+
#
|
297
|
+
# async -> Nonblocking server implementation with one thread to serve
|
298
|
+
# rpc connections. This is not recommended for high throughput use
|
299
|
+
# cases. Async has been tested to be about 50% slower than sync
|
300
|
+
# or hsha and is deprecated: it will be removed in the next major release.
|
301
|
+
#
|
302
|
+
# hsha -> Stands for "half synchronous, half asynchronous." The rpc thread pool
|
303
|
+
# (see below) is used to manage requests, but the threads are multiplexed
|
304
|
+
# across the different clients.
|
305
|
+
#
|
306
|
+
# The default is sync because on Windows hsha is about 30% slower. On Linux,
|
307
|
+
# sync/hsha performance is about the same, with hsha of course using less memory.
|
308
|
+
rpc_server_type: sync
|
309
|
+
|
310
|
+
# Uncomment rpc_min|max|thread to set request pool size.
|
311
|
+
# You would primarily set max for the sync server to safeguard against
|
312
|
+
# misbehaved clients; if you do hit the max, Cassandra will block until one
|
313
|
+
# disconnects before accepting more. The defaults for sync are min of 16 and max
|
314
|
+
# unlimited.
|
315
|
+
#
|
316
|
+
# For the Hsha server, the min and max both default to quadruple the number of
|
317
|
+
# CPU cores.
|
318
|
+
#
|
319
|
+
# This configuration is ignored by the async server.
|
320
|
+
#
|
321
|
+
# rpc_min_threads: 16
|
322
|
+
# rpc_max_threads: 2048
|
323
|
+
|
324
|
+
# uncomment to set socket buffer sizes on rpc connections
|
325
|
+
# rpc_send_buff_size_in_bytes:
|
326
|
+
# rpc_recv_buff_size_in_bytes:
|
327
|
+
|
328
|
+
# Frame size for thrift (maximum field length).
|
329
|
+
# 0 disables TFramedTransport in favor of TSocket. This option
|
330
|
+
# is deprecated; we strongly recommend using Framed mode.
|
331
|
+
thrift_framed_transport_size_in_mb: 15
|
332
|
+
|
333
|
+
# The max length of a thrift message, including all fields and
|
334
|
+
# internal thrift overhead.
|
335
|
+
thrift_max_message_length_in_mb: 16
|
336
|
+
|
337
|
+
# Set to true to have Cassandra create a hard link to each sstable
|
338
|
+
# flushed or streamed locally in a backups/ subdirectory of the
|
339
|
+
# Keyspace data. Removing these links is the operator's
|
340
|
+
# responsibility.
|
341
|
+
incremental_backups: false
|
342
|
+
|
343
|
+
# Whether or not to take a snapshot before each compaction. Be
|
344
|
+
# careful using this option, since Cassandra won't clean up the
|
345
|
+
# snapshots for you. Mostly useful if you're paranoid when there
|
346
|
+
# is a data format change.
|
347
|
+
snapshot_before_compaction: false
|
348
|
+
|
349
|
+
# Whether or not a snapshot is taken of the data before keyspace truncation
|
350
|
+
# or dropping of column families. The STRONGLY advised default of true
|
351
|
+
# should be used to provide data safety. If you set this flag to false, you will
|
352
|
+
# lose data on truncation or drop.
|
353
|
+
auto_snapshot: true
|
354
|
+
|
355
|
+
# Add column indexes to a row after its contents reach this size.
|
356
|
+
# Increase if your column values are large, or if you have a very large
|
357
|
+
# number of columns. The competing causes are, Cassandra has to
|
358
|
+
# deserialize this much of the row to read a single column, so you want
|
359
|
+
# it to be small - at least if you do many partial-row reads - but all
|
360
|
+
# the index data is read for each access, so you don't want to generate
|
361
|
+
# that wastefully either.
|
362
|
+
column_index_size_in_kb: 64
|
363
|
+
|
364
|
+
# Size limit for rows being compacted in memory. Larger rows will spill
|
365
|
+
# over to disk and use a slower two-pass compaction process. A message
|
366
|
+
# will be logged specifying the row key.
|
367
|
+
in_memory_compaction_limit_in_mb: 64
|
368
|
+
|
369
|
+
# Number of simultaneous compactions to allow, NOT including
|
370
|
+
# validation "compactions" for anti-entropy repair. Simultaneous
|
371
|
+
# compactions can help preserve read performance in a mixed read/write
|
372
|
+
# workload, by mitigating the tendency of small sstables to accumulate
|
373
|
+
# during a single long running compactions. The default is usually
|
374
|
+
# fine and if you experience problems with compaction running too
|
375
|
+
# slowly or too fast, you should look at
|
376
|
+
# compaction_throughput_mb_per_sec first.
|
377
|
+
#
|
378
|
+
# This setting has no effect on LeveledCompactionStrategy.
|
379
|
+
#
|
380
|
+
# concurrent_compactors defaults to the number of cores.
|
381
|
+
# Uncomment to make compaction mono-threaded, the pre-0.8 default.
|
382
|
+
#concurrent_compactors: 1
|
383
|
+
|
384
|
+
# Multi-threaded compaction. When enabled, each compaction will use
|
385
|
+
# up to one thread per core, plus one thread per sstable being merged.
|
386
|
+
# This is usually only useful for SSD-based hardware: otherwise,
|
387
|
+
# your concern is usually to get compaction to do LESS i/o (see:
|
388
|
+
# compaction_throughput_mb_per_sec), not more.
|
389
|
+
multithreaded_compaction: false
|
390
|
+
|
391
|
+
# Throttles compaction to the given total throughput across the entire
|
392
|
+
# system. The faster you insert data, the faster you need to compact in
|
393
|
+
# order to keep the sstable count down, but in general, setting this to
|
394
|
+
# 16 to 32 times the rate you are inserting data is more than sufficient.
|
395
|
+
# Setting this to 0 disables throttling. Note that this account for all types
|
396
|
+
# of compaction, including validation compaction.
|
397
|
+
compaction_throughput_mb_per_sec: 16
|
398
|
+
|
399
|
+
# Track cached row keys during compaction, and re-cache their new
|
400
|
+
# positions in the compacted sstable. Disable if you use really large
|
401
|
+
# key caches.
|
402
|
+
compaction_preheat_key_cache: true
|
403
|
+
|
404
|
+
# Throttles all outbound streaming file transfers on this node to the
|
405
|
+
# given total throughput in Mbps. This is necessary because Cassandra does
|
406
|
+
# mostly sequential IO when streaming data during bootstrap or repair, which
|
407
|
+
# can lead to saturating the network connection and degrading rpc performance.
|
408
|
+
# When unset, the default is 400 Mbps or 50 MB/s.
|
409
|
+
# stream_throughput_outbound_megabits_per_sec: 400
|
410
|
+
|
411
|
+
# Time to wait for a reply from other nodes before failing the command
|
412
|
+
rpc_timeout_in_ms: 10000
|
413
|
+
|
414
|
+
# Enable socket timeout for streaming operation.
|
415
|
+
# When a timeout occurs during streaming, streaming is retried from the start
|
416
|
+
# of the current file. This *can* involve re-streaming an important amount of
|
417
|
+
# data, so you should avoid setting the value too low.
|
418
|
+
# Default value is 0, which never timeout streams.
|
419
|
+
# streaming_socket_timeout_in_ms: 0
|
420
|
+
|
421
|
+
# phi value that must be reached for a host to be marked down.
|
422
|
+
# most users should never need to adjust this.
|
423
|
+
# phi_convict_threshold: 8
|
424
|
+
|
425
|
+
# endpoint_snitch -- Set this to a class that implements
|
426
|
+
# IEndpointSnitch. The snitch has two functions:
|
427
|
+
# - it teaches Cassandra enough about your network topology to route
|
428
|
+
# requests efficiently
|
429
|
+
# - it allows Cassandra to spread replicas around your cluster to avoid
|
430
|
+
# correlated failures. It does this by grouping machines into
|
431
|
+
# "datacenters" and "racks." Cassandra will do its best not to have
|
432
|
+
# more than one replica on the same "rack" (which may not actually
|
433
|
+
# be a physical location)
|
434
|
+
#
|
435
|
+
# IF YOU CHANGE THE SNITCH AFTER DATA IS INSERTED INTO THE CLUSTER,
|
436
|
+
# YOU MUST RUN A FULL REPAIR, SINCE THE SNITCH AFFECTS WHERE REPLICAS
|
437
|
+
# ARE PLACED.
|
438
|
+
#
|
439
|
+
# Out of the box, Cassandra provides
|
440
|
+
# - SimpleSnitch:
|
441
|
+
# Treats Strategy order as proximity. This improves cache locality
|
442
|
+
# when disabling read repair, which can further improve throughput.
|
443
|
+
# Only appropriate for single-datacenter deployments.
|
444
|
+
# - PropertyFileSnitch:
|
445
|
+
# Proximity is determined by rack and data center, which are
|
446
|
+
# explicitly configured in cassandra-topology.properties.
|
447
|
+
# - GossipingPropertyFileSnitch
|
448
|
+
# The rack and datacenter for the local node are defined in
|
449
|
+
# cassandra-rackdc.properties and propagated to other nodes via gossip. If
|
450
|
+
# cassandra-topology.properties exists, it is used as a fallback, allowing
|
451
|
+
# migration from the PropertyFileSnitch.
|
452
|
+
# - RackInferringSnitch:
|
453
|
+
# Proximity is determined by rack and data center, which are
|
454
|
+
# assumed to correspond to the 3rd and 2nd octet of each node's
|
455
|
+
# IP address, respectively. Unless this happens to match your
|
456
|
+
# deployment conventions (as it did Facebook's), this is best used
|
457
|
+
# as an example of writing a custom Snitch class.
|
458
|
+
# - Ec2Snitch:
|
459
|
+
# Appropriate for EC2 deployments in a single Region. Loads Region
|
460
|
+
# and Availability Zone information from the EC2 API. The Region is
|
461
|
+
# treated as the Datacenter, and the Availability Zone as the rack.
|
462
|
+
# Only private IPs are used, so this will not work across multiple
|
463
|
+
# Regions.
|
464
|
+
# - Ec2MultiRegionSnitch:
|
465
|
+
# Uses public IPs as broadcast_address to allow cross-region
|
466
|
+
# connectivity. (Thus, you should set seed addresses to the public
|
467
|
+
# IP as well.) You will need to open the storage_port or
|
468
|
+
# ssl_storage_port on the public IP firewall. (For intra-Region
|
469
|
+
# traffic, Cassandra will switch to the private IP after
|
470
|
+
# establishing a connection.)
|
471
|
+
#
|
472
|
+
# You can use a custom Snitch by setting this to the full class name
|
473
|
+
# of the snitch, which will be assumed to be on your classpath.
|
474
|
+
endpoint_snitch: SimpleSnitch
|
475
|
+
|
476
|
+
# controls how often to perform the more expensive part of host score
|
477
|
+
# calculation
|
478
|
+
dynamic_snitch_update_interval_in_ms: 100
|
479
|
+
# controls how often to reset all host scores, allowing a bad host to
|
480
|
+
# possibly recover
|
481
|
+
dynamic_snitch_reset_interval_in_ms: 600000
|
482
|
+
# if set greater than zero and read_repair_chance is < 1.0, this will allow
|
483
|
+
# 'pinning' of replicas to hosts in order to increase cache capacity.
|
484
|
+
# The badness threshold will control how much worse the pinned host has to be
|
485
|
+
# before the dynamic snitch will prefer other replicas over it. This is
|
486
|
+
# expressed as a double which represents a percentage. Thus, a value of
|
487
|
+
# 0.2 means Cassandra would continue to prefer the static snitch values
|
488
|
+
# until the pinned host was 20% worse than the fastest.
|
489
|
+
dynamic_snitch_badness_threshold: 0.1
|
490
|
+
|
491
|
+
# request_scheduler -- Set this to a class that implements
|
492
|
+
# RequestScheduler, which will schedule incoming client requests
|
493
|
+
# according to the specific policy. This is useful for multi-tenancy
|
494
|
+
# with a single Cassandra cluster.
|
495
|
+
# NOTE: This is specifically for requests from the client and does
|
496
|
+
# not affect inter node communication.
|
497
|
+
# org.apache.cassandra.scheduler.NoScheduler - No scheduling takes place
|
498
|
+
# org.apache.cassandra.scheduler.RoundRobinScheduler - Round robin of
|
499
|
+
# client requests to a node with a separate queue for each
|
500
|
+
# request_scheduler_id. The scheduler is further customized by
|
501
|
+
# request_scheduler_options as described below.
|
502
|
+
request_scheduler: org.apache.cassandra.scheduler.NoScheduler
|
503
|
+
|
504
|
+
# Scheduler Options vary based on the type of scheduler
|
505
|
+
# NoScheduler - Has no options
|
506
|
+
# RoundRobin
|
507
|
+
# - throttle_limit -- The throttle_limit is the number of in-flight
|
508
|
+
# requests per client. Requests beyond
|
509
|
+
# that limit are queued up until
|
510
|
+
# running requests can complete.
|
511
|
+
# The value of 80 here is twice the number of
|
512
|
+
# concurrent_reads + concurrent_writes.
|
513
|
+
# - default_weight -- default_weight is optional and allows for
|
514
|
+
# overriding the default which is 1.
|
515
|
+
# - weights -- Weights are optional and will default to 1 or the
|
516
|
+
# overridden default_weight. The weight translates into how
|
517
|
+
# many requests are handled during each turn of the
|
518
|
+
# RoundRobin, based on the scheduler id.
|
519
|
+
#
|
520
|
+
# request_scheduler_options:
|
521
|
+
# throttle_limit: 80
|
522
|
+
# default_weight: 5
|
523
|
+
# weights:
|
524
|
+
# Keyspace1: 1
|
525
|
+
# Keyspace2: 5
|
526
|
+
|
527
|
+
# request_scheduler_id -- An identifer based on which to perform
|
528
|
+
# the request scheduling. Currently the only valid option is keyspace.
|
529
|
+
# request_scheduler_id: keyspace
|
530
|
+
|
531
|
+
# index_interval controls the sampling of entries from the primrary
|
532
|
+
# row index in terms of space versus time. The larger the interval,
|
533
|
+
# the smaller and less effective the sampling will be. In technicial
|
534
|
+
# terms, the interval coresponds to the number of index entries that
|
535
|
+
# are skipped between taking each sample. All the sampled entries
|
536
|
+
# must fit in memory. Generally, a value between 128 and 512 here
|
537
|
+
# coupled with a large key cache size on CFs results in the best trade
|
538
|
+
# offs. This value is not often changed, however if you have many
|
539
|
+
# very small rows (many to an OS page), then increasing this will
|
540
|
+
# often lower memory usage without a impact on performance.
|
541
|
+
index_interval: 128
|
542
|
+
|
543
|
+
# Enable or disable inter-node encryption
|
544
|
+
# Default settings are TLS v1, RSA 1024-bit keys (it is imperative that
|
545
|
+
# users generate their own keys) TLS_RSA_WITH_AES_128_CBC_SHA as the cipher
|
546
|
+
# suite for authentication, key exchange and encryption of the actual data transfers.
|
547
|
+
# NOTE: No custom encryption options are enabled at the moment
|
548
|
+
# The available internode options are : all, none, dc, rack
|
549
|
+
#
|
550
|
+
# If set to dc cassandra will encrypt the traffic between the DCs
|
551
|
+
# If set to rack cassandra will encrypt the traffic between the racks
|
552
|
+
#
|
553
|
+
# The passwords used in these options must match the passwords used when generating
|
554
|
+
# the keystore and truststore. For instructions on generating these files, see:
|
555
|
+
# http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CreateKeystore
|
556
|
+
#
|
557
|
+
encryption_options:
|
558
|
+
internode_encryption: none
|
559
|
+
keystore: conf/.keystore
|
560
|
+
keystore_password: cassandra
|
561
|
+
truststore: conf/.truststore
|
562
|
+
truststore_password: cassandra
|
563
|
+
# More advanced defaults below:
|
564
|
+
# protocol: TLS
|
565
|
+
# algorithm: SunX509
|
566
|
+
# store_type: JKS
|
567
|
+
# cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA]
|