Cassandra问题v3.11.3 ...从table1中选择count(*) [英] Cassandra question v3.11.3 ... select count(*) from table1

查看:162
本文介绍了Cassandra问题v3.11.3 ...从table1中选择count(*)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在一个表中导入了1条以上的核心记录,当我选择查询计数(*)时,它给了我错误。我知道这是一个代价高昂的查询,但是,有谁能帮我得到相同的解决方案。

I have imported more than 1 core records in a table and when I do Select query count(*) it gives me error. I know it is a costly query but, can any one help me get a solution for the same.

从TABLE1中选择COUNT(*);

SELECT COUNT(*) FROM TABLE1;

错误:OperationTimedOut:错误= {'10.20.30.10':'客户端请求超时。参见Session.execute_async'},last_host = 10.20.30.10

Error: OperationTimedOut: errors={'10.20.30.10': 'Client request timeout. See Session.execute_async'}, last_host=10.20.30.10

推荐答案

在执行多次R& DI之后,得到了count(* )问题。

After performing multiple R&D I got a solution for count(*) issue.

步骤:


  1. 在Cassandra群集上进行预先设置(我用过presto-server-0.215版本(presto-server-0.215.tar.gz和使用过的jdk:jdk-8u151-linux-x64.tar.gz))
    1.1。 presto-server-0.215.tar.gz: https:/ /repo1.maven.org/maven2/com/facebook/presto/presto-server/0.215/
    1.2。 jdk-8u151-linux-x64.tar.gz: https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html

  2. 在一台cassandra服务器上安装presto并使其成为协调器,群集中的其余节点将成为工作节点,请参考下面的URL进行设置。
    引用URL: https://github.com/prestodb/presto/issues/3382

  3. 您需要为config.properties文件中提到的Presto Port添加防火墙规则(我正在使用RHEL 7.x OS)

  4. 在launcher.py中进行更改--->已安装jdk的行号'214'路径命令= ['/opt/jdk1.8.0_151/bin/java','-cp',类路径]

  5. 启动presto ---> ./launcher start

  6. 打开presto控制台 http:// localhost:8081 ,您应该在控制台中看到协调器节点和工作节点。

  1. Setup presto on Cassandra Cluster (I used presto-server-0.215 version (presto-server-0.215.tar.gz and used jdk: jdk-8u151-linux-x64.tar.gz)) 1.1. presto-server-0.215.tar.gz: https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.215/ 1.2. jdk-8u151-linux-x64.tar.gz: https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
  2. Install presto on one cassandra server and which will make it as coordinator and rest of the nodes in the cluster will be worker, please refer below URL for setting up presto. Refer URL: https://github.com/prestodb/presto/issues/3382
  3. You need add firewall rule for Presto Port which you have mentioned in config.properties file (I'm using RHEL 7.x OS)
  4. Do changes in launcher.py ---> Line number '214' path of jdk installed "command = ['/opt/jdk1.8.0_151/bin/java', '-cp', classpath]"
  5. Start presto ---> ./launcher start
  6. Open presto console http://localhost:8081 and you should see coordinator and worker nodes in the console.

下载 presto-cli-0.215-executable.jar(URL: https://prestodb.io /docs/current/installation/cli.html ),并将其重命名为prestocli(获得755权限),然后使用 prestocli表whi测试一个大表的count(*) ch有75个Lakhs记录,当我们在cqlsh中运行时,该记录给出了错误。
7.1。 CQLSH错误:来自服务器的错误:code = 1200 [协调器节点等待副本节点的响应超时] message =操作超时-仅收到0个响应。 info = {'received_responses':0,'required_responses':1,'consistency':'ONE'}

Download "presto-cli-0.215-executable.jar" (URL: https://prestodb.io/docs/current/installation/cli.html) and rename it to prestocli (Give 755 permission) and then test count(*) for a big table using 'prestocli' a table which has 75 Lakhs records which was giving error when we run in cqlsh. 7.1. CQLSH Error: Error from server: code=1200 [Coordinator node timed out waiting for replica nodes' responses] message="Operation timed out - received only 0 responses." info={'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}

[root @ casdb01 bin]#./prestocli --server localhost:8081
presto> SELECT count(*) FROM cassandra.datamart.big_table;

[root@casdb01 bin]# ./prestocli --server localhost:8081 presto> SELECT count(*) FROM cassandra.datamart.big_table;

7587418
(1行)

7587418 (1 row)

查询20190118_070908_00005_38tiw,已完成,1个节点
拆分:总计1,298,已完成1,298(100.00%)
0:53 [759万行,7.24MB] [ 142K行/秒,139KB /秒]

Query 20190118_070908_00005_38tiw, FINISHED, 1 node Splits: 1,298 total, 1,298 done (100.00%) 0:53 [7.59M rows, 7.24MB] [142K rows/s, 139KB/s]


  1. 对于任何应用程序查询,您都可以保存为执行计数的接口( *)。

特别感谢我遇到的帮助我获得此结果的团队(Venkatesh Bhat)。

Special thanks to my team met who helped me to get this result (Venkatesh Bhat).

这篇关于Cassandra问题v3.11.3 ...从table1中选择count(*)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