hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Demai Ni (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-8663) a HBase Shell command to list the tables replicated (from or to) current cluster
Date Fri, 31 May 2013 17:28:20 GMT

    [ https://issues.apache.org/jira/browse/HBASE-8663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13671671#comment-13671671

Demai Ni commented on HBASE-8663:

Anoop, thanks. As you can tell, I am very new here and glad to be part of the community. I
will upload the patch for the master next week, which should be straightforward. On the slave
side, let me explore your idea first, appreciate the suggestion. 

What motivated me is the 'requirement' of realonly for the tables replicated on slave. It
is kind of hard for an administrator to keep track(except for a note on his/her desk), and
not accessable to an applicaton programmer(who can mess up the replicated tables with some
simple puts). the problem  may show up in a troublesome way for large enterprise level users,
who have many application developers in different locations/timezones, and only can access
to the slave clusters. With this thought, I am thinking toward the solution for such scenario.
And the API/command to show the replicated tables will be the first step. 

> a HBase Shell command to list the tables replicated (from or to) current cluster
> --------------------------------------------------------------------------------
>                 Key: HBASE-8663
>                 URL: https://issues.apache.org/jira/browse/HBASE-8663
>             Project: HBase
>          Issue Type: New Feature
>          Components: Replication, shell
>         Environment: clusters setup as Master and Slave for replication of tables 
>            Reporter: Demai Ni
>            Priority: Minor
> This jira is to provide a hbase shell command which can give user can overview of the
tables/columnfamilies currently being replicated. The information will help system administrator
for design and planning, and also help application programmer to know which tables/columns
should be watchout(for example, not to modify a replicated columnfamily on the slave cluster)
> Currently there is no easy way to tell which table(s)/columnfamily(ies) 
> replicated from or to a particular cluster. 
> On Master Cluster, an indirect method can be used by combining two steps: 1) $describe
'usertable'  and 2)  $list_peers to map the REPLICATION_SCOPE to target(aka slave) cluster
> On slave cluster, this is no existing API/methods to list all the tables replicated to
this cluster.    
> Here is an example, and prototype for Master cluster
> {code: title=hbase shell command:list_replicated_tables |borderStyle=solid}
> hbase(main):001:0> list_replicated_tables
>  scores      course            hdtest017.svl.ibm.com:2181:/hbase
>  t3_dn       cf1               hdtest017.svl.ibm.com:2181:/hbase
>  usertable   family            hdtest017.svl.ibm.com:2181:/hbase
> 3 row(s) in 0.3380 seconds
> {code}
> {code: title=method to return all columnfamilies replicated from this cluster |borderStyle=solid}
> /** 
>  * ReplicationAdmin.listRepllicated
>    * @return List of the replicated columnfamilies of this cluster for display. 
>    * @throws IOException 
> */
> public List<String[]> listReplicated() throws IOException {
>     List<String[]> replicatedColFams = new ArrayList<String[]>();  
>     HTableDescriptor[] tables;
>     tables= this.connection.listTables();
>     Map<String, String> peers = listPeers();
>     for (HTableDescriptor table:tables) {
>       HColumnDescriptor[] columns = table.getColumnFamilies();
>       String tableName = table.getNameAsString();
>       for (HColumnDescriptor column: columns) {
>         int scope = column.getScope();
>         if (scope!=0) {
>           String[] replicatedEntry = new String[3]; 
>           replicatedEntry[0] = tableName;
>           replicatedEntry[1] = column.getNameAsString();
>           replicatedEntry[2] = peers.get(Integer.toString(scope));
>           replicatedColFams.add(replicatedEntry);
>         }
>       }
>     }
>     return replicatedColFams;
>   }
> {code}

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message