You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by kant kodali <ka...@gmail.com> on 2017/06/04 06:29:52 UTC
What is the easiest way for an application to Query parquet data on HDFS?
Hi All,
I am wondering what is the easiest way for a Micro service to query data on
HDFS? By easiest way I mean using minimal number of tools.
Currently I use spark structured streaming to do some real time
aggregations and store it in HDFS. But now, I want my Micro service app to
be able to query and access data on HDFS. It looks like SparkSession can
only be accessed through CLI but not through a JDBC like API or whatever.
Any suggestions?
Thanks!
Re: What is the easiest way for an application to Query parquet data
on HDFS?
Posted by Muthu Jayakumar <ba...@gmail.com>.
I run a spark-submit(https://spark.apache.org/docs/latest/spark-standalone.
html#launching-spark-applications) in client-mode that starts the
micro-service. If you keep the event loop going then the spark context
would remain active.
Thanks,
Muthu
On Mon, Jun 5, 2017 at 2:44 PM, kant kodali <ka...@gmail.com> wrote:
> Are you launching SparkSession from a MicroService or through spark-submit
> ?
>
> On Sun, Jun 4, 2017 at 11:52 PM, Muthu Jayakumar <ba...@gmail.com>
> wrote:
>
>> Hello Kant,
>>
>> >I still don't understand How SparkSession can use Akka to communicate
>> with SparkCluster?
>> Let me use your initial requirement as a way to illustrate what I mean --
>> i.e, "I want my Micro service app to be able to query and access data on
>> HDFS"
>> In order to run a query say a DF query (equally possible with SQL as
>> well), you'll need a sparkSession to build a query right? If you can have
>> your main thread launched in client-mode (https://spark.apache.org/docs
>> /latest/spark-standalone.html#launching-spark-applications) then you'll
>> be able to use play/akka based microservice as you used to.
>> Here is what I have in one of my applications do...
>> a. I have an akka-http as a micro-service that takes a query-like JSON
>> request (based on simple scala parser combinator) and runs a spark job
>> using dataframe/dataset and sends back JSON responses (synchronous and
>> asynchronously).
>> b. have another akka-actor that takes an object request to generate
>> parquet(s)
>> c. Another akka-http endpoint (based on web-sockets) to perform similar
>> operation as (a)
>> d. Another akka-http end-point to get progress on a running query /
>> parquet generation (which is based on SparkContext / SparkSQL internal API
>> which is similar to https://spark.apache.org/docs/latest/monitoring.html)
>> The idea is to make sure to have only one sparkSession per JVM. But you
>> can set the execution to be in FAIR (which defaults to FIFO) to be able to
>> run multiple queries in parallel. The application I use runs spark in Spark
>> Standalone with a 32 node cluster.
>>
>> Hope this gives some better idea.
>>
>> Thanks,
>> Muthu
>>
>>
>> On Sun, Jun 4, 2017 at 10:33 PM, kant kodali <ka...@gmail.com> wrote:
>>
>>> Hi Muthu,
>>>
>>> I am actually using Play framework for my Micro service which uses Akka
>>> but I still don't understand How SparkSession can use Akka to communicate
>>> with SparkCluster? SparkPi or SparkPl? any link?
>>>
>>> Thanks!
>>>
>>
>>
>
Re: What is the easiest way for an application to Query parquet data
on HDFS?
Posted by kant kodali <ka...@gmail.com>.
Are you launching SparkSession from a MicroService or through spark-submit ?
On Sun, Jun 4, 2017 at 11:52 PM, Muthu Jayakumar <ba...@gmail.com> wrote:
> Hello Kant,
>
> >I still don't understand How SparkSession can use Akka to communicate
> with SparkCluster?
> Let me use your initial requirement as a way to illustrate what I mean --
> i.e, "I want my Micro service app to be able to query and access data on
> HDFS"
> In order to run a query say a DF query (equally possible with SQL as
> well), you'll need a sparkSession to build a query right? If you can have
> your main thread launched in client-mode (https://spark.apache.org/
> docs/latest/spark-standalone.html#launching-spark-applications) then
> you'll be able to use play/akka based microservice as you used to.
> Here is what I have in one of my applications do...
> a. I have an akka-http as a micro-service that takes a query-like JSON
> request (based on simple scala parser combinator) and runs a spark job
> using dataframe/dataset and sends back JSON responses (synchronous and
> asynchronously).
> b. have another akka-actor that takes an object request to generate
> parquet(s)
> c. Another akka-http endpoint (based on web-sockets) to perform similar
> operation as (a)
> d. Another akka-http end-point to get progress on a running query /
> parquet generation (which is based on SparkContext / SparkSQL internal API
> which is similar to https://spark.apache.org/docs/latest/monitoring.html)
> The idea is to make sure to have only one sparkSession per JVM. But you
> can set the execution to be in FAIR (which defaults to FIFO) to be able to
> run multiple queries in parallel. The application I use runs spark in Spark
> Standalone with a 32 node cluster.
>
> Hope this gives some better idea.
>
> Thanks,
> Muthu
>
>
> On Sun, Jun 4, 2017 at 10:33 PM, kant kodali <ka...@gmail.com> wrote:
>
>> Hi Muthu,
>>
>> I am actually using Play framework for my Micro service which uses Akka
>> but I still don't understand How SparkSession can use Akka to communicate
>> with SparkCluster? SparkPi or SparkPl? any link?
>>
>> Thanks!
>>
>
>
Re: What is the easiest way for an application to Query parquet data
on HDFS?
Posted by Muthu Jayakumar <ba...@gmail.com>.
Hello Kant,
>I still don't understand How SparkSession can use Akka to communicate with
SparkCluster?
Let me use your initial requirement as a way to illustrate what I mean --
i.e, "I want my Micro service app to be able to query and access data on
HDFS"
In order to run a query say a DF query (equally possible with SQL as well),
you'll need a sparkSession to build a query right? If you can have your
main thread launched in client-mode (
https://spark.apache.org/docs/latest/spark-standalone.html#launching-spark-applications)
then you'll be able to use play/akka based microservice as you used to.
Here is what I have in one of my applications do...
a. I have an akka-http as a micro-service that takes a query-like JSON
request (based on simple scala parser combinator) and runs a spark job
using dataframe/dataset and sends back JSON responses (synchronous and
asynchronously).
b. have another akka-actor that takes an object request to generate
parquet(s)
c. Another akka-http endpoint (based on web-sockets) to perform similar
operation as (a)
d. Another akka-http end-point to get progress on a running query / parquet
generation (which is based on SparkContext / SparkSQL internal API which is
similar to https://spark.apache.org/docs/latest/monitoring.html)
The idea is to make sure to have only one sparkSession per JVM. But you can
set the execution to be in FAIR (which defaults to FIFO) to be able to run
multiple queries in parallel. The application I use runs spark in Spark
Standalone with a 32 node cluster.
Hope this gives some better idea.
Thanks,
Muthu
On Sun, Jun 4, 2017 at 10:33 PM, kant kodali <ka...@gmail.com> wrote:
> Hi Muthu,
>
> I am actually using Play framework for my Micro service which uses Akka
> but I still don't understand How SparkSession can use Akka to communicate
> with SparkCluster? SparkPi or SparkPl? any link?
>
> Thanks!
>
Re: What is the easiest way for an application to Query parquet data
on HDFS?
Posted by kant kodali <ka...@gmail.com>.
Hi Muthu,
I am actually using Play framework for my Micro service which uses Akka but
I still don't understand How SparkSession can use Akka to communicate with
SparkCluster? SparkPi or SparkPl? any link?
Thanks!
Re: What is the easiest way for an application to Query parquet data
on HDFS?
Posted by Muthu Jayakumar <ba...@gmail.com>.
One drastic suggestion can be to write a simple microservice using Akka and
create a SparkSession (during the start of vm) and pass it around. You can
look at SparkPI for sample source code to start writing your microservice.
In my case, I used akka http to wrap my business requests and transform
them to read Parquet and respond back results.
Hope this helps
Thanks
Muthu
On Mon, Jun 5, 2017, 01:01 Sandeep Nemuri <nh...@gmail.com> wrote:
> Well if you are using Hortonworks distribution there is Livy2 which is
> compatible with Spark2 and scala 2.11.
>
>
> https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.0/bk_command-line-installation/content/install_configure_livy2.html
>
>
> On Sun, Jun 4, 2017 at 1:55 PM, kant kodali <ka...@gmail.com> wrote:
>
>> Hi,
>>
>> Thanks for this but here is what the documentation says:
>>
>> "To run the Livy server, you will also need an Apache Spark
>> installation. You can get Spark releases at
>> https://spark.apache.org/downloads.html. Livy requires at least Spark
>> 1.4 and currently only supports Scala 2.10 builds of Spark. To run Livy
>> with local sessions, first export these variables:"
>>
>> I am using spark 2.1.1 and scala 2.11.8 and I would like to use
>> Dataframes and Dataset API so it sounds like this is not an option for me?
>>
>> Thanks!
>>
>> On Sun, Jun 4, 2017 at 12:23 AM, Sandeep Nemuri <nh...@gmail.com>
>> wrote:
>>
>>> Check out http://livy.io/
>>>
>>>
>>> On Sun, Jun 4, 2017 at 11:59 AM, kant kodali <ka...@gmail.com> wrote:
>>>
>>>> Hi All,
>>>>
>>>> I am wondering what is the easiest way for a Micro service to query
>>>> data on HDFS? By easiest way I mean using minimal number of tools.
>>>>
>>>> Currently I use spark structured streaming to do some real time
>>>> aggregations and store it in HDFS. But now, I want my Micro service app to
>>>> be able to query and access data on HDFS. It looks like SparkSession can
>>>> only be accessed through CLI but not through a JDBC like API or whatever.
>>>> Any suggestions?
>>>>
>>>> Thanks!
>>>>
>>>
>>>
>>>
>>> --
>>> * Regards*
>>> * Sandeep Nemuri*
>>>
>>
>>
>
>
> --
> * Regards*
> * Sandeep Nemuri*
>
Re: What is the easiest way for an application to Query parquet data
on HDFS?
Posted by Sandeep Nemuri <nh...@gmail.com>.
Well if you are using Hortonworks distribution there is Livy2 which is
compatible with Spark2 and scala 2.11.
https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.0/bk_command-line-installation/content/install_configure_livy2.html
On Sun, Jun 4, 2017 at 1:55 PM, kant kodali <ka...@gmail.com> wrote:
> Hi,
>
> Thanks for this but here is what the documentation says:
>
> "To run the Livy server, you will also need an Apache Spark installation.
> You can get Spark releases at https://spark.apache.org/downloads.html.
> Livy requires at least Spark 1.4 and currently only supports Scala 2.10
> builds of Spark. To run Livy with local sessions, first export these
> variables:"
>
> I am using spark 2.1.1 and scala 2.11.8 and I would like to use Dataframes
> and Dataset API so it sounds like this is not an option for me?
>
> Thanks!
>
> On Sun, Jun 4, 2017 at 12:23 AM, Sandeep Nemuri <nh...@gmail.com>
> wrote:
>
>> Check out http://livy.io/
>>
>>
>> On Sun, Jun 4, 2017 at 11:59 AM, kant kodali <ka...@gmail.com> wrote:
>>
>>> Hi All,
>>>
>>> I am wondering what is the easiest way for a Micro service to query data
>>> on HDFS? By easiest way I mean using minimal number of tools.
>>>
>>> Currently I use spark structured streaming to do some real time
>>> aggregations and store it in HDFS. But now, I want my Micro service app to
>>> be able to query and access data on HDFS. It looks like SparkSession can
>>> only be accessed through CLI but not through a JDBC like API or whatever.
>>> Any suggestions?
>>>
>>> Thanks!
>>>
>>
>>
>>
>> --
>> * Regards*
>> * Sandeep Nemuri*
>>
>
>
--
* Regards*
* Sandeep Nemuri*
Re: What is the easiest way for an application to Query parquet data
on HDFS?
Posted by kant kodali <ka...@gmail.com>.
Hi,
Thanks for this but here is what the documentation says:
"To run the Livy server, you will also need an Apache Spark installation.
You can get Spark releases at https://spark.apache.org/downloads.html. Livy
requires at least Spark 1.4 and currently only supports Scala 2.10 builds
of Spark. To run Livy with local sessions, first export these variables:"
I am using spark 2.1.1 and scala 2.11.8 and I would like to use Dataframes
and Dataset API so it sounds like this is not an option for me?
Thanks!
On Sun, Jun 4, 2017 at 12:23 AM, Sandeep Nemuri <nh...@gmail.com>
wrote:
> Check out http://livy.io/
>
>
> On Sun, Jun 4, 2017 at 11:59 AM, kant kodali <ka...@gmail.com> wrote:
>
>> Hi All,
>>
>> I am wondering what is the easiest way for a Micro service to query data
>> on HDFS? By easiest way I mean using minimal number of tools.
>>
>> Currently I use spark structured streaming to do some real time
>> aggregations and store it in HDFS. But now, I want my Micro service app to
>> be able to query and access data on HDFS. It looks like SparkSession can
>> only be accessed through CLI but not through a JDBC like API or whatever.
>> Any suggestions?
>>
>> Thanks!
>>
>
>
>
> --
> * Regards*
> * Sandeep Nemuri*
>
Re: What is the easiest way for an application to Query parquet data
on HDFS?
Posted by Sandeep Nemuri <nh...@gmail.com>.
Check out http://livy.io/
On Sun, Jun 4, 2017 at 11:59 AM, kant kodali <ka...@gmail.com> wrote:
> Hi All,
>
> I am wondering what is the easiest way for a Micro service to query data
> on HDFS? By easiest way I mean using minimal number of tools.
>
> Currently I use spark structured streaming to do some real time
> aggregations and store it in HDFS. But now, I want my Micro service app to
> be able to query and access data on HDFS. It looks like SparkSession can
> only be accessed through CLI but not through a JDBC like API or whatever.
> Any suggestions?
>
> Thanks!
>
--
* Regards*
* Sandeep Nemuri*