Giter Club home page Giter Club logo

spark-hive-solr-demo's Introduction

spark-hive-solr-demo

First, build the package and copy the shaded jar to the /tmp folder of a cluster node:

mvn clean package
scp target/spark-hive-solr-demo-1.0-SNAPSHOT.jar hadoop01:/tmp/

Then, ssh into the cluster node and execute the jar as the HDFS user:

runuser -l hdfs -c 'spark-submit --class io.woolford.Main --master=yarn-cluster /tmp/spark-hive-solr-demo-1.0-SNAPSHOT.jar --files=/etc/hive/conf/hive-site.xml'

Ran this command:

runuser -l hdfs -c 'spark-submit --class io.woolford.Main --master=yarn-cluster --files=/usr/hdp/current/spark-client/conf/hive-site.xml /tmp/spark-hive-solr-demo-1.0-SNAPSHOT.jar'

The contents of file /usr/hdp/current/spark-client/conf/hive-site.xml are:

<configuration>
	<property>
	  <name>hive.metastore.warehouse.dir</name>
	  <value>/apps/hive/warehouse</value>
	</property>
	<property>
	  <name>javax.jdo.option.ConnectionURL</name>
	  <value>jdbc:mysql://sandbox.hortonworks.com/metastore</value>
	  <description>the URL of the MySQL database</description>
	</property>
	
	<property>
	  <name>javax.jdo.option.ConnectionDriverName</name>
	  <value>com.mysql.jdbc.Driver</value>
	</property>
	
	<property>
	  <name>javax.jdo.option.ConnectionUserName</name>
	  <value>root</value>
	</property>
	
	<property>
	  <name>javax.jdo.option.ConnectionPassword</name>
	  <value>hadoop</value>
	</property>
	
	<property>
	  <name>datanucleus.autoCreateSchema</name>
	  <value>false</value>
	</property>
	
	<property>
	  <name>datanucleus.fixedDatastore</name>
	  <value>true</value>
	</property>
	
	<property>
	  <name>datanucleus.autoStartMechanism</name>
	  <value>SchemaTable</value>
	</property>
    
    <property>
      <name>hive.metastore.uris</name>
      <value>thrift://sandbox.hortonworks.com:9083</value>
    </property>
</configuration>

/usr/hdp/current/hive-client/conf/hive-site.xml

	<property>
	  <name>javax.jdo.option.ConnectionPassword</name>
	  <value>hadoop</value>
	</property>

Added table to hive:

su hdfs

vi firstname_lastname.txt

add some records:

$ cat firstname_lastname.txt 
Barack,Obama
Donald,Trump

hive
CREATE TABLE sanjay (
	firstname string,
	lastname string
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
LOCATION '/apps/hive/warehouse/sanjay';

from $

hdfs dfs -copyFromLocal firstname_lastname.txt /apps/hive/warehouse/sanjay

hive> select * from sanjay;

Barack	Obama
Donald	Trump

spark-hive-solr-demo's People

Contributors

sanjay-kumar-sk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.