Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DROP KEYSPACE demodb;
- DROP USER dba;
- DROP USER dba_rw;
- DROP USER dba_ro;
- DROP USER dba_schema;
- CREATE KEYSPACE demodb WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};
- CREATE TABLE demodb.users (name text PRIMARY KEY, password text);
- INSERT INTO demodb.users (name, password) values ('user1', 'password1');
- INSERT INTO demodb.users (name, password) values ('user2', 'password2');
- INSERT INTO demodb.users (name, password) values ('user3', 'password3');
- INSERT INTO demodb.users (name, password) values ('user4', 'password4');
- //create a super user with "dba" name and password "super"
- CREATE ROLE dba WITH SUPERUSER = true AND LOGIN = true AND PASSWORD = 'super';
- //create a RW user
- CREATE USER dba_rw WITH PASSWORD 'password';
- GRANT SELECT ON ALL KEYSPACES TO dba_rw;
- GRANT MODIFY ON ALL KEYSPACES TO dba_rw;
- //create a R user
- CREATE USER dba_ro WITH PASSWORD 'password';
- GRANT SELECT ON ALL KEYSPACES TO dba_ro;
- //create a SCHEMA Modifier
- CREATE USER dba_schema WITH PASSWORD 'password';
- GRANT ALTER ON ALL KEYSPACES TO dba_schema;
- GRANT MODIFY ON ALL KEYSPACES TO dba_schema;
- GRANT SELECT ON ALL KEYSPACES TO dba_schema;
- GRANT CREATE ON ALL KEYSPACES TO dba_schema;
- GRANT DROP ON ALL KEYSPACES TO dba_schema;
Add Comment
Please, Sign In to add comment