我必须在我的键空间中创建多个列族。一种方法是一个一个地创建列族。但就我而言,我有大约 100 个列族,所以我不能一个一个地做……所以有什么办法,我可以通过某种方式创建多个列族可以在短时间内为我创建多个列族的脚本?
create column family USER_DATA_SECOND_1
with comparator = 'UTF8Type'
and key_validation_class = 'CompositeType(DateType,UTF8Type)'
and default_validation_class = 'BytesType'
and gc_grace = 86400
create column family USER_DATA_SECOND_2
with comparator = 'UTF8Type'
and key_validation_class = 'CompositeType(DateType,UTF8Type)'
and default_validation_class = 'BytesType'
and gc_grace = 86400
create column family USER_DATA_SECOND_3
with comparator = 'UTF8Type'
and key_validation_class = 'CompositeType(DateType,UTF8Type)'
and default_validation_class = 'BytesType'
and gc_grace = 86400
....
....
....
create column family USER_DATA_SECOND_100
with comparator = 'UTF8Type'
and key_validation_class = 'CompositeType(DateType,UTF8Type)'
and default_validation_class = 'BytesType'
and gc_grace = 86400
并且在创建这些多个列族之后..假设如果我需要再次删除所有这些列族,那么如何再次使用一些脚本来做到这一点?
下面是方法,我现在正在从我的本地机器到我的登台 cassandra 服务器一个一个地创建列族,这不是我想要的..
C:\Apache Cassandra\apache-cassandra-1.2.3\bin>cassandra-cli -h sc-cdbhost01.vip.slc.qa.host.com
Starting Cassandra Client
Connected to: "Staging Cluster cass01" on sc-cdbhost01.vip.slc.qa.host.com/9160
Welcome to Cassandra CLI version 1.2.3
Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.
[default@unknown] use profileks;
Authenticated to keyspace: profileks
[default@profileks] create column family USER_DATA_SECOND_1
... with comparator = 'UTF8Type'
... and key_validation_class = 'CompositeType(DateType,UTF8Type)'
... and default_validation_class = 'BytesType'
... and gc_grace = 86400;
27fe1848-c7de-3994-9289-486a9bbbf344
[default@profileks]
谁能帮助我是否可以通过某种脚本创建多个列族,然后通过某种脚本也删除这些列族?