tmp for cassandra batch delete
now i have no time to verify this bash script. it is hard for me to delete each data via primary key
#!/bin/bash
if [[ ${1} == "" ]];then
echo "Please indicate the cassandra Address."
echo "Use this cmd like this:"
echo "./clear_data.sh 192.102.1.1"
exit
fi;
arr=(`cqlsh ${1} -f list_tables.cmd`)
echo "table list: ${arr[*]}"
for((i=0; i<${#arr[@]}; i++));do
count=(`cqlsh ${1} -e "use clicki_v4; select count(*) from ${arr[i]};"`)
#echo ${count[*]}
echo "before truncate table, there are ${count[2]} rows in table ${arr[i]};"
#====================================
#NOTE: dangerous command, please seriously check!!!!!!
cqlsh ${1} -e "use clicki_v4; truncate ${arr[i]};"
#====================================
count=(`cqlsh ${1} -e "use clicki_v4; select count(*) from ${arr[i]}"`)
echo "after truncate table, there are ${count[2]} rows in table ${arr[i]};"
done;
--目前就一个库clicki_v4,后续可以继续增加...
use clicki_v4;
desc tables;
CREATE TABLE coach_uat.mytable (
uid text,
id int,
name text,
PRIMARY KEY (uid),
);
CREATE TABLE coach_uat.mytable(
key1 text,
key2 text,
key3 text,
column1 bigint,
column2 int,
column3 timestamp,
primary key(key1, key2, key3);
)
tmp for cassandra batch delete的更多相关文章
- Cassandra 安装部署
Linux 系统安装Cassandra 一.Cassandra需要安装jdk支持,首先安装jdk 自行百度查找安装 二.下载Cassandra 官网地址: https://cassandra.apac ...
- Ubuntu18.04 LTS 搭建Cassandra集群
环境需求 jdk8 root@node01:~# java -version java version "1.8.0_202" Java(TM) SE Runtime Enviro ...
- [LeetCode] Delete Node in a Linked List 删除链表的节点
Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...
- [LintCode] Delete Node in the Middle of Singly Linked List 在单链表的中间删除节点
Implement an algorithm to delete a node in the middle of a singly linked list, given only access to ...
- 237. Delete Node in a Linked List(C++)
237. Delete Node in a Linked Lis t Write a function to delete a node (except the tail) in a singly l ...
- rsync同步时,删除目标目录比源目录多余文件的方法(--delete)
在日常运维工作中,我们经常用到rsync这个同步神器.有时在同步两个目录时,会要求删除目标目录中比源目录多出的文件,这种情况下,就可用到rsync的--delete参数来实现这个需求了. 实例说明:在 ...
- 关于dbutils中QueryRunner看批量删除语句batch
//批量删除 public void delBooks(String[] ids) throws SQLException { QueryRunner qr = new QueryRunner(C3P ...
- 237 Delete Node in a Linked List 删除链表的结点
编写一个函数,在给定单链表一个结点(非尾结点)的情况下,删除该结点. 假设该链表为1 -> 2 -> 3 -> 4 并且给定你链表中第三个值为3的节点,在调用你的函数后,该链表应变为 ...
- [LeetCode] 237. Delete Node in a Linked List 删除链表的节点
Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...
随机推荐
- 在django项目中使用django-ckeditor
安装django-ckeditor pip install django-ckeditor 安装Pillow Pillow是python的一个图像处理库,django-ckeditor需要依赖该库.最 ...
- soapUI-Groovy Script
1.1.1 Groovy Script soapUI通过以groovy语言编写的脚本来大量支持您的项目. Groovy脚本TestSteps可用于向功能TestCase添加任意功能. 脚本断言用于任 ...
- [LeetCode] 161. One Edit Distance_Medium
Given two strings s and t, determine if they are both one edit distance apart. Note: There are 3 pos ...
- 机器学习理论基础学习13--- 隐马尔科夫模型 (HMM)
隐含马尔可夫模型并不是俄罗斯数学家马尔可夫发明的,而是美国数学家鲍姆提出的,隐含马尔可夫模型的训练方法(鲍姆-韦尔奇算法)也是以他名字命名的.隐含马尔可夫模型一直被认为是解决大多数自然语言处理问题最为 ...
- Qt5
最简单的分割窗体 #include <QApplication> #include <QLabel> #include <QSplitter> int main(i ...
- !!【通达信】求教:如何对A股的所有股票按照某个选股指标的某个参数排序? - 理想论坛 中国人气最旺的股票论坛
http://www.55188.com/thread-7152852-1-1.html .401进入指标排序,然后占右键把指标更改为MACD即可.(注意401前投资面有一个点!)
- MySQL实现SQL Server排名函数
最近在MySQL中遇到分组排序查询时,突然发现MySQL中没有row_number() over(partition by colname)这样的分组排序.并且由于MySQL中没有类似于SQL Ser ...
- 021-centos6.5上二进制安装mysql5.7.22
思路: 下载上传mysql的二进制安装包. 准备好mysql的用户.安装目录basedir.数据目录datadir.配置文件/etc/my.cnf. 初始化出数据库. 配置启动服务. 开机启动. 配置 ...
- fafu 1411
想了好久都没想到怎么去判断当分类dp的时候大于或者等于要求的 值时应该怎么半 后来经过停了 qlx的想法 然后就 敲了出来 这题说的是 一个整数 分解成几个素数的和 按这个数的含有的最大素数 进行排 ...
- Python: itertools.compress()
定义: itertools.compress() 输入: iterable对象 相应的Boolean选择器序列 输出: iterable对象中对应选择器为True的元素 用途: 当需要用另外一个相关联 ...