Associating Tables of a Schema to a Namespace

After you enable namespace mapping on a Phoenix schema that already has tables, you can migrate the tables to an HBase namespace. The namespace directory that contains the migrated tables inherits the schema name.

For example, if the schema name is store1, then the full path to the namespace is $hbase.rootdir/data/store1. System tables are migrated to the namespace automatically during the first connection after enabling namespace properties.

Associating table in a non-customized environment without Kerberos

You can run an appropriate command to associate a table in a non-customized environment without Kerberos.

Run the following command to associate a table:

phoenix-psql ZooKeeper_hostname -m Schema_name.table_name

Associating table in a customized Kerberos environment

Prerequisite: In a Kerberos-secured environment, you must have admin privileges (user hbase) to complete the following task.

  1. Run a command to migrate a table of a schema to a namespace, using the following command syntax for the options that apply to your environment:
    phoenix-psqlZooKeeper_hostnames:2181:zookeeper.znode.parent:HBase_headless_keytab_location:principal_name;TenantId=tenant_Id;CurrentSCN=current_SCN-m 
    schema_name.table_name
    Additional information for valid command parameters:
    • ZooKeeper_hostnames

      Enter the ZooKeeper hostname or hostnames that compose the ZooKeeper quorum. If you enter multiple hostnames, enter them as comma-separated values. This parameter is required. You must append the colon and ZooKeeper port number if you invoke the other security parameters in the command. The default port number is 2181.

    • zookeeper.znode.parent

      This setting is defined in the hbase-site.xml file.

    • -m schema_name.table_name

      The -m argument is required. There is a space before and after the -m option.