Namespace Mapping
From v4.8.0 onwards, user can enable to map it’s schema to the namespace so that any table created with schema will be created in the corresponding namespace of HBase
Configuration
Parameters to enable namespace mapping:-
Property | Description | Default |
phoenix.schema.isNamespaceMappingEnabled | If it is enabled, then the tables created with schema will be mapped to namespace.This needs to be set at client and server both. if set once, should not be rollback. Old client will not work after this property is enabled. | false |
phoenix.schema.mapSystemTablesToNamespace | Enabling this property will take affect when phoenix.connection.isNamespaceMappingEnabled is also set to true. If it is enabled, SYSTEM tables if present will automatically migrated to SYSTEM namespace. And If set to false , then system tables will be created in default namespace only. This needs to be set at client and server both. | true |
Grammer Available
Following DDL statements can be used to interact with schema.
CREATE SCHEMA. IF NOT EXISTS schemaName
|
| |
Use schema
Drop if exists schema name
How to migrate existing tables with schema to namespace
Usage example:
Move table(‘table_name’) to namespace of name ‘schema_name’
$ bin/psql.py <zookeeper> -m <schema_name>.<table_name>
What is namespace and benefits of mapping table to namespace
A namespace is a logical grouping of tables analogous to a database in relation database systems. This abstraction lays the groundwork for upcoming multi-tenancy related features:
- Quota Management - Restrict the amount of resources (i.e. regions, tables) a namespace can consume.
- Namespace Security Administration - Provide another level of security administration for tenants.
- Region server groups - A namespace/table can be pinned onto a subset of RegionServers thus guaranteeing a course level of isolation.