Each Livy service uses active/passive high availability (not load-balanced
active/active). This procedure adds Livy Server roles or a separate Livy service and configures
unique ports, session state store paths, and ZooKeeper key prefixes.
Use this procedure when you need more than one independent Livy service in a cluster, each
with its own HA configuration. For example, you might run Livy-for-Spark3-1
on port 28998 and add Livy-for-Spark3-2 as a separate
service. Adding Livy Server roles to one service creates passive instances that redirect
requests to the single active instance; see Livy active/passive high
availability.
Prerequisites
- An existing Livy service (for example,
Livy-for-Spark3-1) is running.
- Administrative access to Cloudera Manager.
- Required hosts and resources are available in the cluster.
Add Livy roles to the existing Livy service
-
In Cloudera Manager, select .
To enable active/passive HA within an existing Livy service, add Livy Server role
instances. One instance is active at a time; the others are passive redirectors.
-
Click Add Role Instances.
-
For Livy Server, click Select Hosts,
select the desired hosts, and click OK.
-
Click Continue to deploy the roles.
-
On the Instances tab, verify that the new Livy Server roles are
listed.
-
Select the status checkboxes for all Livy instances, then from the Actions
for Selected menu, select Restart and confirm.
Add a new Livy service
-
In Cloudera Manager, select .
-
From the Actions menu, select Add
Service.
-
Select Livy-for-Spark3 as the service type and click
Continue.
-
On the dependencies step, select No dependencies, then click
Continue.
-
Assign gateways and hosts for the new Livy service roles.
-
Click Continue and complete the Add Service wizard. The new
Livy service starts automatically.
Resolve port conflicts
-
If the new Livy service fails to start with an error similar to the following, the
default port is already in use by another Livy service:
Exception in thread "main" java.io.IOException: Failed to bind to /0.0.0.0:28998
Caused by: java.net.BindException: Address already in use
-
In Cloudera Manager, select the new Livy service (for example,
Livy-for-Spark3-2) and open Configuration.
-
Search for
livy.server.port.
-
Change the port from the default
28998 to a unique value (for example,
28999).
-
Click Save Changes, confirm the configuration changes, and click
Continue.
-
When the service restarts with the updated port, click
Finish.
Configure unique session state store paths
-
Each independent Livy service must use a unique HDFS recovery path
(
livy.server.recovery.state-store.url) to prevent conflicts and enable
independent session recovery.
-
For
Livy-for-Spark3-1, open Configuration,
search for livy.server.recovery.state-store.url, and verify that the path
is unique (for example, /user/livy/recovery_for_livy3).
-
For
Livy-for-Spark3-2, open Configuration,
search for livy.server.recovery.state-store.url, and set a different path
(for example, /user/livy/recovery_for_livy3_1).
-
Click Save Changes for each service.
-
Restart both Livy services to apply the configuration.
Configure unique ZooKeeper key prefixes
-
Each independent Livy service must use a unique ZooKeeper key prefix
(
livy.server.zk.key-prefix) so that leader election namespaces do not
conflict.
-
For
Livy-for-Spark3-1, open Configuration,
search for livy.server.zk.key-prefix, and verify that the prefix is
unique (for example, livy3).
-
For
Livy-for-Spark3-2, open Configuration,
search for livy.server.zk.key-prefix, and set a different prefix (for
example, livy3_1).
-
Click Save Changes for each service.
-
Restart both Livy services to apply the configuration.