Crawler code implementation four: using HBase storage crawler data (1)

Source: Internet
Author: User

3.Hbase table Design:

1. Narrow table: There are fewer rows, and each row in the table remains as unique as possible.

2. Wide table: There are fewer rows in the column, and the timestamp version distinguishes the values.

Narrow table: For example, this table, Rowkey by userid+ time +bbsid assume Bbsid as the ID of the reply. So, for the same 1001, suppose we need to query 1001 users a day of data, using a narrow table, we need to query 1001 users all days of rowkey data, and then a comparison, and finally find the number of days we need to find data. If it was 365 days, I was looking for the No. 365 day, a comparison, so inefficient.

So how do you design the HBase table for this project?

Click on the different TV series of Youku and find the URL as follows:

Therefore, we can use the site source + TV series ID as Rowkey, need to crawl the field information stored in the column cluster, then how do we get these column fields such as 24 hours a day corresponding value?

Here we create an hbase table, set multiple versions, create ' Tvcount ',{name=> ' Tvinfo ', versions=>30}, so for the same column, we are saving the corresponding values for multiple time periods, not just one.

Specific operation:

1. First open the HBase environment:

2. Re-enter $ clear

3. Enter the HBase shell command:

4. Check the list to see if this table

Doesn't seem to have any information on this table at the moment

5. Therefore, there is a need to create a table to store information about Youku's TV series. Create Tvcount table, column cluster is tvinfo, record 30 days of data

6. Look up the list and find the watch.

7. View the table below

Now, we have created this table successfully.

Crawler code implementation four: using HBase storage crawler data (1)

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.