How to Alter Keyspace in Cassandra by using CQL
To create the Keyspace in Cassandra Query Language we use "Create Keyspace Keyspace_Name with options". To Alter existing Keyspace in Cassandra , we can use "Alter Keyspace Keyspace_Name with Options".Let's say we have created TechBrothersTutorials keyspace by using below script.
CQLSH:techbrotherstutorials> CREATE keyspace techbrotherstutorials
WITH REPLICATION = {'class': 'NetworkTopologyStrategy', 'DC1' : 2, 'DC2' : 1}
AND durable_writes = false;
AND durable_writes = false;
Let's check if TechbrothersTutorial Keyspace is created successfully.
CQLSH:techbrotherstutorials>SELECT * FROM system_schema.keyspaces;
Figure 1- CQL Tutorial - Check the definition of keyspace by using system_schema.keyspaces in CQL
Now if we would like to Alter TechBrothersTutorials keyspace from Replication Strategy "NetworkTopologyStrategy" to "SimpleStrategy" ,replication factor=3 and DURABLE_WRITES = true, we can use below statement.
CQLSH:techbrotherstutorials> ALTER keyspace techbrotherstutorials
WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor' : 3}
AND durable_writes = true;
AND durable_writes = true;
Let's check the definition of TechBrothersTutorials keyspace after executing above script to verification changes are completed successfully.
CQLSH:techbrotherstutorials>SELECT * FROM system_schema.keyspaces;
Đặt vé máy bay tại Aivivu, tham khảo
ReplyDeletevé máy bay đi Mỹ giá rẻ 2021
mua vé máy bay từ mỹ về việt nam hãng eva
từ canada về việt nam quá cảnh ở đâu
chuyến bay thương mại từ nhật về việt nam
Máy bay từ Hàn Quốc về Việt Nam
Vé máy bay từ Đài Loan về Việt Nam
khách sạn cách ly tphcm