Last active
October 20, 2018 07:49
-
-
Save bassaer/3b333bee706be64caa0ca26215ec399b to your computer and use it in GitHub Desktop.
cassandraセットアップメモ ref: https://qiita.com/bassaer/items/caaa4e78f98040e87c93
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
#start_rpc: false | |
start_rpc: true | |
#rpc_address: localhost | |
rpc_address: 192.168.33.10 |
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
❯ java -version | |
openjdk version "1.8.0_131" | |
OpenJDK Runtime Environment (build 1.8.0_131-b12) | |
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode) |
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
❯ wget http://archive.apache.org/dist/cassandra/3.11.1/apache-cassandra-3.11.1-bin.tar.gz |
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
cqlsh:mykeyspace> CREATE INDEX ON users (lname); | |
cqlsh:mykeyspace> SELECT * FROM users WHERE lname = 'smith'; | |
user_id | fname | lname | |
---------+-------+------- | |
1745 | john | smith | |
1746 | john | smith | |
(2 rows) |
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
❯ cqlsh 192.168.33.10 | |
Connection error: ('Unable to connect to any servers', {'192.168.33.10': error(61, "Tried connecting to [('192.168.33.10', 9042)]. Last error: Connection refused")}) |
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
❯ cqlsh 192.168.33.10 | |
Connected to Test Cluster at 192.168.33.10:9042. | |
[cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4] | |
Use HELP for help. | |
cqlsh> |
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
❯ tar xzvf apache-cassandra-3.11.1-bin.tar.gz | |
apache-cassandra-3.11.1/bin/ | |
apache-cassandra-3.11.1/conf/ | |
apache-cassandra-3.11.1/conf/triggers/ | |
... | |
❯ cd apache-cassandra-3.11.1 | |
~/apache-cassandra-3.11.1 localhost.localdomain | |
❯ ll | |
合計 488K | |
drwxr-xr-x. 2 vagrant vagrant 4.0K 10月 1 01:10 bin | |
drwxr-xr-x. 3 vagrant vagrant 4.0K 10月 1 01:10 conf | |
drwxr-xr-x. 4 vagrant vagrant 45 10月 1 01:10 doc | |
drwxr-xr-x. 2 vagrant vagrant 30 10月 1 01:10 interface | |
drwxr-xr-x. 3 vagrant vagrant 4.0K 10月 1 01:10 javadoc | |
drwxr-xr-x. 4 vagrant vagrant 4.0K 10月 1 01:10 lib | |
drwxr-xr-x. 3 vagrant vagrant 38 10月 1 01:10 pylib | |
drwxr-xr-x. 4 vagrant vagrant 135 10月 1 01:10 tools | |
-rw-r--r--. 1 vagrant vagrant 347K 10月 3 2017 CHANGES.txt | |
-rw-r--r--. 1 vagrant vagrant 12K 10月 3 2017 LICENSE.txt | |
-rw-r--r--. 1 vagrant vagrant 105K 10月 3 2017 NEWS.txt | |
-rw-r--r--. 1 vagrant vagrant 2.8K 10月 3 2017 NOTICE.txt |
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
~/apache-cassandra-3.11.1 localhost.localdomain | |
❯ bin/cassandra -f | |
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N | |
... |
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
❯ bin/cqlsh | |
Connected to Test Cluster at 127.0.0.1:9042. | |
[cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4] | |
Use HELP for help. | |
cqlsh> |
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
cqlsh> CREATE KEYSPACE mykeyspace | |
... WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; |
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
cqlsh> USE mykeyspace; | |
cqlsh:mykeyspace> |
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
cqlsh:mykeyspace> CREATE TABLE users ( | |
... user_id int PRIMARY KEY, | |
... fname text, | |
... lname text | |
... ); |
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
cqlsh:mykeyspace> INSERT INTO users (user_id, fname, lname) | |
... VALUES (1745, 'john', 'smith'); | |
cqlsh:mykeyspace> INSERT INTO users (user_id, fname, lname) | |
... VALUES (1744, 'john', 'doe'); | |
cqlsh:mykeyspace> INSERT INTO users (user_id, fname, lname) | |
... VALUES (1746, 'john', 'smith'); |
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
cqlsh:mykeyspace> SELECT * FROM users; | |
user_id | fname | lname | |
---------+-------+------- | |
1745 | john | smith | |
1744 | john | doe | |
1746 | john | smith | |
(3 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment