.. _integrate-ksql-with-confluent-control-center: Connect Standalone |ksqldb| Server Instances to |c3| #################################################### You can develop event streaming applications by using the |ksqldb| user interface provided by |c3|. In |c3-short|, you can create |ak-tm| topics and develop persistent queries in the |ksqldb| query editor. When you install |cp|, |ksqldb| Server is integrated with |c3-short| by default, and you can configure |c3-short| to interact with other |ksqldb| Server instances that run on separate hosts. .. image:: ./img/c3-ksql-flow-2.png :width: 800px :align: center :alt: Screenshot of the ksqlDB Create Stream interface in Confluent Control Center. Configuration Settings for |ksqldb| and |c3-short| ************************************************** Set up the integration between |ksqldb| and |c3-short| by assigning properties in the |ksqldb| Server and |c3-short| configuration files. * By default, the |ksqldb| Server configuration file is installed at `CONFLUENT_HOME/etc/ksqldb/ksql-server.properties``. * By default, the |c3-short| configuration file is installed at ``CONFLUENT_HOME/etc/confluent-control-center/control-center.properties``. You can set up |ksqldb| Server to communicate securely with other components in |cp|. For more information, see :ksqldb-docs:`Configure Security for ksqlDB|operate-and-deploy/installation/server-config/security/`. .. note:: To run |ksqldb| queries from |c3-short|, both |ksqldb| and |c3-short| must be running on either HTTP or HTTPS. Network Configuration for |ksqldb| and |c3-short| ================================================= Use these configuration settings to set up network connectivity between |ksqldb| and |c3-short|. * In the |ksqldb| Server configuration file, set the :ksqldb-docs:`listeners|operate-and-deploy/installation/server-config/config-reference/#listeners` property to the IP address of the REST API endpoint for |ksqldb| Server. Typical values are ``http://0.0.0.0:8088`` and ``http://localhost:8088``. * In the |c3-short| configuration file, set the ``confluent.controlcenter.ksql..url`` property to the hostnames and listener ports for the |ksqldb| cluster specified by ````. This setting specifies how |c3-short| communicates with |ksqldb| Server for regular HTTP requests. For more information, see :ref:`controlcenter_ksql_settings`. * If |ksqldb| Server communicates over an internal DNS that is not externally resolvable or routeable, set the ``confluent.controlcenter.ksql..advertised.url`` property in the |c3-short| configuration file. This setting specifies how the browser communicates with |ksqldb| Server for websocket requests. For more information, see :ref:`controlcenter_ksql_settings`. When |ksqldb| Server and |c3| run on the same host, you can use the default configuration defined by |cp| setup. When |ksqldb| and |c3-short| run on different hosts *************************************************** If |ksqldb| Server and |c3-short| run on different hosts, you must specify a configuration that ensures |ksqldb| Server and |c3-short| can communicate. This is necessary when |ksqldb| Server and |c3-short|: * Run in separate containers. * Run in separate virtual machines. * Communicate over a virtual private network (VPN). * Use different URLs, for example when the |ksqldb| Server host publishes a public URL that's different from the private URL for |ksqldb| Server. .. note:: When |ksqldb| and |c3-short| communicate over a virtual private network (VPN), |c3-short| proxies your queries, but query results stream directly from |ksqldb| Server back to your browser without going through |c3-short|. Over a VPN, the advertised URL isn't ``localhost``. Instead, it's the hostname of the remote server. Assign the following configuration properties to integrate |ksqldb| Server with |c3-short| when they run on separate hosts. |ksqldb| Server Configuration ============================= In the |ksqldb| Server configuration file, set ``listeners`` to bind to all interfaces: .. code:: properties listeners=http://0.0.0.0:8088 Configure |ksqldb| to accept cross-origin requests from the |c3| UI by adding the following CORS settings to the |ksqldb| Server configuration file. .. code:: properties access.control.allow.origin=* access.control.allow.methods=GET,POST,HEAD access.control.allow.headers=X-Requested-With,Content-Type,Accept,Origin,Authorization |c3-short| Configuration ======================== In the |c3-short| configuration file, set ``confluent.controlcenter.ksql..url`` to a list of URLs for the |ksqldb| Server hosts, which must be reachable from the host that |c3-short| is installed on. Replace ```` with the name that |c3-short| uses to identify the |ksqldb| cluster. :: confluent.controlcenter.ksql..url=, , ... Also, set ``confluent.controlcenter.ksql..advertised.url`` to the public IP addresses published by the |ksqldb| Server hosts, which must be a list of URLs that the browser can resolve through externally available DNS. :: confluent.controlcenter.ksql..advertised.url=, , ... The |c3-short| configuration must match the |ksqldb| Server ``listeners`` values. Use the ``curl`` command to check whether these URLs are reachable. Depending on your deployment, you may need to check from two different hosts: * Check from the host where |c3-short| is running, which is relevant for the ``confluent.controlcenter.ksql..url`` setting. * Check from the host where the browser is running, which is relevant for the ``confluent.controlcenter.ksql..advertised.url`` setting. On both hosts, run the following command to confirm that the |ksqldb| Server cluster is reachable. The ``hostname`` value is one of the hosts in the listed in the ``confluent.controlcenter.ksql..url`` and ``confluent.controlcenter.ksql..advertised.url`` configuration settings. .. codewithvars:: bash curl http://:8088/info \ {"KsqlServerInfo":{"version":"|release|","kafkaClusterId":"","ksqlServiceId":"default_"}}% .. note:: You must specify the ports in the |ksqldb| URL settings. For example, if the public URL is ``http://ksql-server-677739697.us-east-1.elb.amazonaws.com:80``, be sure to include port ``80``, or the |c3-short| connection to |ksqldb| Server will fail. Check Network Connectivity Between |ksqldb| and |c3|-short ========================================================== Use a web browser to check the configuration of an advertised URL. Make sure that your browser can reach the ``info`` endpoint at ``http:///info``. If the configuration is wrong, and the browser can't resolve the URL of the |ksqldb| Server host, you'll receive an error: ``Websocket error when communicating with ``. Check |ksqldb| Server Network Binding ===================================== If |c3-short| doesn't connect with your |ksqldb| Server instance, check the network binding on the |ksqldb| Server host: .. code:: bash sudo netstat -plnt|grep $(ps -ef|grep KsqlServerMain|grep -v grep|awk '') If your |ksqldb| server is bound to ``localhost`` only, your output should resemble: .. code:: bash tcp6 0 0 127.0.0.1:8088 :::* LISTEN 64383/java tcp6 0 0 :::34791 :::* LISTEN 64383/java If ``0.0.0.0`` isn't listed, |ksqldb| Server isn't accepting external connections. In the ``ksql-server.properties`` file, set ``listeners=http://0.0.0.0:8088`` and restart |ksqldb| Server. Next Steps ********** * :cloud:`Connecting ksqlDB to Confluent Cloud|cp-component/ksql-cloud-config.html` * :ksqldb-docs:`Configure Security for ksqlDB|operate-and-deploy/installation/server-config/security/`