configuration.rst 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. .. _monitor_kafka_configuration:
  2. Kafka storage Configuration
  3. ===============================
  4. Many aspects of the monitor extension are configurable. The configuration files
  5. are stored in the data directory under the ``monitoring`` directory::
  6. <data_directory>
  7. monitoring/
  8. monitor.properties
  9. In particular:
  10. * **monitor.properties** - Can be extended to set the connection details to Apache Kafka.
  11. Monitor Storage
  12. ---------------
  13. How request data is persisted is configurable via the ``storage`` property defined in the
  14. ``monitor.properties`` file. The following values are supported for the ``storage`` property:
  15. * **memory** - Request data is to be persisted in memory alone.
  16. * **hibernate** - Request data is to be persisted in a relational database via Hibernate.
  17. * **kafka** - Request data is to be persisted in Apache Kafka.
  18. The default value is ``memory``, in order to use Apache Kafka the ``storage`` configuration needs
  19. to be switched to ``kafka``.
  20. In addition you can set the topic name with the ``kafka.topic`` property. The default value is ``geoserver-monitor``.
  21. You can set all the Kafka properties for a kafka producer by prefixing it with the ``kafka`` keyword e.g. set the acks to 1 with ``kafka.acks=1``.
  22. For further details on the Kafka producer properties see the `Kafka documentation <https://kafka.apache.org/documentation.html#producerconfigs>`_.
  23. The following is an example of the ``monitor.properties`` file configured to use Apache Kafka::
  24. storage=kafka
  25. ... other properties ...
  26. kafka.bootstrap.servers=localhost:9092
  27. kafka.topic=monitor
  28. kafka.acks=1
  29. kafka.retries=3
  30. kafka.batch.size=65536
  31. kafka.linger.ms=200
  32. kafka.compression.type=snappy
  33. kafka.schema.registry.url=http://localhost:8081
  34. In order to use Confluent Cloud you need to configure these properties::
  35. storage=kafka
  36. ... other properties ...
  37. kafka.bootstrap.servers=pkc-def12.europe-west.gcp.confluent.cloud:9092
  38. kafka.topic=monitor
  39. kafka.security.protocol=SASL_SSL
  40. kafka.sasl.mechanism=PLAIN
  41. kafka.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username='KAFKA_API_KEY' password='KAFKA_SECRET';
  42. kafka.schema.registry.url=https://psrc-abc12.europe-west.gcp.confluent.cloud
  43. kafka.schema.registry.basic.auth.credentials.source=USER_INFO
  44. kafka.schema.registry.basic.auth.user.info=SR_API_KEY:SR_API_SECRET
  45. kafka.acks=1
  46. kafka.retries=0
  47. kafka.batch.size=65536
  48. kafka.linger.ms=200
  49. kafka.compression.type=snappy
  50. It might be a good idea to set the ``kafka.linger.ms`` to avoid too many requests to the Kafka broker and get the benefits from batching and compression. One request can cause multiple messages to be sent to Kafka as a load of multiple tiles may does.
  51. Also the compressions should be quite effective as the messages repeat some data. Make sure to also set the ``kafka.compression.type``.