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)