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 ...
随机推荐
- Linux系统——PXE高效能批量网络装机
PXE:Pre-boot Excution Environment,预启动执行环境,石油Intel公司开发的网络引导技术,工作在Client.Server模式,允许客户机通过网络从远程服务器下载阴道镜 ...
- 002-ubuntu安装
一.安装了ubuntu desktop版本后: 1.进行桥接联网. 2.运行更新:#sudo apt-get update. 3.安装net-tools网络工具包:#sudo apt install ...
- 倒计时60s
- LR和SVM的相同和不同
之前一篇博客中介绍了Logistics Regression的理论原理:http://www.cnblogs.com/bentuwuying/p/6616680.html. 在大大小小的面试过程中,经 ...
- CTC(Connectionist Temporal Classification)介绍
CTC解决什么问题 CTC,Connectionist Temporal Classification,用来解决输入序列和输出序列难以一一对应的问题. 举例来说,在语音识别中,我们希望音频中的音素和翻 ...
- 把HDFS上的数据导入到Hive中
1. 首先下载测试数据,数据也可以创建 http://files.grouplens.org/datasets/movielens/ml-latest-small.zip 2. 数据类型与字段名称 m ...
- 新项目新工作空间新仓库新setting文件
maven项目涉及到仓库,本地jar包存放在本地仓库中,新项目新工作空间新仓库新setting文件,可以避免很多问题,不同项目工程的版本可能不一样,所涉及的jar包版本可能也不一样,不分开会有一些冲 ...
- Python入门学习之路,怎么 “开心,高效,踏实” 地把Python学好?兴趣,兴趣,兴趣!
Python入门学习之路,怎么 “开心,高效,踏实” 地把Python学好?兴趣,兴趣,兴趣!找到你自己感兴趣的点进行切入,并找到兴趣点进行自我驱动是最好的学习方式! 推荐两本书,一本作为 ...
- JDBC报错记录
用JDBC连接oracle时 有如下问题: 问题一.java.lang.ClassNotFoundException: oracle.jdbc.driver.oracledriver 解决: 可以在环 ...
- SQLServer 进阶记录式学习
1.强制类型转换 nvarchar->decimal ) , , ) SET @i = '1083.589' SET @num = @i SELECT @num , )) SELECT @nu ...