How to change Java locations for NetOps Kafka
search cancel

How to change Java locations for NetOps Kafka

book

Article ID: 434124

calendar_today

Updated On:

Products

Network Observability Spectrum

Issue/Introduction

There may be a time or need to update or change the location of the JRE being used for Kafka.

After OS patching when trying to set up the kafka integration from the Spectrum Administration page you may see "HTTP Status 429 - To Many Requests"

Environment

Non-HTTPS setups currently.

Resolution

1. Update the service files:

/etc/systemd/system/netops-kafka.service -

[Unit]
Description=NetOps Kafka
Requires=netops-kafka-zookeeper.service
After=netops-kafka-zookeeper.service

[Service]
Type=simple
#Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.18.0.8-1.el9.x86_64"

Environment="JAVA_HOME=/home/user/jdk17/jdk-17.0.18+8-jre"
Environment="KAFKA_HEAP_OPTS=-Xmx1G -Xms1G"
User=root
Group=root
ExecStartPre=/opt/CA/netops-kafka/scripts/checkZookeeper.sh hostname 2181
ExecStart=/opt/CA/netops-kafka/kafka/bin/kafka-server-start.sh /opt/CA/netops-kafka/kafka/config/server.properties
ExecStop=/opt/CA/netops-kafka/kafka/bin/kafka-server-stop.sh

[Install]
WantedBy=multi-user.target

Update the "Envrionment="JAVA_HOME=" variable.  The old can be commented out, as the above indicates.

/etc/systemd/system/netops-kafka-zookeeper.service - 

[Unit]
Description=NetOps Kafka Zookeeper
After=syslog.target network.target

[Service]
Type=simple
#Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.18.0.8-1.el9.x86_64"
Environment="JAVA_HOME=/home/user/jdk17/jdk-17.0.18+8-jre"
Environment="KAFKA_HEAP_OPTS=-Xmx512M -Xms512M"
User=root
Group=root
ExecStart=/opt/CA/netops-kafka/kafka/bin/zookeeper-server-start.sh /opt/CA/netops-kafka/kafka/config/zookeeper.properties
ExecStop=/opt/CA/netops-kafka/kafka/bin/zookeeper-server-stop.sh

[Install]
WantedBy=multi-user.target

/opt/CA/netops-kafka/config/answer.properties - 

installationDirectory=/opt/CA/netops-kafka
#javaHome=/usr/lib/jvm/java-17-openjdk-17.0.18.0.8-1.el9.x86_64
javaHome=/home/user/jdk17/jdk-17.0.18+8-jre
user=root
userGroup=root
partitions=10
logRetention=1
zookeeperClientPort=2181
zookeeperMaxMemory=512M
zookeeperData=/opt/CA/netops-kafka/zookeeper-snapshots
zookeeperLogs=/opt/CA/netops-kafka/zookeeper-logs
configureService=Y
configCluster=n
zookeeperHost=hostname
dataDirectory=/opt/CA/netops-kafka/kafka-data-logs
kafkaPort=9092
maxMemory=1G
brokerBindHostAddress=hostname
brokerClientHostAddress=hostname
jmxMonitoringEnabled=n
jmxAuthenticationEnabled=N
jmxUser=kafkaControl
jmxPassword=changeit
jmxPort=10167
jmxRMIPort=10168
configureSSL=n

2. Reload the daemon via:

systemctl daemon-reload

3. Restart the services:

systemctl stop netops-kafka-zookeeper

systemctl stop netops-kafka

Wait 15 seconds, then:

systemctl start netops-kafka

The zookeeper service will start with the Kafka service.