scylladb简单命令介绍
一、cql 命令
查看连接的数据库地址
SHOW HOST
批量执行.cql文件中的命令
SOURCE '/home/thobbs/commands.cql'
开启和关闭命令追踪
TRACING ON
TRACING OFF
查看命令:
DESCRIBE CLUSTER
DESCRIBE SCHEMA
DESCRIBE KEYSPACES
DESCRIBE KEYSPACE <keyspace name>
DESCRIBE TABLES
DESCRIBE TABLE <table name>
增删查改相关命令:
CREATE KEYSPACE
USE
ALTER KEYSPACE
DROP KEYSPACE
CREATE TABLE
ALTER TABLE
DROP TABLE
官网cqlsh命令参考链接:https://docs.scylladb.com/stable/cql/cqlsh.html#
--cqlsh连接测试
[root@172-16-121-151 ~]# cqlsh 172.16.121.151
Connected to dtstack at 172.16.121.151:9042.
[cqlsh 5.0.1 | Cassandra 3.0.8 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
cqlsh>
--查看所有keyspace;
cqlsh> desc keyspaces;
test1 system_schema system system_distributed system_traces
test2 system_auth test_singe test example
创建keyspace和表
cqlsh> CREATE KEYSPACE test3 WITH REPLICATION = {'class':'NetworkTopologyStrategy', 'my_data_center' : '3', 'my_data_center1' : '3'};
cqlsh> use test;
cqlsh:test> CREATE TABLE test(id int PRIMARY KEY, user_name varchar, age varchar, sex varchar, character varchar);
cqlsh:test> INSERT INTO test (id,user_name,age,sex,character) VALUES (1,'zhangsan', '18', 'man', 'funny');
cqlsh:test>
cqlsh:test> select * from test;
id | age | character | sex | user_name
----+-----+-----------+-----+-----------
1 | 18 | funny | man | zhangsan
--查看具体的keyspace
cqlsh:test> desc test;
CREATE KEYSPACE test WITH replication = {'class': 'NetworkTopologyStrategy', 'my_data_center': '3', 'my_data_center1': '3'} AND durable_writes = true;
CREATE TABLE test.test (
id int PRIMARY KEY,
age text,
character text,
sex text,
user_name text
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'}
AND comment = ''
AND compaction = {'class': 'SizeTieredCompactionStrategy'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.0
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';
二、nodetool命令
nodetool describering <keyspacename>
nodetool -h ::FFFF:127.0.0.1 repair
nodetool命令官网参考链接:https://docs.scylladb.com/stable/operating-scylla/nodetool.html