我一直在跟踪如何使用tidb_tispark来建立htap数据库,直到我了解到启动TiSpark一节为止,一切都很正常。我的第一个问题发生在执行行时:
docker-compose exec tispark-master /opt/spark-2.1.1-bin-hadoop2.7/bin/spark-shell但是,我修改了星火版本,使之成为我在容器中找到的版本:
docker-compose exec tispark-master /opt/spark-2.3.3-bin-hadoop2.7/bin/spark-shell我的第二个问题发生在执行三行块时:
import org.apache.spark.sql.TiContext
val ti = new TiContext(spark)
ti.tidbMapDatabase("TPCH_001")当我运行最后一条语句时,我得到以下输出
scala> ti.tidbMapDatabase("TPCH_001")
2019-07-11 16:14:32 WARN General:96 - Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/opt/spark/jars/datanucleus-core-3.2.10.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/spark-2.3.3-bin-hadoop2.7/jars/datanucleus-core-3.2.10.jar."
2019-07-11 16:14:32 WARN General:96 - Plugin (Bundle) "org.datanucleus.api.jdo" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/opt/spark/jars/datanucleus-api-jdo-3.2.6.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/spark-2.3.3-bin-hadoop2.7/jars/datanucleus-api-jdo-3.2.6.jar."
2019-07-11 16:14:32 WARN General:96 - Plugin (Bundle) "org.datanucleus.store.rdbms" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/opt/spark/jars/datanucleus-rdbms-3.2.9.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/spark-2.3.3-bin-hadoop2.7/jars/datanucleus-rdbms-3.2.9.jar."
2019-07-11 16:14:36 WARN ObjectStore:568 - Failed to get database global_temp, returning NoSuchObjectException这并不妨碍我运行查询:
spark.sql("select * from nation").show(30);但是,当我按照教程的进一步步骤从MySQL修改db时,这些更改不会立即反映在Spark中。此外,在将来的某个时候(我相信>5分钟后),修改后的行将停止显示在Spark查询中。
我对这种设置非常陌生,不知道如何调试这个问题。搜索我收到的警告并不能说明问题。
我不知道这是否有帮助,但是当我连接MySQL时,我得到的是服务器版本:
Server version: 5.7.25-TiDB-v3.0.0-rc.1-309-g8c20289c7 MySQL Community Server (Apache License 2.0)发布于 2019-07-11 18:04:39
我是TiSpark的主要开发人员之一。很抱歉你在这方面的经验很差。
由于我的对接问题,我不能直接复制你的问题,但它似乎你击中了一个错误最近修复。https://github.com/pingcap/tispark/pull/862/files
在较新版本的TiSpark (TiSpark 2.0+ with Spark 2.3+)中,数据库和表直接连接到目录服务,您可以直接调用
spark.sql("use TPCH_001").show
spark.sql("select * from nation").show这应该会给你提供新的数据。因此,尝试重新启动您的火花驱动程序,只需尝试上面的两行代码,看看它是否有效。
如果这能解决你的问题请告诉我。另一方面,我们将检查我们的码头形象,以确保它是否已经包含修复。
如果事情仍有问题,请您帮助运行下面的代码,并让我们知道版本的TiSpark。
spark.sql("select ti_version()").show再次,抱歉给你添麻烦,谢谢你的努力。
编辑
要解决您的评论:警告是由火花本身引起的,它将首先尝试在其本机目录中定位数据库,这将导致无法获得警告。但是故障转移过程将将搜索委托给tispark,然后行为正确。所以这个警告可以被忽略。建议将下面的行添加到您的星星之火的conf文件夹中的log4j.properties。
log4j.logger.org.apache.hadoop.hive.metastore.ObjectStore=ERROR我们很快就会擦亮码头导师的形象。非常感谢你的努力。
https://stackoverflow.com/questions/56993559
复制相似问题