Yang, Tong 48706b7552 MRS COMP-LTS 320-lts.1 version
Reviewed-by: Kacur, Michal <michal.kacur@t-systems.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2024-04-12 12:51:10 +00:00

19 lines
1.6 KiB
HTML

<a name="mrs_01_24831"></a><a name="mrs_01_24831"></a>
<h1 class="topictitle1">How Do I Migrate Data from Hive/HDFS to ClickHouse?</h1>
<div id="body0000001583315481"><div class="section" id="mrs_01_24831__section6835184584112"><h4 class="sectiontitle">Question</h4><p id="mrs_01_24831__p142187599102">How do I migrate Hive/HDFS data to ClickHouse?</p>
</div>
<div class="section" id="mrs_01_24831__section4774454164114"><h4 class="sectiontitle">Answer</h4><p id="mrs_01_24831__p115670522113">You can export data from Hive as CSV files and import the CSV files to ClickHouse.</p>
<ol id="mrs_01_24831__ol121210394424"><li id="mrs_01_24831__li2012839164211">Export data from Hive as CSV files.<p id="mrs_01_24831__p5867055171118"><a name="mrs_01_24831__li2012839164211"></a><a name="li2012839164211"></a><strong id="mrs_01_24831__b82344309420">hive -e "select * from db_hive.student limit 1000"| tr "\t" "," &gt; /data/bigdata/hive/student.csv;</strong></p>
</li><li id="mrs_01_24831__li3960244124211">Import the CSV files to the <strong id="mrs_01_24831__b18524113399">student_hive</strong> table in the default database of ClickHouse.<p id="mrs_01_24831__p155782715115"><strong id="mrs_01_24831__b17721453164212">clickhouse --client --port 9002 --password password -m --query='INSERT INTO default.student_hive FORMAT CSV' &lt; /data/bigdata/hive/student.csv</strong></p>
</li></ol>
</div>
<p id="mrs_01_24831__p1727191515121"></p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_24777.html">ClickHouse FAQ</a></div>
</div>
</div>