<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to import data from MongoDB to Hive or Hbase ? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128917#M91610</link>
    <description>&lt;P&gt;my question is relatd with Scott answer&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2017 00:43:22 GMT</pubDate>
    <dc:creator>henimaher</dc:creator>
    <dc:date>2017-05-04T00:43:22Z</dc:date>
    <item>
      <title>How to import data from MongoDB to Hive or Hbase ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128911#M91604</link>
      <description>&lt;P&gt;Hi All, &lt;/P&gt;&lt;P&gt;I would like to know how I can import data from MongoDB (documents) to Hive or Hbase ? &lt;/P&gt;&lt;P&gt;Best Regards &lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:24:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128911#M91604</guid>
      <dc:creator>frioua_hamza</dc:creator>
      <dc:date>2022-09-16T10:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to import data from MongoDB to Hive or Hbase ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128912#M91605</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/3932/friouahamza.html" nodeid="3932"&gt;@Hamza FRIOUA&lt;/A&gt;&lt;P&gt;Best option would be using Mongo hadoop connector with hive external tables but you need to built that jar manually or use prebuilt.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/mongodb/mongo-hadoop/wiki/Hive-Usage" target="_blank"&gt;https://github.com/mongodb/mongo-hadoop/wiki/Hive-Usage&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;CREATE TABLE individuals
( 
  id INT,
  name STRING,
  age INT,
  work STRUCT&amp;lt;title:STRING, hours:INT&amp;gt;
)
STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler'
WITH SERDEPROPERTIES('mongo.columns.mapping'='{"id":"_id","work.title":"job.position"}')
TBLPROPERTIES('mongo.uri'='mongodb://localhost:27017/test.persons');&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Jun 2016 22:43:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128912#M91605</guid>
      <dc:creator>jyadav</dc:creator>
      <dc:date>2016-06-08T22:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to import data from MongoDB to Hive or Hbase ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128913#M91606</link>
      <description>&lt;P&gt; &lt;A rel="user" href="https://community.cloudera.com/users/3932/friouahamza.html" nodeid="3932"&gt;@Hamza FRIOUA&lt;/A&gt; I wrote this awhile back for a customer. The version may have changed but it should still be relevant. Essentially, it creates a test MongoDB instance, loads data, installs the storagehandler, creates a Hive table. &lt;/P&gt;&lt;P&gt;1. Install MongoDB: sudo yum install mongodb-org
