Constructing a Data Lake
MRS can only connect to the hive catalog and the default database in LakeFormation.
After a LakeFormation instance is created, you can create catalogs and metadata such as databases and tables as required.
For example, perform the following steps to create a catalog named hive (fixed name, which cannot be customized) and create a database named default (fixed name, which cannot be customized) in the catalog. Assign permissions for the two data tables table_A and table_B contained in the database.
Creating an OBS Path for Storing Metadata
- Log in to the LakeFormation console.
- Click in the upper left corner of the page and choose Storage > Object Storage Service to access the Object Storage Service console.
- Click Parallel File Systems and click Create Parallel File System. On the displayed page, set the parameters, and click Create Now.
- File System Name: Set the name of the parallel file system as required, for example, lakeformation-test.
- Set other parameters based on the site requirements.
- On the Parallel File Systems page, click the name of the created file system, that is lakeformation-test.
- Click Files in the navigation pane, click Create Folder, enter a folder name, and click OK. Click the folder name and click Create Folder to create a subfolder.
Repeat this step to create paths for storing metadata in sequence. The following paths are examples:
- Catalog storage path: lakeformation-test/catalog1
- Database storage path: lakeformation-test/catalog1/database1
- Table storage path: lakeformation-test/catalog1/database1/table1 and lakeformation-test/catalog1/database1/table2
- Function storage path: lakeformation-test/catalog1/database1/udf1
Creating a Catalog
- Log in to the LakeFormation console.
- In the upper left corner, click and choose Analytics > LakeFormation to access the LakeFormation console.
- Select the created LakeFormation instance (for example, lakeformation-test). For how to create an instance, see the operations described in Creating a LakeFormation Instance and a Client Connection. Choose Metadata > Catalog in the navigation pane.
You only need one hive catalog per instance. If you already have one in the current instance, you can skip creating another one.
- Click Create in the upper right corner. On the displayed page, set the following parameters, and click Submit.
- Catalog Name: hive
The name is fixed and cannot be customized.
- Select Location: Click , select a storage location, for example, obs://lakeformation-test/catalog1, and click OK.
- Catalog Type: DEFAULT
- Retain the default values for other parameters.
- Catalog Name: hive
- After the catalog is created, you can view the catalog information on the Catalog page.
Creating a Database
- Log in to the LakeFormation console.
- In the upper left corner, click and choose Analytics > LakeFormation to access the LakeFormation console.
- Select the created LakeFormation instance (for example, lakeformation-test). For how to create an instance, see the operations described in Creating a LakeFormation Instance and a Client Connection. Choose Metadata > Database in the navigation pane.
- Select hive from the Catalog drop-down list box in the upper right corner.
You only need one default database per instance. If you already have one in the current instance, you can skip creating another one.
- Click Create, set related parameters, and click Submit.
- Database Name: default
The name is fixed and cannot be customized.
- Catalog: hive
- Select Location: Click , select a storage location, for example, obs://lakeformation-test/catalog1/database1, and click OK.
- Retain the default values for other parameters.
- Database Name: default
- After the catalog is created, you can view the database information on the Database page.
Creating a Table
- Log in to the LakeFormation console.
- In the upper left corner, click and choose Analytics > LakeFormation to access the LakeFormation console.
- Select the created LakeFormation instance (for example, lakeformation-test) from the drop-down list box on the left. For how to create an instance, see Creating a LakeFormation Instance and a Client Connection. Choose Metadata > Table in the navigation pane and select hive and default from the Catalog and Database drop-down lists in the upper right corner.
- Click Create, set related parameters, and click Submit.
- Table Name: Enter a table name, for example, table_A.
- Data Storage Location: Click , select a location for storing the table in the OBS parallel file system, for example, obs://lakeformation-test/catalog1/database1/table1, and click OK.
- Set other parameters based on the site requirements.
- Create another table named table_B and set the storage path to lakeformation-test/catalog1/database1/table2 by referring to 4.
- After these two tables are created, you can check these tables on the Table page.
Authorizing Metadata
- Log in to the LakeFormation console.
- In the upper left corner, click and choose Analytics > LakeFormation to access the LakeFormation console.
- Select the target LakeFormation instance from the drop-down list box on the left and choose Data Permissions > Data Authorization.
- Click Authorize, authorize the hive catalog and the default database as required, and click OK.
For details about authorization configurations and requirements, see Granting permissions.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot