.. _controlcenter_userguide_ksql: ######################################### Manage |ksqldb| Using |c3-short| for |cp| ######################################### |c3-short| provides the convenience of running streaming queries on one or more |ksqldb| clusters within its graphical user interface. The |ksqldb| feature is :ref:`enabled ` by default in |c3-short|. .. important:: If :ref:`RBAC ` is enabled, the ability to view and use |ksqldb| in |c3-short| is determined by the assigned roles and associated privileges configured in both |ksqldb| and |c3-short|. For more information about |ksqldb|, see :ref:`ksql_home`. .. tip:: See the |cp| :ref:`quick start ` for fast set ups of streams, tables, and persisted running queries in |c3-short|. .. _c3_config_ksql_cluster: Configure |c3-short| for |ksqldb| clusters ========================================== When you start a local |cp| installation by using the `confluent local services start `__ command from the |confluent-cli|, a default |ksqldb| cluster named **ksqlDB** is created for you. To configure |c3-short| to communicate with your own multiple |ksqldb| clusters in a production environment, set the following options in the appropriate ``control-center.properties`` files: - ``confluent.controlcenter.ksql..url = `` - ``confluent.controlcenter.ksql..advertised.url = `` These options are required for connecting |c3-short| to your |ksqldb| clusters. For more information, see the :ref:`controlcenter_ksql_settings` options in the :ref:`controlcenter_configuration`. .. important:: Be sure to review :ref:`integrate-ksql-with-confluent-control-center` for more information on configurations for both |ksqldb| and |c3-short|. Links to comprehensive |ksqldb| documentation are available throughout the |c3-short| |ksqldb| web interface. .. _c3_ksql_clusters_page: |ksqldb| clusters page ====================== To access the |ksqldb| clusters page, click the cluster from the navigation bar and select **ksqlDB** from the cluster submenu. Use the |ksqldb| clusters page to: - View a summary of all |ksqldb| clusters connected to |c3-short|. - Search for a |ksqldb| cluster being managed by the |c3-short| instance. - Browse topic messages. - View the number of running queries, registered streams, and registered tables for each |ksqldb| cluster. - Navigate to the :ref:`c3_ksql_editor`, :ref:`c3_ksql_streams`, :ref:`c3_ksql_tables`, and :ref:`c3_ksql_running_queries` for each |ksqldb| cluster. Click the |ksqldb| cluster name link to navigate to the |ksqldb| Editor and other pages. .. figure:: ../ksqldb/img/c3-ksql-app-list.png :width: 800px :alt: ksqlDB clusters list page in Confluent Control Center ksqlDB clusters page in Control Center .. _c3_ksql_editor: |ksqldb| Editor =============== To access the |ksqldb| Editor page, click the |ksqldb| cluster name in the :ref:`c3_ksql_clusters_page`. Use the |ksqldb| Editor page to create streams and tables, run SQL queries, and browse messages. .. figure:: ../ksqldb/img/c3-ksql-query-table.png :width: 800px :alt: ksqlDB Editor in Confluent Control Center ksqlDB Editor in Control Center After creating streams and tables, the resizeable streams and tables pane is populated with the defined streams and tables for the cluster, beyond the default ``KSQL_PROCESSING_LOG``: - Streams are indicated with a blue **St** expandable node: |str| - Tables are indicated with a brown **Tb** expandable node: |tbl| .. |str| image:: ../ksqldb/img/c3-ksql-str-icon.png .. |tbl| image:: ../ksqldb/img/c3-ksql-tbl-icon.png Click a node to view the schema for a stream or table. .. figure:: ../ksqldb/img/c3-ksql-streams-and-tables-pane.png :width: 800px :alt: ksqlDB Editor in Confluent Control Center browse streams and table schemas pane ksqlDB Editor in Confluent Control Center with search and browse pane indicated A **Search** box enables searching for streams and tables. .. _c3_download_selected_msgs_ksql: Download selected messages ========================== Download selected rows of messages in a JSON format. You can download messages from the Messages browser in :ref:`Topics ` or :ref:`ksqlDB Editor `. Run a query in the |ksqldb| Editor to activate the message browser area. After the messages area is populated with messages, you can select messages for download, whether the query is running or stopped. #. Select one or more contiguous or non-contiguous rows. .. tip:: Press the **command** key + click (Ctrl key on Windows) to select non-contiguous rows. Press **shift** + click on a beginning and ending row to select a contiguous range of messages. .. figure:: ../ksqldb/img/c3-ksql-download-records.png :width: 800px :alt: Selected message for download in ksqlDB Editor browse messages pane .. |download| image:: ../ksqldb/img/c3-ksql-download-button.png #. Select **JSON** and click **Download**. A file named ``selected_data_.json`` that contains the selected messages in JSON format is downloaded into your downloads directory. The *n* represents the number of selected messages. Example filename: ``selected_data_1.json`` Example contents: .. code:: json [{"VIEWTIME":1611859623088,"USERID":"User_3","PAGEID":"Page_93"}] .. _c3_ksql_streams: Streams ======= To access the Streams page, click the |ksqldb| cluster name in the :ref:`c3_ksql_clusters_page` and click the **Streams** tab. Use the Streams page to: - View a summary of streams for the |ksqldb| cluster. - Search for streams. - View the Describe stream output (analogous to the :ksqldb-docs:`DESCRIBE|developer-guide/ksqldb-reference/describe/` command in the |ksqldb| CLI). - Jump to the |ksqldb| Editor page to query the stream. - Drop a stream (analogous to the :ksqldb-docs:`DROP STREAM|developer-guide/ksqldb-reference/drop-stream/` command in the |ksqldb| CLI). .. figure:: ../ksqldb/img/c3-ksql-streams-list.png :width: 800px :alt: ksqlDB Streams page in Control Center ksqlDB Streams page in Control Center Click a stream to view its information, like the stream name, associated |ak| topic, number of partitions and replicas, and the data format. .. figure:: ../ksqldb/img/c3-ksql-stream-inspect.png :width: 600px :alt: ksqlDB Inspect Stream page in Control Center ksqlDB Inspect Stream page in Control Center .. _c3_ksql_tables: Tables ====== To access the Tables page, click the |ksqldb| cluster name in the :ref:`c3_ksql_clusters_page` and click the **Tables** tab. Use the Tables page to: - View a summary of tables for the |ksqldb| cluster. - Search for tables. - View the Describe table output (analogous to the `DESCRIBE|developer-guide/ksqldb-reference/describe/` command in the |ksqldb| CLI) - Jump to the |ksqldb| Editor page to query the table. - Drop a table (analogous to the `DROP TABLE|developer-guide/ksqldb-reference/drop-table/` command in the |ksqldb| CLI). .. figure:: ../ksqldb/img/c3-ksql-tables-list.png :width: 800px :alt: The ksqlDB Tables page in Confluent Control Center The ksqlDB Tables page in Control Center Click a table to view its information, like the table name, associated |ak| topic, number of partitions and replicas, and the data format. .. figure:: ../ksqldb/img/c3-ksql-table-inspect.png :width: 600px :alt: ksqlDB Inspect Table page in Confluent Control Center ksqlDB Inspect Table page in Control Center .. _c3_ksql_running_queries: Persistent Queries ================== To see your running persistent queries, click the |ksqldb| cluster name in the :ref:`c3_ksql_clusters_page` and click the **Persistent Queries** tab. Use the Persistent Queries page to: - View the syntax and details of persistent queries. - Search persistent queries. - View the query execution plan by clicking **Explain** (analogous to the :ksqldb-docs:`EXPLAIN|developer-guide/ksqldb-reference/explain/` command in the |ksqldb| CLI). - Terminate a persistent query. .. figure:: ../ksqldb/img/c3-ksql-running-queries.png :width: 800px :alt: ksqlDB Persistent Queries page in Confluent Control Center ksqlDB Persistent Queries page in Control Center .. tip:: Go through the |cp| :ref:`quick start ` for a fast set up of streams, tables, and persisted running queries in |c3-short|. Flow View ========= To access the Flow View page, click the |ksqldb| cluster name in the :ref:`c3_ksql_clusters_page` and click the **Flow** tab. Use Flow View to: - View the topology of your |ksqldb| cluster. - Inspect the details of streams, tables, and the |ksqldb| statements that create them. - View events as they flow through your cluster. .. figure:: ../ksqldb/img/c3-ksql-flow-1.png :width: 800px :alt: ksqlDB Flow View in Confluent Control Center ksqlDB cluster topology in Flow View Click a node in the graph to see details about the topology of your |ksqldb| cluster. For example, click on a stream to see its schema and the messages as they arrive in realtime. .. figure:: ../ksqldb/img/c3-ksql-flow-2.png :width: 800px :alt: ksqlDB Flow View in Control Center Detail view of a stream showing live messages .. _c3_enable_disable_ksql: Enable and disable the |ksqldb| feature in |c3-short| ===================================================== The |ksqldb| feature is enabled by default. The feature can be disabled by setting the ``confluent.controlcenter.ksql.enable`` option in the |c3-short| properties file to ``false``. After disabling the feature, the |ksqldb| submenu in the Cluster navigation is no longer visible in the |c3-short| UI. You can disable the setting if you are not using |rbac| in |c3-short| or |ksqldb|, and you do not want anyone to access the |ksqldb| feature. .. important:: If :ref:`RBAC ` is enabled for |c3-short|, it takes precedence over Access Control settings. To disable the |ksqldb| feature in |c3-short|: #. Set the ``confluent.controlcenter.ksql.enable`` option in your ``control-center.properties`` file to ``false``. .. code:: bash ... confluent.controlcenter.ksql.enable=false ... .. note:: Make the change in the appropriate |c3-short| properties files configured for your environments, including ``control-center-dev.properties`` or ``control-center-production.properties``. The properties files are located in ``/path-to-confluent/etc/confluent-control-center/``. #. Restart |c3-short| and pass in the properties file for the configuration to take effect. - Local (dev) environment: .. important:: Do not use :confluent-cli:`confluent local|command-reference/local/index.html` for production use. .. sourcecode:: bash confluent local services control-center stop confluent local services control-center start --config="../etc/confluent-control-center/control-center.properties" - Production environment: .. sourcecode:: bash ./bin/control-center-stop ./bin/control-center-start ../etc/confluent-control-center/control-center.properties To enable the feature again, set the option back to ``true`` and restart |c3-short| with the updated properties file. Next Steps ========== - :ref:`quickstart`