User Guide

How To migrate Tornado to NATS

In this chapter we are going to explain how to migrate the communication channel inside Tornado from simple TCP connections to a communication via NATS server. In order to do so, you will need to modify the configuration files of both the Tornado Engine and of the Tornado Collectors.

Prerequisites:

  • NATS server already configured inside NetEye

Warning

Support for TCP communication in Tornado will be removed in the next version, therefore remember to migrate the configuration before the next upgrade!

Tornado Engine migration

The configuration file of the Tornado engine is:

/neteye/shared/tornado/conf/tornado.toml

The steps required are:

  1. To disable the TCP communication: you need to set the entry event_tcp_socket_enabled to false, as follows:

    event_tcp_socket_enabled = false
    

    Warning

    When event_tcp_socket_enabled is set to false, the entries event_socket_ip and event_socket_port will be ignored by Tornado

  2. To enable NATS communication: you need to set the entry nats_enabled to true as follows: nats_enabled = true

  3. Set the address of the NATS server that Tornado needs to connect with. By default it is set to nats-server.neteyelocal:4222. If this does not suit your configuration you need to set the address(es) accordingly:

    nats.client.addresses = ["nats-server.neteyelocal:4222"]
    
  4. Restart the Tornado daemon.

    • If you are on a NetEye single instance::

      systemctl restart tornado.service
      
    • If you are on a cluster environment:

      pcs resource restart tornado
      

More information about the settings of the Tornado configuration file can be found in the official documentation of Tornado.

Tornado Collectors migration

Each Tornado Collector has its own configuration file which can be found in the filepath:

/neteye/shared/tornado_<COLLECTOR_NAME>/conf/<COLLECTOR_NAME>.toml

For example, the configuration file of the Webhook Collector has filepath /neteye/shared/tornado_webhook_collector/conf/webhook_collector.toml

You need to configure each Tornado Collector as follows:

  1. If still present in the configuration file of the collector, please remove these two deprecated entries:

    tornado_event_socket_ip = [...]
    tornado_event_socket_port = [...]
    
  2. Comment the entries related to TCP communication, i.e.:

    # tcp_socket_ip = [...]    # tcp_socket_port = [...]
    
  3. Uncomment (and if needed adjust to your configuration) the entries related to NATS communication, i.e.:

    nats.client.addresses = ["nats-server.neteyelocal:4222"]
    nats.subject = "tornado.events"
    
  4. Restart the Tornado Collector.

    • If you are on a NetEye single instance:

      systemctl restart tornado_<COLLECTOR_NAME>.service
      
    • If you are on a cluster environment:

      pcs resource restart tornado_<COLLECTOR_NAME>