You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by aecc <al...@gmail.com> on 2014/02/06 13:57:44 UTC
Database connection per worker
Hi,
I would like to do an operation only once in each worker, at the beggining.
Such as connecting to a database. But I cannot make it work. I created a
static variable that in theory should be different on each worker, so I
should be able to get connections to the database from different workers,
however I just get one. I'm using local[4] in standalone mode.
Thank you
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Database-connection-per-worker-tp1280.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
Re: Database connection per worker
Posted by Tathagata Das <ta...@gmail.com>.
Using local[4] runs everything in local mode within a single JVM. So you
are expected to get only one connection when using a static variable.
TD
On Thu, Feb 6, 2014 at 5:01 AM, aecc <al...@gmail.com> wrote:
> I forgot to mention that I'm running Spark Streaming
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/Database-connection-per-worker-tp1280p1281.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
Re: Database connection per worker
Posted by aecc <al...@gmail.com>.
I forgot to mention that I'm running Spark Streaming
--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Database-connection-per-worker-tp1280p1281.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.