# yum -y install java # vi /etc/yum.repos.d/datastax.repo [datastax] name = DataStax Repo for Apache Cassandra baseurl = http://rpm.datastax.com/community enabled = 1 gpgcheck = 0 # yum -y install dsc22 # systemctl enable cassandra # systemctl start cassandra # cqlsh cqlsh> quit
cqlsh> create keyspace myspace with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; cqlsh> use mySpace; cqlsh:myspace> create table users ( user_id int PRIMARY KEY, user_name text ); cqlsh:myspace> insert into users ( user_id, user_name ) values ( 101, 'yamada' ); cqlsh:myspace> insert into users ( user_id, user_name ) values ( 102, 'suzuki' ); cqlsh:myspace> insert into users ( user_id, user_name ) values ( 103, 'tanaka' ); cqlsh:myspace> select * from users;
MySQL | Cassandra |
---|---|
データベース | キースペース |
テーブル | カラムファミリー |
主キー | キー |
- | (スーパーカラム) |
フィールド(カラム) | カラム |
cqlsh> create keyspace キースペース名; cqlsh> drop keyspace キースペース名; cqlsh> use キースペース名; cqlsh> describe keyspace;