Limit concurrent connections
To prevent a rogue application from repeatedly connecting to and monopolizing HiveServer, you can limit concurrent connections to HiveServer.
As administrator, you can limit concurrent connections by adding one or more of the following properties to the hive-site.xml configuration file:
- Maximum number of HiveServer concurrent connections per user
- Maximum number of HiveServer concurrent connections per IP address
- Maximum number of HiveServer concurrent connections per user and IP address combination
The default of each parameter is 0. You can change the value of each parameter to any
number. In this task, you use Apache Ambari to limit the number of concurrent
connections per user. Alternatively, you can modify
hive-site.xml from the file system. You must configure
concurrent connections on the server side; therefore, a
--hiveconf command does not work.
- The following components are running:
- Hive Metastore
- A database for the metastore, such as the default MySQL Server
- Hive clients
- You have a user name and password for connecting to Apache Hive.
- From the Ambari main navigation pane, select Hive and click CONFIGS.
- Scroll down and expand Custom hive-site.
hive.server2.limit.connections.per.user. and enter a property name intuitive to limiting the number of concurrent connections: for example,
- Enter a value representing the maximum number of concurrent connections: for example, 25.
In Property Type, select TEXT:
- Click Add.
In this example, connections are now limited to 25 per user.