Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将PostgreSQL数据加载到GeoMesa(使用Cassandra数据存储)?_Postgresql_Cassandra_Geomesa - Fatal编程技术网

如何将PostgreSQL数据加载到GeoMesa(使用Cassandra数据存储)?

如何将PostgreSQL数据加载到GeoMesa(使用Cassandra数据存储)?,postgresql,cassandra,geomesa,Postgresql,Cassandra,Geomesa,我试图通过JDBC转换器将Postresql数据加载到Geomesa(带有Cassandra数据存储) 从shape加载效果很好,因此Cassandra和GeoMesa设置是可以的 接下来,我尝试从PostgreSQL加载数据 命令: echo“选择年份,geom,grondgebruik,crop_代码,crop_名称,fieldid,global_id,面积,周长,来自v_Gewspercelen2018的geohash”| bin/geomesa cassandra ingest-c ca

我试图通过JDBC转换器将Postresql数据加载到Geomesa(带有Cassandra数据存储)

从shape加载效果很好,因此Cassandra和GeoMesa设置是可以的

接下来,我尝试从PostgreSQL加载数据

命令:

echo“选择年份,geom,grondgebruik,crop_代码,crop_名称,fieldid,global_id,面积,周长,来自v_Gewspercelen2018的geohash”| bin/geomesa cassandra ingest-c catalog-p cassandraserver:9042-k agrodatacube-f parcel-c geomesa.converters.parcel-u-p

转换器定义文件geomesa.converters.package如下所示:

geomesa.converters.parcel = {

type = "jdbc"

connection = "dbc:postgresql://postgresserver:5432/agrodatacube"

id-field="toString($5)"

fields = [

    { name = "fieldid",    transform = "$5"        }

    { name = "global_id",    transform = "$6"        }

    { name = "year",    transform = "$0"         }

    { name = "area",  transform = "$7"        }

    { name = "perimeter",  transform = "$8"         }

    { name = "grondgebruik",   transform = "$2"      }

    { name = "crop_code",    transform = "$3"     }

    { name = "crop_name",   transform = "$4"       }

    { name = "geohash",   transform = "$9"     }

    { name = "geom",   transform = "$1"      }

]
}
geomesa输出为:

INFO  Schema 'parcel' exists

INFO  Running ingestion in local mode

INFO  Ingesting from stdin with 1 thread
[                                                         ]   0% complete 0 i[                                                            ]   0% complete 0 ingested 0 failed in 00:00:01

ERROR Fatal error running local ingest worker on <stdin>

[                                                            ]   0% complete 0 i[                                                            ]   0% complete 0 ingested 0 failed in 00:00:01

INFO  Local ingestion complete in 00:00:01

INFO  Ingested 0 features with no failures for file: <stdin>

WARN  Some files caused errors, ingest counts may not be accurate
存在信息架构“包裹”
信息在本地模式下运行摄取
使用1个线程从stdin摄取信息
[]0%完成0 i[]0%完成0摄取0在00:00:01失败
错误在上运行本地摄取工作程序时发生致命错误
[]0%完成0 i[]0%完成0摄取0在00:00:01失败
信息本地摄取在00:00:01完成
信息摄取了0项功能,但文件没有失败:
警告某些文件导致错误,摄取计数可能不准确

有人知道这里出了什么问题吗?

您可以在
日志
文件夹中查看更多详细错误。然而,乍一看,JDBC转换器如下,这意味着第一个字段是
$1
(而不是
$0
)。此外,您可能需要使用变换功能变换几何体,即
几何体($2)

谢谢Emilio,两个建议都很有意义

  • 使转换器字段计数从1开始
  • 转换器定义文件内部已更改
  • {name=“geom”,transform=“$2”}

    进入

    {name=“geom”,transform=“geometry($2)”}

  • SQL Select命令应为:
  • 选择年份,ST_AsText(geom)。。。。来自v_Gewaspercelen 2018

    顺便说一句,用户名和密码是连接字符串的一部分(在geomesa.converters.packet文件中):

    联系= “dbc:postgresql://postgresserver:5432/agrodatacube?user=username&password=password"

    因此-u和-p标志不会出现在最终命令中:

    echo“选择年份、ST_AsText(geom)、grondgebruik、作物代码、, 作物名称、字段id、全局id、面积、周长、geohash FROM v|u gewaspercelen2018“| bin/geomesa cassandra摄入-c目录-P cassandraserver:9042-k agrodatacube-f地块-C geomesa.com.包裹

    有了这些变化,它就工作了

    再次感谢

    雨果