How to use external database (postgresql) as input in streaming query?

♀尐吖头ヾ 提交于 2019-12-24 06:27:40

问题


I am trying to implement streaming input updates in Postgresql. Specifically , I would like to use Postgresql as datasource in stream input into spark.

Looking at the document, I was not sure if this is possible or not.

https://spark.apache.org/docs/latest/streaming-programming-guide.html

Would it be possible to stream input from PostgresQL, perhaps as a micro batch ?


回答1:


To stream your PSQL Data as a micro batch, Kafka is the best way. You can use Kafka connect (as a source) to established a connection between your Brokers and your Database.

See Kafka streaming integration with Spark Streaming: https://spark.apache.org/docs/2.2.0/streaming-kafka-0-10-integration.html

Kafka connect documentation: https://docs.confluent.io/current/connect/index.html

By this way, you can face to faults, concurrency and optimize your computation capabilities.



来源:https://stackoverflow.com/questions/58949914/how-to-use-external-database-postgresql-as-input-in-streaming-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!