Created
October 18, 2013 06:26
-
-
Save ranjib/7037271 to your computer and use it in GitHub Desktop.
Create cassandra using jugaad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cluster_name: 'jugaad' | |
num_tokens: 256 | |
hinted_handoff_enabled: true | |
max_hint_window_in_ms: 10800000 # 3 hours | |
hinted_handoff_throttle_in_kb: 1024 | |
max_hints_delivery_threads: 2 | |
authenticator: AllowAllAuthenticator | |
authorizer: AllowAllAuthorizer | |
permissions_validity_in_ms: 2000 | |
partitioner: org.apache.cassandra.dht.Murmur3Partitioner | |
data_file_directories: | |
- /var/lib/cassandra/data | |
commitlog_directory: /var/lib/cassandra/commitlog | |
disk_failure_policy: stop | |
key_cache_size_in_mb: | |
key_cache_save_period: 14400 | |
row_cache_size_in_mb: 0 | |
row_cache_save_period: 0 | |
saved_caches_directory: /var/lib/cassandra/saved_caches | |
commitlog_sync: periodic | |
commitlog_sync_period_in_ms: 10000 | |
commitlog_segment_size_in_mb: 32 | |
seed_provider: | |
- class_name: org.apache.cassandra.locator.SimpleSeedProvider | |
parameters: | |
- seeds: "<%=@ip%>" | |
concurrent_reads: 32 | |
concurrent_writes: 32 | |
memtable_flush_queue_size: 4 | |
trickle_fsync: false | |
trickle_fsync_interval_in_kb: 10240 | |
storage_port: 7000 | |
ssl_storage_port: 7001 | |
listen_address: <%=@ip%> | |
start_native_transport: true | |
native_transport_port: 9042 | |
start_rpc: true | |
rpc_address: <%=@ip%> | |
rpc_port: 9160 | |
rpc_keepalive: true | |
rpc_server_type: sync | |
thrift_framed_transport_size_in_mb: 15 | |
incremental_backups: false | |
snapshot_before_compaction: false | |
auto_snapshot: true | |
column_index_size_in_kb: 64 | |
in_memory_compaction_limit_in_mb: 64 | |
multithreaded_compaction: false | |
compaction_throughput_mb_per_sec: 16 | |
compaction_preheat_key_cache: true | |
read_request_timeout_in_ms: 5000 | |
range_request_timeout_in_ms: 10000 | |
write_request_timeout_in_ms: 2000 | |
cas_contention_timeout_in_ms: 1000 | |
truncate_request_timeout_in_ms: 60000 | |
request_timeout_in_ms: 10000 | |
cross_node_timeout: false | |
endpoint_snitch: SimpleSnitch | |
dynamic_snitch_update_interval_in_ms: 100 | |
dynamic_snitch_reset_interval_in_ms: 600000 | |
dynamic_snitch_badness_threshold: 0.1 | |
request_scheduler: org.apache.cassandra.scheduler.NoScheduler | |
server_encryption_options: | |
internode_encryption: none | |
keystore: conf/.keystore | |
keystore_password: cassandra | |
truststore: conf/.truststore | |
truststore_password: cassandra | |
client_encryption_options: | |
enabled: false | |
keystore: conf/.keystore | |
keystore_password: cassandra | |
internode_compression: all | |
auto_bootstrap: <%=@auto_bootstrap%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'jugaad' | |
LXC.use_sudo = true | |
nodes = [] | |
3.times do |n| | |
name = 'cassandra-'+ n.to_s | |
node = build_cassandra(name) | |
nodes << node | |
end | |
configure_cassandra(nodes.first) | |
configure_cassandra(nodes[1], true, nodes.first.ipv4) | |
configure_cassandra(nodes[2], true, nodes.first.ipv4) | |
def configure_cassandra(node, auto_bootstrap=false, seeder=nil) | |
node.chef_recipe "cassandra_master" do | |
template "/opt/apache-cassandra-2.0.1/conf/cassandra.yaml" do | |
source "/tmp/cass.yaml.erb" | |
local true | |
variables(ip: node.ipv4, auto_bootstrap: auto_bootstrap, seeder: seeder) | |
end | |
execute "start_cassandra" do | |
command "/opt/apache-cassandra-2.0.1/bin/cassandra -p /opt/cass.pid" | |
not_if "pgrep -f cassandra" | |
end | |
end | |
end | |
def build_cassandra(name) | |
node = LXC::Container.new(name) | |
node.create(template:'ubuntu', template_dir: '/usr/share/lxc/templates') | |
node.ssh_user = 'ubuntu' | |
node.ssh_password = 'ubuntu' | |
node.start | |
sleep 6 | |
node.ssh!(command: 'sudo apt-get update -y') | |
node.install_chef | |
node.chef_recipe "install_cassandra" do | |
package "openjdk-7-jdk" | |
remote_file "/opt/apache-cassandra-2.0.1-bin.tar.gz" do | |
source 'http://mirror.nexcess.net/apache/cassandra/2.0.1/apache-cassandra-2.0.1-bin.tar.gz' | |
not_if "test -f /opt/apache-cassandra-2.0.1-bin.tar.gz" | |
end | |
execute "tar -C /opt -zxf /opt/apache-cassandra-2.0.1-bin.tar.gz" do | |
not_if "test -f /opt/apache-cassandra-2.0.1/bin/cassandra" | |
cwd '/opt' | |
end | |
end | |
node | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment