How Do I Delete All Permanent Functions from HiveServer?
Question
How can I delete permanent user-defined functions (UDFs) on multiple HiveServers at the same time?
Answer
Multiple HiveServers share one MetaStore database. Therefore, there is a delay in the data synchronization between the MetaStore database and the HiveServer memory. If a permanent UDF is deleted from one HiveServer, the operation result cannot be synchronized to the other HiveServers promptly.
In this case, you need to log in to the Hive client to connect to each HiveServer and delete permanent UDFs on the HiveServers one by one. The operations are as follows:
- Log in to the node where the Hive client is installed as the Hive client installation user.
- Run the following command to go to the client installation directory:
cdClient installation directory
For example, if the client installation directory is /opt/client, run the following command:
cd /opt/client
- Run the following command to configure environment variables:
source bigdata_env
- Run the following command to authenticate the user:
kinitHive service user
The login user must have the Hive admin rights.
- Run the following command to connect to the specified HiveServer:
beeline -u "jdbc:hive2://10.39.151.74:21066/default;sasl.qop=auth-conf;auth=KERBEROS;principal=hive/hadoop.<system domain name>@<system domain name>"
- 10.39.151.74 is the IP address of the node where the HiveServer is located.
- 21066 is the port number of the HiveServer. The HiveServer port number ranges from 21066 to 21070 by default. Use the actual port number.
- hive is the username. For example, if the Hive1 instance is used, the username is hive1.
- You can log in to FusionInsight Manager, choose System > Permission > Domain and Mutual Trust, and view the value of Local Domain, which is the current system domain name.
- hive/hadoop.<system domain name> is the username. All letters in the system domain name contained in the username are lowercase letters.
- Run the following command to enable the Hive admin rights:
set role admin;
- Run the following command to delete the permanent UDF:
drop function function_name;
- function_name indicates the name of the permanent function.
- If the permanent UDF is created in Spark, the permanent UDF needs to be deleted from Spark and then from HiveServer by running the preceding command.
- Check whether the permanent UDFs are deleted from all HiveServers.
- If yes, no further action is required.
- If no, go to 5.
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