Configuring the Validity Period and Data Update of Materialized Views
Validity Period of Materialized Views
The mv_validity field for creating a materialized view indicates the validity period of the materialized view. HetuEngine allows you to rewrite the SQL statements using only the materialized views within the validity period.
Refreshing Materialized View Data
If data needs to be updated periodically, you can use either of the following methods to periodically refresh the materialized views:
- Manually refreshing a materialized view
Run the refresh materialized view <mv name> command on the HetuEngine client by referring to Using the HetuEngine Client, or run the refresh materialized view <mv name> command using JDBC in the service program to manually update the database.
- Automatically refreshing a materialized view
- To enable the automatic refresh capability of the materialized views, you must set a compute instance as the maintenance instance. For details, see Configuring a HetuEngine Maintenance Instance.
- Use create materialized view to create a materialized view that can be automatically refreshed.
- If there are too many materialized views, some materialized views may expire due to too long waiting time.
- The automatic refresh function does not automatically refresh materialized views in the disable status.
Automatically Refreshing Materialized Views When Querying External Hive Data Sources
By default, the maintenance instance uses the HetuEngine built-in user hetuserver/hadoop.<System domain name> for refreshing materialized views. When materialized view creation statements query external Hive data sources where authentication has been enabled, you need to change the user for automatically refreshing materialized views as follows:
- Check whether the HetuEngine service has been installed in the peer cluster.
- Prepare the user used by the system for automated refresh.
- Create a human-machine user with the same name in both the local and peer clusters.
Take mvuser as an example. In the peer cluster, add it to the supergroup user group. In the local cluster, add it to the supergroup and hive user groups and add the tenant role of the maintenance instance.
- (Optional) If Ranger authentication is enabled in the local cluster, grant the permission to refresh materialized views and set sessions permission to the mvuser user. For details, see Table 1 and Table 2.
- Create a human-machine user with the same name in both the local and peer clusters.
- Log in to FusionInsight Manager as the HetuEngine administrator.
- Choose Cluster > Services > HetuEngine and click the Configurations tab and then All Configurations.
- Search for jobsystem.customized.properties, add a custom configuration named hetuserver.engine.jobsystem.inner.principal, and set its value according to the following content. Then, click Save and operate as prompted.
- If the HetuEngine service has been installed in the peer cluster, set the value to hetuserver.
- If the HetuEngine service is not installed in the peer cluster, set the value the user name created in 2.a.
- Click the Instance tab, select all HSBroker instances, click More, and select Restart Instance to restart the HSBroker instances as prompted.
- In the displayed Dashboard tab, find the Basic Information area, and click the link next to HSConsole WebUI. In the Compute Instance tab, locate the maintenance instance and click Restart in the Operation column and operate as prompted.
Instances with the icon displayed next to their names are maintenance instances. You can also confirm the maintenance instance by referring to Configuring a HetuEngine Maintenance Instance.
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