Trong bài đăng này, tôi đang chia sẻ danh sách các lệnh shell CQL quan trọng của Cassandra.
Nhận sự trợ giúp của tất cả các lệnh:
1 | cassandra@cqlsh:dbrnd> help |
Kiểm tra máy chủ và phiên bản:
1 2 3 4 | cassandra@cqlsh:dbrnd> show host Connected to Test Cluster at 127.0.0.1:9042. cassandra@cqlsh:dbrnd> show version [cqlsh 5.0.1 | Cassandra 3.5 | CQL spec 3.4.0 | Native protocol v4] |
Kiểm tra thông tin cụm:
1 2 3 4 5 6 7 8 9 | cassandra@cqlsh:dbrnd> describe cluster; Cluster: Test Cluster Partitioner: Murmur3Partitioner Range ownership: 7198801157164107876 [127.0.0.1] -6388269565477727734 [127.0.0.1] -13424558412243369 [127.0.0.1] |
Kiểm tra không gian bàn phím:
1 2 3 4 | cassandra@cqlsh:dbrnd> describe keyspaces; tutorialspoint system_auth dbrnd test system_schema system system_distributed system_traces |
Kiểm tra các bảng do người dùng xác định:
1 2 3 | cassandra@cqlsh:dbrnd> describe tables; tbl_employee tbl_department users |
Kiểm tra các loại do người dùng xác định:
1 2 3 | cassandra@cqlsh:dbrnd> describe types sports_details sport |
Kiểm tra mức độ nhất quán:
1 2 | cassandra@cqlsh:dbrnd> consistency Current consistency level is ONE. |
Mở rộng đầu ra bảng của bạn:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | cassandra@cqlsh:dbrnd> expand on Now Expanded output is enabled cassandra@cqlsh:dbrnd> select *from tbl_employee; @ Row 1 --------------+-------- empid | 1 empfirstname | Anvesh emplastname | Patel empsalary | 50000 @ Row 2 --------------+-------- empid | 2 empfirstname | Neevan emplastname | Patel empsalary | 150000 (2 rows) |