Update README for archival
[reddit.git] / install / setup_cassandra.sh
blob57a9a81e25cccab75e1c59fdc9ddf35c95af23ab
1 #!/bin/bash
2 # The contents of this file are subject to the Common Public Attribution
3 # License Version 1.0. (the "License"); you may not use this file except in
4 # compliance with the License. You may obtain a copy of the License at
5 # http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
6 # License Version 1.1, but Sections 14 and 15 have been added to cover use of
7 # software over a computer network and provide for limited attribution for the
8 # Original Developer. In addition, Exhibit A has been modified to be consistent
9 # with Exhibit B.
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
13 # the specific language governing rights and limitations under the License.
15 # The Original Code is reddit.
17 # The Original Developer is the Initial Developer. The Initial Developer of
18 # the Original Code is reddit Inc.
20 # All portions of the code written by reddit are Copyright (c) 2006-2015 reddit
21 # Inc. All Rights Reserved.
22 ###############################################################################
24 ###############################################################################
25 # Configure Cassandra
26 ###############################################################################
28 # update the per-thread stack size. this used to be set to 256k in cassandra
29 # version 1.2.19, but we recently downgraded to 1.2.11 where it's set too low
30 sed -i -e 's/-Xss180k/-Xss256k/g' /etc/cassandra/cassandra-env.sh
32 python <<END
33 import pycassa
34 sys = pycassa.SystemManager("localhost:9160")
36 if "reddit" not in sys.list_keyspaces():
37 print "creating keyspace 'reddit'"
38 sys.create_keyspace("reddit", "SimpleStrategy", {"replication_factor": "1"})
39 print "done"
41 if "permacache" not in sys.get_keyspace_column_families("reddit"):
42 print "creating column family 'permacache'"
43 sys.create_column_family("reddit", "permacache")
44 print "done"
45 END