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.
The following example sets a Netty workdir and Java maximum heap size using /connector/tmp
as the workdir.
You may need to enable execute permissions on the /tmp
directory or use a different directory. To check the permissions, run ls -ld DIRECTORY_NAME
on the target directory.
[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, explicitly set the JAVA_OPTS
environment variable.
For Docker, add -e "JAVA_OPTS=LIST-OF-JAVA-OPTIONS"
to the docker run
command to set a Netty workdir and Java maximum heap size, though it could be any Java option.
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
To verify that this was set correctly, run docker top example-connector
.
You should see the source connector running with your Java options.