Skip to content

Instantly share code, notes, and snippets.

sed -i "1s/ip-.*//g" /etc/hosts
sed -i "1s/$/ $(hostname)/g" /etc/hosts
sed -i "s/^listen_address:.*$/listen_address: $(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)/" /usr/local/cassandra/conf/cassandra.yaml
sed -i "s/^initial_token:.*$/initial_token: $1/" /usr/local/cassandra/conf/cassandra.yaml
sed -i "s/^auto_bootstrap:.*$/auto_bootstrap: $2/" /usr/local/cassandra/conf/cassandra.yaml
sed -i "s/^ - seeds:.*/ - seeds: \"$3\"/" /usr/local/cassandra/conf/cassandra.yaml
/etc/init.d/cassandra start
cluster_name: 'クラスタ名'
initial_token: トークン
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
- seeds: "シードIP"
listen_address: 自分のIP
endpoint_snitch: Ec2Snitch
#!/usr/bin/python
import sys
argvs = sys.argv
tokenc = int(argvs[1])
def tokens(num_nodes):
for i in range(num_nodes):
print ((2**64 / num_nodes) * i) - 2**63
#RandomPartitionerの場合
def tokens(nodes):
for x in xrange(nodes):
print 2 ** 127 / nodes * x
#Murmur3Partitionerの場合
def tokens(num_nodes):
for i in range(num_nodes):
./tpcc_load 10.0.1.58 deflag memorycraft xxxxxxxxx 10
mysql> OPTIMIZE TABLE order_line;
+-------------------+----------+----------+-------------------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+-------------------+----------+----------+-------------------------------------------------------------------+
| deflag.order_line | optimize | note | Table does not support optimize, doing recreate + analyze instead |
| deflag.order_line | optimize | status | OK |
+-------------------+----------+----------+-------------------------------------------------------------------+
2 rows in set (57.53 sec)
mysql> delete from stock where s_i_id % 2 = 0;
Query OK, 500000 rows affected (49.63 sec)
mysql> delete from order_line where ol_o_id % 2 = 0;
Query OK, 789689 rows affected (22.29 sec)
mysql> delete from customer where c_id % 2 = 0;
Query OK, 150000 rows affected (15.08 sec)
mysql> ALTER TABLE order_line ENGINE=InnoDB;
Query OK, 790679 rows affected (31.92 sec)
Records: 790679 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE customer ENGINE=InnoDB;
Query OK, 150000 rows affected (14.18 sec)
Records: 150000 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE stock ENGINE=InnoDB;
Query OK, 500000 rows affected (30.85 sec)
mysql> delete from order_line where ol_number % 2 = 0;
Query OK, 1417106 rows affected (45.03 sec)
#!/bin/sh
/etc/cloud/cassandra.sh 1111111111111 true