简体   繁体   English

如何使用 pySpark 中的 JDBC 读取 Cassandra 数据?

[英]How can I read Cassandra data using JDBC from pySpark?

In order to parallelize the read operation and read with more than one executor.为了使读取操作并行化,并与多个执行器一起读取。 Rather than the following read code, I want to read with JDBC.而不是下面的阅读代码,我想用 JDBC 阅读。

hosts ={"spark.cassandra.connection.host":'node1_ip,node2_ip,node3_ip',
   "table":"ex_table","keyspace":"ex_keyspace"}
data_frame=sqlContext.read.format("org.apache.spark.sql.cassandra") \
  .options(**hosts).load()

How can I read Cassandra data using JDBC from pySpark?如何使用 pySpark 中的 JDBC 读取 Cassandra 数据?

DataStax provides a JDBC driver for Apache Spark which allows you to connect to Cassandra from Spark using a JDBC connection. DataStax 为 Apache Spark 提供了 JDBC 驱动程序,允许您使用 Z8243643677 连接从 Spark 连接到 Cassandra。

The JDBC driver is available to download from the DataStax Downloads site. JDBC 驱动程序可从DataStax 下载站点下载。

See the instructions for Installing the Simba JDBC driver .请参阅安装 Simba JDBC 驱动程序的说明。 Additionally, there is also a User Guide for configuring the driver with some examples.此外,还有一个用户指南,用于通过一些示例配置驱动程序。 Cheers!干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以使用 Spark 从 Cassandra 更快地读取数据吗? - Can I read data faster from Cassandra using Spark? 使用 Z77BB59DCD89559748E5DB5695ZC 将 pyspark dataframe 中的数据插入另一个 cassandra 表 - Insert data from pyspark dataframe to another cassandra table using pyspark 使用Pyspark / Dataframe时,如何将谓词下推到Cassandra或限制请求的数据? - How can you pushdown predicates to Cassandra or limit requested data when using Pyspark / Dataframes? 如何使用 jdbc 连接从 db2 读取数据? - How to read data from db2 using jdbc connection? 如何在 Azure Databricks 中使用 JDBC 从 PostgreSQL 读取表数据? - How to read table data from PostgreSQL using JDBC in Azure Databricks? 如何使用QueryCassandra和ExecutePySpark Nifi处理器将我的cassandra数据传输到pyspark? - How do I transfer my cassandra data to pyspark using QueryCassandra and ExecutePySpark Nifi Processors? 如何将LIBSVM模型(使用LIBSVM保存)读入PySpark? - How can I read LIBSVM models (saved using LIBSVM) into PySpark? 如何使用pyspark从HBase表中读取数据? - How to read data from HBase table using pyspark? 使用 pyspark 从 cassandra 获取数据时出错 - Error while fetching data from cassandra using pyspark 如何使用pyspark在cassandra数据上创建RDD对象 - How to create RDD object on cassandra data using pyspark
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM