cassandra2.1

cassandra 2.1以上版本採用backlog日誌

vi conf/logback.xml
bin/cassandra -fl
bin/nodetool status
bin/cqlsh

create keyspace

create keyspace mykeyspace with replication={‘class’:’SimpleStrategy’,’replication_factor’:1};
use mykeyspace;

create table

create table test(id int primary key,value text)
with bloom_filter_fp_chance=1.0;
alter table test with bloom_filter_fp_chance=1.0;

create table users(user_id int primary key,fname text,lname text)
with bloom_filter_fp_chance=1.0;
insert into users (user_id,fname,lname) values(1,’john’,’smith’);
insert into users (user_id,fname,lname) values(3,’3’,’chang’);
insert into users (user_id,fname,lname) values(1,’john’,’smith’);
insert into users (user_id,fname,lname) values(3,’john’,’smith’);

management

select * from system.schema_keyspaces;
desc keyspaces;
desc keyspace mykeyspace;
desc tables;
desc test;
desc users;

select

select from test;
select
from users where user_id=2;

create index

create index on test(id);
create index on users(lname);
select from users where lname=’chang’;
select
from users where lname=’smith’;

exit cqlsh

ctrl+D 結束