# Connecting DataSources to Discovery

This page describes how to connect DataSource applications to a Discovery server.

## Requirements

The instructions on this page assume that you have already completed the first stage in the migration path below:

* [x] [Deploy Discovery server](discovery-deploying-discovery.md)
* [ ] **Connect DataSources to Discovery**
* [ ] Migrate to Discovery licensing
* [ ] Migrate to peer discovery
* [ ] Migrate to scalable data services

## Connecting a Liberator to a Discovery server

**Requires:** Liberator 7.1.25+

<details>
<summary>Deployment Framework managed configuration</summary>

Follow the steps below:

1. Stop all Caplin Platform components:

   ```
   $ ./dfw stop
   ```
2. In the Deployment Framework’s `global_config/environment.conf` file, set the following variables:

   **global_config/environment.conf**

   ```
   define DISCOVERY_ADDR __address__ … ①
   define DISCOVERY_CLUSTER_NAME __name__ ②
   ```
   1. A space-separated list of hostnames or IP addresses of Discovery servers in your deployment. See [discovery-addr](../datasource/datasource-discovery-configuration.md#discovery-addr).
   2. The name of the Discovery cluster in your deployment. See [discovery-cluster-name](../datasource/datasource-discovery-configuration.md#discovery-cluster-name).
3. Deactivate the `LiberatorJMX` blade if it is enabled:

   ```
   $ .dfw deactivate LiberatorJMX
   ```
4. Activate the `LiberatorDiscovery` and `LiberatorSockmon` configuration blades:

   ```
   $ ./dfw activate LiberatorDiscovery LiberatorSockmon
   ```
5. Make the following changes or additions to Liberator’s `rttpd.conf` override file:

   **global_config/overrides/servers/Liberator/etc/rttpd.conf**

   ```
   datasrc-local-label       __label__ ①
   datasrc-public-addresses  _address_ … ②
   ```
   1. A unique identifier for this Liberator (see [datasrc-local-label](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-local-label)).
   2. [Liberator 7.1.27+] A list of addresses at which peers and Discovery can connect to this Liberator. See [`datasrc-public-addresses`](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-public-addresses)
6. If you are licensing this Liberator through Discovery, remove the licence file for this Liberator from the Deployment Framework’s `global-config/licenses` directory.

   For more information on licensing models in Discovery deployments, see [Discovery licensing](discovery-licensing.md).
7. Restart all Caplin Platform components:

   ```
   $ ./dfw start
   ```
</details>

<details>
<summary>Manual configuration</summary>

Make the following changes to Liberator’s `etc/rttpd.conf` configuration file:

1. Delete `rmi-registry-port` and `rmi-client-port` configuration items:

   ```
   [.line-through]#rmi-registry-port __port__#
   [.line-through]#rmi-client-port   __port__#
   ```
2. Add Sockmon configuration items:

   ```
   monitor-moddir                  %r/lib
   monitor-module                  sockmon
   sockmon-port                    14301
   process-usage-period            10.0
   object-monitoring-interval      15.0
   session-monitoring-interval     15.0

   add-monuser
       user                        admin
       pass                        admin
   end-monuser
   ```
3. Add configuration to enable Liberator to connect to Discovery:

   ```
   discovery-addr          __address__ … ①
   discovery-cluster-name  __name__      ②
   datasrc-local-label     __label__     ③
   ```
   1. A space-separated list of the hostnames or IP addresses of Discovery servers in your deployment. See [`discovery-addr`](../datasource/datasource-discovery-configuration.md#discovery-addr).
   2. The name of the Discovery cluster in your deployment. See [`discovery-cluster-name`](../datasource/datasource-discovery-configuration.md#discovery-cluster-name)
   3. A unique identifier for this Liberator (see [datasrc-local-label](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-local-label)).
4. Add configuration to enable peers and Discovery to connect to Liberator:

   ```
   datasrc-public-addresses  _address_ … ①
   ```
   1. [Liberator 7.1.27+] A list of addresses at which peers and Discovery can connect to this Liberator. See [`datasrc-public-addresses`](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-public-addresses)
5. If you are licensing this Liberator through Discovery, remove the licence file for this Liberator from Liberator’s `etc/` directory. For more information on licensing models in Discovery deployments, see [Discovery licensing](discovery-licensing.md).
</details>

## Connecting a Transformer to a Discovery server

**Requires:** Transformer 7.1.14+

<details>
<summary>Deployment Framework managed configuration</summary>

Follow the steps below:

1. Stop all Caplin Platform components:

   ```
   $ ./dfw stop
   ```
2. In the Deployment Framework’s `global_config/environment.conf` file, set the following variables:

   **global_config/environment.conf**

   ```
   define DISCOVERY_ADDR __address__ … ①
   define DISCOVERY_CLUSTER_NAME __name__ ②
   ```
   1. A space-separated list of hostnames or IP addresses of Discovery servers in your deployment. See [discovery-addr](../datasource/datasource-discovery-configuration.md#discovery-addr).
   2. The name of the Discovery cluster in your deployment. See [discovery-cluster-name](../datasource/datasource-discovery-configuration.md#discovery-cluster-name).
3. Deactivate the `TransformerJMX` blade if it is enabled:

   ```
   $ .dfw deactivate TransformerJMX
   ```
4. Activate the `TransformerDiscovery` and `TransformerSockmon` configuration blades:

   ```
   $ ./dfw activate TransformerDiscovery TransformerSockmon
   ```
5. Make the following changes or additions to Transformer’s `transformer.conf` override file:

   **global_config/overrides/servers/Transformer/etc/transformer.conf**

   ```
   datasrc-local-label __label__ ①
   datasrc-public-addresses  _address_ … ②
   ```
   1. A unique identifier for this Transformer (see [datasrc-local-label](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-local-label)). This value is displayed in the Discovery web interface and referenced by the [`remote-label`](../datasource/datasource-data-services-configuration.md#remote-label) and [`remote-label-regex`](../datasource/datasource-data-services-configuration.md#remote-label-regex) options in data service configurations.
   2. [Transformer 7.1.17+] A list of addresses at which peers and Discovery can connect to this Transformer. See [`datasrc-public-addresses`](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-public-addresses)
6. Remove all configuration related to Transformer clustering. With Discovery, Transformer clustering is managed by Discovery and requires no configuration. For examples of traditional Transformer clustering configuration to remove, see [Setup a cluster of Transformers](../transformer/transformer-set-up-a-cluster-of-transformers.md).
7. If you are licensing this Transformer through Discovery, remove the licence file for this Transformer from the Deployment Framework’s `global-config/licences` directory.
8. Restart all Caplin Platform components:

   ```
   $ ./dfw start
   ```
</details>

<details>
<summary>Manual configuration</summary>

Make the following changes to Transformer’s `etc/transformer.conf` configuration file:

1. Delete `rmi-registry-port` and `rmi-client-port` configuration items:

   ```
   [.line-through]#rmi-registry-port __port__#
   [.line-through]#rmi-client-port   __port__#
   ```
2. Add Sockmon configuration items:

   ```
   monitor-moddir                  %r/lib
   monitor-module                  sockmon
   sockmon-port                    14301
   process-usage-period            10.0
   object-monitoring-interval      15.0
   session-monitoring-interval     15.0

   add-monuser
       user                        admin
       pass                        admin
   end-monuser
   ```
3. Add configuration to connect Transformer to Discovery:

   ```
   discovery-addr          __address__ … ①
   discovery-cluster-name  __name__      ②
   datasrc-local-label     __label__     ③
   ```
   1. A space-separated list of the hostnames or IP addresses of Discovery servers in your deployment. See [`discovery-addr`](../datasource/datasource-discovery-configuration.md#discovery-addr).
   2. The name of the Discovery cluster in your deployment. See [`discovery-cluster-name`](../datasource/datasource-discovery-configuration.md#discovery-cluster-name)
   3. A unique identifier for this Transformer. This value is displayed in the Discovery web interface and referenced by the [`remote-label`](../datasource/datasource-data-services-configuration.md#remote-label) and [`remote-label-regex`](../datasource/datasource-data-services-configuration.md#remote-label-regex) options in data service configuration. See [`datasrc-local-label`](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-local-label).
4. Add configuration to enable Discovery and DataSource peers to connect to Transformer:

   ```
   datasrc-public-addresses  _address_ … ①
   ```
   1. [Transformer 7.1.17+] A list of addresses at which peers and Discovery can connect to this Transformer. See [`datasrc-public-addresses`](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-public-addresses)
5. If you are licensing this Transformer through Discovery, remove the licence file for this Transformer from Transformer’s `etc/` directory. For more information on licensing models in Discovery deployments, see [Discovery licensing](discovery-licensing.md).
6. Remove all configuration related to Transformer clustering. With Discovery, Transformer clustering is managed by Discovery and requires no configuration. For examples of traditional Transformer clustering configuration to remove, see [Setup a cluster of Transformers](../transformer/transformer-set-up-a-cluster-of-transformers.md).
</details>

## Connecting a Java DataSource to a Discovery server

**Requires:** A Java DataSource built with DataSource for Java 7.1.18+

<details>
<summary>Deployment Framework managed configuration</summary>


The instructions below are for a Java DataSource with no configuration blades for Discovery or JMX.

Follow the steps below:

1. Stop all Caplin Platform components:

   ```
   $ ./dfw stop
   ```
2. In the Deployment Framework’s `global_config/environment.conf` file, set the following variables:

   **global_config/environment.conf**

   ```
   define DISCOVERY_ADDR         __address__ … ①
   define DISCOVERY_CLUSTER_NAME __name__ ②
   ```
   1. A space-separated list of hostnames or IP addresses of Discovery servers in your deployment. See [discovery-addr](../datasource/datasource-discovery-configuration.md#discovery-addr).
   2. The name of the Discovery cluster in your deployment. See [discovery-cluster-name](../datasource/datasource-discovery-configuration.md#discovery-cluster-name).
3. In the adapter’s `datasource.conf` override file, add the following configuration:

   **global_config/overrides/&lt;datasrc_name>/etc/datasource.conf**

   ```
   discovery-addr         ${DISCOVERY_ADDR} ①
   discovery-cluster-name ${DISCOVERY_CLUSTER_NAME} ②
   datasrc-local-label    __name__ ③
   ```
   1. See [discovery-addr](../datasource/datasource-discovery-configuration.md#discovery-addr)
   2. See [discovery-cluster-name](../datasource/datasource-discovery-configuration.md#discovery-cluster-name)
   3. A unique identifier for this DataSource component. This value is displayed in the Discovery web interface and referenced by the [`remote-label`](../datasource/datasource-data-services-configuration.md#remote-label) and [`remote-label-regex`](../datasource/datasource-data-services-configuration.md#remote-label-regex) options in data service configuration. See [`datasrc-local-label`](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-local-label).
4. Enable the adapter’s JMX monitoring interface:
   1. Add the following configuration to the Java Adapter’s `datasource.conf` override file:

      **global_config/overrides/&lt;datasrc_name>/etc/datasource.conf**

      ```
      # RMI registry port
      rmi-registry-port  __port_number__ ①

      # RMI client port
      rmi-client-port  __port_number__ ②

      add-monuser
          user  admin
          pass  admin
      end-monuser
      ```
      1. Set this to a free port number on the host. See [rmi-registry-port](../datasource/datasource-datasource-monitoring-configuration-part-1.md#rmi-registry-port).
      2. Set this to a free port number on the host. See [rmi-client-port](../datasource/datasource-datasource-monitoring-configuration-part-1.md#rmi-client-port).
   2. Add the following option to the `**java**` command in the Java adapter’s `bin/start-jar.sh` script:

      ```
      -Djava.rmi.server.hostname=$(hostname -I | cut -d' ' -f1)
      ```

+
For more information on enabling JMX in a Java adapter, see [Activating JMX in a Java DataSource](../cmc/activating-component-jmx-interface.md#activating-jmx-in-a-java-datasource).

1. Add configuration to enable Discovery and DataSource peers to connect to this DataSource:

   ```
   datasrc-public-addresses  _address_ … ①
   ```
   1. [DataSource for Java 7.1.20+] A list of addresses at which peers and Discovery can connect to this DataSource. See [`datasrc-public-addresses`](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-public-addresses)
2. Restart all Caplin Platform components:

   ```
   $ ./dfw start
   ```
</details>

<details>
<summary>Manual configuration</summary>

The instructions below are for a Java DataSource that is not packaged as a Deployment Framework kit.

Follow the steps below:

1. Stop the adapter if it is running.
2. In the adapter’s `datasource.conf` file, add the following configuration:

   **datasource.conf**

   ```
   discovery-addr         __address__ … ①
   discovery-cluster-name __name__ ②
   datasrc-local-label    __label__ ③
   ```
   1. A space-separated list of hostnames or IP addresses of Discovery servers in your deployment. See [discovery-addr](../datasource/datasource-discovery-configuration.md#discovery-addr).
   2. The name of the Discovery cluster in your deployment. See [discovery-cluster-name](../datasource/datasource-discovery-configuration.md#discovery-cluster-name).
   3. A unique identifier for this DataSource component. This value is displayed in the Discovery web interface and referenced by the [`remote-label`](../datasource/datasource-data-services-configuration.md#remote-label) and [`remote-label-regex`](../datasource/datasource-data-services-configuration.md#remote-label-regex) options in data service configuration. See [`datasrc-local-label`](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-local-label).
3. Enable the adapter’s JMX monitoring interface:
   1. Add the following configuration to the Java Adapter’s `datasource.conf` file:

      **datasource.conf**

      ```
      # RMI registry port
      rmi-registry-port  __port_number__ ①

      # RMI client port
      rmi-client-port  __port_number__ ②

      add-monuser
          user  admin
          pass  admin
      end-monuser
      ```
      1. Set this to a free port number on the host. See [rmi-registry-port](../datasource/datasource-datasource-monitoring-configuration-part-1.md#rmi-registry-port).
      2. Set this to a free port number on the host. See [rmi-client-port](../datasource/datasource-datasource-monitoring-configuration-part-1.md#rmi-client-port).
   2. Add the following option to the `**java**` command in the Java adapter’s startup script:

      ```
      -Djava.rmi.server.hostname=$(hostname -I | cut -d' ' -f1)
      ```

+
For more information on enabling JMX in a Java adapter, see [Activating JMX in a Java DataSource](../cmc/activating-component-jmx-interface.md#activating-jmx-in-a-java-datasource).

1. In the adapter’s `datasource.conf` file, add the following configuration to enable Discovery and DataSource peers to connect to this DataSource:

   ```
   datasrc-public-addresses  _address_ … ①
   ```
   1. [DataSource for Java 7.1.20+] A list of addresses at which peers and Discovery can connect to this DataSource. See [`datasrc-public-addresses`](../datasource/datasource-datasource-peers-configuration-part-2.md#datasrc-public-addresses)
2. Restart the adapter

</details>

## Next steps

If you’re following a staged migration to Discovery, move on to the next step when you’re ready:

* [x] Deploy Discovery server
* [x] Connect DataSources to Discovery
* [ ] [**Migrate to Discovery licensing**](discovery-licensing-migrating-components.md)
* [ ] Migrate to peer discovery
* [ ] Migrate to scalable data services

---

**See also:**

* [discovery-addr](../datasource/datasource-discovery-configuration.md#discovery-addr)
* [discovery-cluster-name](../datasource/datasource-discovery-configuration.md#discovery-cluster-name)
* [hazelcast/cluster-name](discovery-server-configuration.md#hazelcast-cluster-name)
