Skip to main content
Loading

Setting Java Options for Source Connectors

The Java options are passed to the source connectors by setting the JAVA_OPTS environment variable. The JAVA_OPTS environment variable is set differently for connectors running as systemd services and for connectors running as non-systemd Docker instances.

Procedure for source connector running as systemd service

Create a systemd override file

The following command creates a systemd override file for the source connector aerospike-kafka-outbound.

sudo systemctl edit aerospike-kafka-outbound

Set the JAVA_OPTS environment variable in the override file

In the override file that you created in the previous step, set the JAVA_OPTS environment variable in the Service section. Here is an example that sets a netty workdir and Java maximum heap size:

[Service]
Environment=JAVA_OPTS="-Dio.netty.native.workdir=/connector/tmp -Xmx1024m"

Reload the systemd manager configuration

Run the systemd command to reload the manager configuration:

sudo systemctl daemon-reload

Restart connector

Restart the systemd connector service for the aerospike-kafka-outbound source connector.

sudo systemctl restart aerospike-kafka-outbound

Procedure for Docker (non-systemd)

In a non-systemd environment the JAVA_OPTS environment variable should be explicitly set.

For docker this would take the form of adding -e "JAVA_OPTS=<list of java options>" to the exec.

docker run  --name=example-connector -p 8080:8080 -e "JAVA_OPTS=-Dio.netty.native.workdir=/connector/tmp -Xmx8G" aerospike/aerospike-kafka-outbound:2.0.0

Like the above examples, this sets a Netty workdir and Java maximum heap size but it could be any Java option.

To verify that this was set correctly you can check in Docker with docker top example-connector. You will see the source connector running with your Java options.