Kumaresh Babu N S
Kumaresh Babu N S

Reputation: 1698

How to store text files, images into Apache Spark using Java API?

I am new to Apache Spark. I am using Windows OS and spark was installed in Linux OS which is remote. Is it possible to add ip address and port in Spark configuration using Java API? Please share spark java example.

Thanks in advance.

Upvotes: 0

Views: 81

Answers (1)

kecso
kecso

Reputation: 2485

If you'd just like to play around with spark, I suggest just start a local spark from your application. Here's a java example (the old 1.6 syntax) for that:

public static void trySparkTestClass() throws IOException {
    SparkConf conf = new SparkConf()
            .setMaster("local[*]")
            .setAppName("TestSparkSample");

    JavaSparkContext jsc = new JavaSparkContext(conf);
    HiveContext sqlContext = new HiveContext(jsc);
    DataFrame myJson = sqlContext.read().json("myJson");
    jsc.stop();
}

Upvotes: 1

Related Questions