You may need to setup the following mongodb.repo file in /etc/yum.repos.d
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1 &lt;/P&gt;&lt;P&gt;2. Start mongodb: sudo service mongod start &lt;/P&gt;&lt;P&gt;3. Enter the mongo CLI by typing mongo &lt;/P&gt;&lt;P&gt;4. &lt;A href="http://docs.mongodb.org/manual/tutorial/generate-test-data/" target="_blank"&gt;http://docs.mongodb.org/manual/tutorial/generate-test-data/&lt;/A&gt; 
Type the following to add test data to db.testData. 
MongoDB will implicitly create the database if it isn’t already created. 
The default is “25” records but this can be increased if needed:
for (var i = 1; i &amp;lt;= 25; i++) {db.testData.insert( { x : i } )} &lt;/P&gt;&lt;P&gt;5. To display the data type: db.testData.find() &lt;/P&gt;&lt;P&gt;6. &lt;A href="http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-hadoop/" target="_blank"&gt;http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-hadoop/&lt;/A&gt; &lt;/P&gt;&lt;P&gt;
7. From /root, download the mongo-hadoop git repo: 
git clone &lt;A href="https://github.com/mongodb/mongo-hadoop.git" target="_blank"&gt;https://github.com/mongodb/mongo-hadoop.git&lt;/A&gt; &lt;/P&gt;&lt;P&gt;8. Navigate to /root/mongo-hadoop and type ./gradlew jar &lt;/P&gt;&lt;P&gt;9. Place .jar files in usr\lib\hadoop\lib and usr\lib\hive\lb
mongo-hadoop-core-1.4.0-SNAPSHOT.jar
mongo-hadoop-hive-1.4.0-SNAPSHOT.jar
mongo-hadoop-pig-1.4.0-SNAPSHOT.jar &lt;/P&gt;&lt;P&gt;10. Type hive on the command line to start the Hive shell &lt;/P&gt;&lt;P&gt;****Create Hive Table***** &lt;/P&gt;&lt;P&gt;CREATE EXTERNAL TABLE testdb
(
id STRING,
x INT
) &lt;/P&gt;&lt;P&gt;STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler' &lt;/P&gt;&lt;P&gt;WITH SERDEPROPERTIES('mongo.columns.mapping' = '{"id":"_id", "x":"x"}')
TBLPROPERTIES('mongo.uri'='mongodb://127.0.0.1:27017/db.testData');&lt;/P&gt;&lt;P&gt;
***********WARNING: If you leave out the EXTERNAL command, Hive will use the MongoDB collection as
the primary source. Dropping the Hive table will remove the collection from Mongo. ***********&lt;/P&gt;&lt;P&gt;11. You should now be able to see your MongoDB data by typing “SELECT * FROM testdb;"&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 00:25:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128913#M91606</guid>
      <dc:creator>SQLShaw</dc:creator>
      <dc:date>2016-06-09T00:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to import data from MongoDB to Hive or Hbase ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128914#M91607</link>
      <description>&lt;P&gt;I wrote a short tutorial on doing just that &lt;A href="https://community.hortonworks.com/content/repo/4538/hdp-mongo-tutorial.html" target="_blank"&gt;https://community.hortonworks.com/content/repo/4538/hdp-mongo-tutorial.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 00:25:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128914#M91607</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-06-09T00:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to import data from MongoDB to Hive or Hbase ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128915#M91608</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/186/sshaw.html" nodeid="186"&gt;@Scott Shaw&lt;/A&gt; &lt;/P&gt;&lt;P&gt;I tried your example but I don't find the table in hdfs :&lt;/P&gt;&lt;P&gt;&lt;A href="http://localhost:50070/explorer.html#/user/hive/warehouse/testdb" target="_blank"&gt;http://localhost:50070/explorer.html#/user/hive/warehouse/testdb&lt;/A&gt;&lt;/P&gt;&lt;P&gt;even I removed external ...???&lt;/P&gt;,&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/186/sshaw.html" nodeid="186"&gt;@Scott Shaw&lt;/A&gt; I tried your example but I don't find the Table testdb in hdfs . Even when I removed external...???&lt;/P&gt;,&lt;P&gt;@Scot Shaw&lt;/P&gt;&lt;P&gt;I tested your example but I did not find any results in hdfs
(&lt;/P&gt;&lt;P&gt;&lt;A href="http://localhost:50070/explorer.html#/user/hive/warehouse/testdb" target="_blank"&gt;http://localhost:50070/explorer.html#/user/hive/warehouse/testdb&lt;/A&gt;&lt;/P&gt;&lt;P&gt;)?? Even when i removed External&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 22:56:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128915#M91608</guid>
      <dc:creator>henimaher</dc:creator>
      <dc:date>2017-05-03T22:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to import data from MongoDB to Hive or Hbase ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128916#M91609</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18016/henimaher.html" nodeid="18016"&gt;@HENI MAHER&lt;/A&gt; please open this as a new question and describe your problem in full.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 00:10:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128916#M91609</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2017-05-04T00:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to import data from MongoDB to Hive or Hbase ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128917#M91610</link>
      <description>&lt;P&gt;my question is relatd with Scott answer&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 00:43:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128917#M91610</guid>
      <dc:creator>henimaher</dc:creator>
      <dc:date>2017-05-04T00:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to import data from MongoDB to Hive or Hbase ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128918#M91611</link>
      <description>&lt;P&gt;I tried using the external table method but I run out of memory. My mongo collection (table2) has 10 million records (0.755 GB) and reading from it works. After the insert task fails I do a count on the native table (table1) and it contains 0 rows.&lt;/P&gt;&lt;P&gt;My query looks like this: "INSERT INTO table1 SELECT * FROM table2", if I add "LIMIT 1000" it works, however I need to migrate the entire collection. I attached the output from beeline.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2017 21:36:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-import-data-from-MongoDB-to-Hive-or-Hbase/m-p/128918#M91611</guid>
      <dc:creator>warchild128</dc:creator>
      <dc:date>2017-10-17T21:36:42Z</dc:date>
    </item>
  </channel>
</rss>

