Tuning Apache Kafka
The configuration is shipped with some defaults, but depending on the size and network topology you might need to tune the Apache Kafka environment to meet certain needs.
Set Apache Kafka options directly in the org.opennms.core.ipc.rpc.kafka.cfg
and org.opennms.core.ipc.sink.kafka.cfg
file.
Alternatively, you can set Kafka producer/consumer options by defining additional system properties prefixed with org.opennms.core.ipc.rpc.kafka
and org.opennms.core.ipc.sink.kafka
.
Find available configuration parameters for Kafka here:
-
Producer Configs for RPC communication
-
New Consumer Configs for Sink communication
Multi-tenancy with Horizon and Kafka
Topics will be automatically created and are prefixed by default with OpenNMS
.
If you want to use an Apache Kafka cluster with multiple Horizon instances, customize the topic prefix by setting the org.opennms.instance.id
system property on Horizon and all its Minions and Sentinels to a string value that identifies your instance.
${OPENNMS_HOME}/etc/opennms.properties.d/instance-id.properties
org.opennms.instance.id=MyNMS
Update the Minion’s instance ID accordingly to match the Horizon instance.
${MINION_HOME}/etc/custom.system.properties
.org.opennms.instance.id=MyNMS
Tips for Kafka
-
For Kafka RPC, the number of partitions must be greater than or equal to the number of Minions at a location, and should be a multiple of the number of Minions at a location. When there are multiple locations, the partition count for RPC topics should be based on a multiple of the maximum number of Minions at the associated location.
-
By default, Kafka RPC uses a buffer size of 900KB. When set to a larger size, they will be split into 900kb chunks. Configure the maximum buffer size by setting
org.opennms.core.ipc.rpc.kafka.max.buffer.size
to the desired size in bytes. -
Default time to live (time at which request will expire) is 20000ms (20 seconds). To change it, configure the system property
org.opennms.core.ipc.rpc.kafka.ttl
in milliseconds.
Disable single topic for Kafka RPC
By default, Horizon uses single topic structure. One request topic is created for each location and one response topic is created for all modules, regardless of location.
Note that all Minions at any location must be running the same features in order to make use of single topic.
For any reason, if you need to have different topic for each module or need different features on each minion, you can disable single-topic as below.
Disabling Single topic must be configured on both Minion and OpenNMS.
${MINION_HOME}/etc/org.opennms.core.ipc.rpc.kafka.cfg
single-topic=false
${OPENNMS_HOME}/etc/opennms.properties.d/kafka.properties
org.opennms.core.ipc.rpc.kafka.single-topic=false
Create this file if it does not already exist.