April 2017
Beginner to intermediate
360 pages
9h 35m
English
Let's create the keyspaces with replication factors 2 and 3 as discussed in the preceding section. To distinguish both the keyspaces, we will include the replication factor within the name. Create keyspaces as follows:
CREATE KEYSPACE "keyspace2" WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor': 2 }; CREATE KEYSPACE "keyspace3" WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor': 3 };
Here, keyspace2 has a replication factor of 2, and keyspace3 has a replication factor of 3. After creating the keyspaces, let's recreate our users table within both the keyspaces with the default settings:
CREATE TABLE "keyspace2"."users" ( "username" text PRIMARY KEY, "email" text, "encrypted_password" ...Read now
Unlock full access