1. Description
After installing Phoenix, the data tables that already exist in HBase will not be mapped automatically, so it is necessary to manually configure the existing data tables in the Phoenix to operate HBase.
2. Create an HBase table
> Create ' Phoenix ', ' info '
3. Inserting Data
> put ' Phoenix ', ' row001 ', ' Info:name ', ' Phoenix '
> put ' Phoenix ', ' row002 ', ' info:name ', ' hbase '
High-energy warning: hbase data table default primary key column name is row
4. Create a Phoenix table
Create a data table of the same structure in Phoenix
> CREATE TABLE "phoenix" (ROW varchar PRIMARY key, "info". " Name "varchar");
Early Warning high energy: it is important to note that table and column families and column names need to be enclosed in double quotation marks, because hbase is case-sensitive, and Phoenix automatically converts lowercase to uppercase when creating a table, if not surrounded by double quotes. This will create another table, Phoenix, in HBase.
5. Verification
View data in Phoenix's CLI interface.
> select * from "Phoenix";
High-energy warning: Here the query table name needs to be enclosed in double quotation marks, forcing not to be converted to uppercase.
The mapping was successful, and the "Phoenix" table in HBase could be manipulated directly from Phoenix.