Use shell paging to read 6 million + MySQL data scripts

Source: Internet
Author: User
Tags mysql client

shell-mysql
(1) Script background:
Because to be on Linux, remote read MySQL table data, and then do a certain cleaning, upload data to the Hadoop cluster, use Java to write it, feel too troublesome, have to develop on win, also have to play into jar package, upload to Linux, if there is a problem, Also have to repeat this, very inconvenient, then use the shell to write a bar, and do not need any JDBC driver package, only need to install a MySQL client on Linux, with a line of yum command can be done, so it took a little time, encapsulated a small script

(2) Function Introduction:
A small script that reads data from MySQL tables remotely using shell scripts directly under Linux, with the measured read 6 million + data efficiency similar to JDBC

(3) Script Description:
There are three main script components
1,page.sh This is a master script, which defines the conditions for paging, and you can see
2,f.sh a small package script, which will use SED to remove the table header some information
3,port.sh the execution script for paged read data

(4) How to use?  
Use is very simple, you need to change the query field inside the page.sh, and the number of paged query, the default is 10000, and then execute SH page.sh databaseName tablename incoming database name and table name can be

GitHub Address: Https://github.com/qindongliang/shell-mysql


Use shell paging to read 6 million + MySQL data scripts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.