You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by vi...@apache.org on 2023/05/17 22:41:09 UTC

[druid] branch master updated: update tutorials to use clarify druid host location for Docker Compose + Druid version (#14295)

This is an automated email from the ASF dual-hosted git repository.

victoria pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new c84c174caa update tutorials to use clarify druid host location for Docker Compose + Druid version (#14295)
c84c174caa is described below

commit c84c174caafae9cf8df2735fe7fa08e3f55abf5b
Author: Charles Smith <te...@gmail.com>
AuthorDate: Wed May 17 15:41:02 2023 -0700

    update tutorials to use clarify druid host location for Docker Compose + Druid version (#14295)
---
 .../jupyter-notebooks/0-START-HERE.ipynb           |  9 ++++--
 .../jupyter-notebooks/Python_API_Tutorial.ipynb    | 10 ++++--
 .../jupyter-notebooks/api-tutorial.ipynb           | 36 ++++++++++------------
 .../jupyter-notebooks/kafka-tutorial.ipynb         | 18 +++++++----
 .../jupyter-notebooks/sql-tutorial.ipynb           | 35 +++++++++++++--------
 5 files changed, 64 insertions(+), 44 deletions(-)

diff --git a/examples/quickstart/jupyter-notebooks/0-START-HERE.ipynb b/examples/quickstart/jupyter-notebooks/0-START-HERE.ipynb
index 5e74fa71c1..0fdbad297f 100644
--- a/examples/quickstart/jupyter-notebooks/0-START-HERE.ipynb
+++ b/examples/quickstart/jupyter-notebooks/0-START-HERE.ipynb
@@ -77,7 +77,9 @@
    "source": [
     "## Tutorials\n",
     "\n",
-    "The notebooks are located in the [apache/druid repo](\n",
+    "If you run the [Docker for Jupyter Notebook tutorials](https://druid.apache.org/docs/latest/tutorials/tutorial-jupyter-docker.html), all the notebooks are included.\n",
+    "\n",
+    "Otherwise, you can find the notebooks in the [apache/druid repo](\n",
     "https://github.com/apache/druid/tree/master/examples/quickstart/jupyter-notebooks/).\n",
     "You can either clone the repo or download the notebooks you want individually.\n",
     "\n",
@@ -89,7 +91,8 @@
     "  basics related to the Druid REST API and several endpoints.\n",
     "- [Introduction to the Druid Python API](Python_API_Tutorial.ipynb) walks you through some of the\n",
     "  basics related to the Druid API using the Python wrapper API.\n",
-    "- [Learn the basics of Druid SQL](sql-tutorial.ipynb) introduces you to the unique aspects of Druid SQL with the primary focus on the SELECT statement. "
+    "- [Learn the basics of Druid SQL](sql-tutorial.ipynb) introduces you to the unique aspects of Druid SQL with the primary focus on the SELECT statement. \n",
+    "- [Ingest and query data from Apache Kafka](kafka-tutorial.ipynb) walks you through ingesting an event stream from Kafka."
    ]
   },
   {
@@ -151,7 +154,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.9.5"
+   "version": "3.8.16"
   }
  },
  "nbformat": 4,
diff --git a/examples/quickstart/jupyter-notebooks/Python_API_Tutorial.ipynb b/examples/quickstart/jupyter-notebooks/Python_API_Tutorial.ipynb
index 9077d2bc28..8861e2166c 100644
--- a/examples/quickstart/jupyter-notebooks/Python_API_Tutorial.ipynb
+++ b/examples/quickstart/jupyter-notebooks/Python_API_Tutorial.ipynb
@@ -28,6 +28,8 @@
     "\n",
     "This notebook provides a quick introduction to the Python wrapper around the [Druid REST API](api-tutorial.ipynb). This notebook assumes you are familiar with the basics of the REST API, and the [set of operations which Druid provides](https://druid.apache.org/docs/latest/operations/api-reference.html). This tutorial focuses on using Python to access those APIs rather than explaining the APIs themselves. The APIs themselves are covered in other notebooks that use the Python API.\n",
     "\n",
+    "This tutorial works with Druid 25.0.0 or later.\n",
+    "\n",
     "The Druid Python API is primarily intended to help with these notebook tutorials. It can also be used in your own ad-hoc notebooks, or in a regular Python program.\n",
     "\n",
     "The Druid Python API is a work in progress. The Druid team adds API wrappers as needed for the notebook tutorials. If you find you need additional wrappers, please feel free to add them, and post a PR to Apache Druid with your additions.\n",
@@ -58,6 +60,10 @@
     "\n",
     "The API uses the router to forward messages to each of Druid's services so that you don't have to keep track of the host and port for each service.\n",
     "\n",
+    "In the Docker Compose tutorial environment, the Router service runs at \"http://router:8888\".\n",
+    "If you are not using the Docker Compose environment, edit the URL for the `jupyter_client`.\n",
+    "For example, to `http://localhost:8888/`.\n",
+    "\n",
     "The `jupyter_client()` method waits for the cluster to be ready and sets up the client to display tables and messages as HTML. To use this code without waiting and without HTML formatting, use the `client()` method instead."
    ]
   },
@@ -68,7 +74,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "druid = druidapi.jupyter_client('http://localhost:8888')"
+    "druid = druidapi.jupyter_client('http://router:8888')"
    ]
   },
   {
@@ -735,7 +741,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.9.6"
+   "version": "3.8.16"
   }
  },
  "nbformat": 4,
diff --git a/examples/quickstart/jupyter-notebooks/api-tutorial.ipynb b/examples/quickstart/jupyter-notebooks/api-tutorial.ipynb
index 11f3bdf9ba..b2616b5d8e 100644
--- a/examples/quickstart/jupyter-notebooks/api-tutorial.ipynb
+++ b/examples/quickstart/jupyter-notebooks/api-tutorial.ipynb
@@ -60,28 +60,19 @@
    "source": [
     "## Prerequisites\n",
     "\n",
-    "Install the [Requests](https://requests.readthedocs.io/en/latest/) library for Python before you start. For example:\n",
+    "This tutorial works with Druid 25.0.0 or later.\n",
     "\n",
-    "```bash\n",
-    "pip install requests\n",
-    "```\n",
     "\n",
-    "Please read the [Requests Quickstart](https://requests.readthedocs.io/en/latest/user/quickstart/) to gain a basic understanding of how Requests works.\n",
+    "Launch this tutorial and all prerequisites using the `druid-jupyter` or `all-services` profiles of the Docker Compose file for Jupyter-based Druid tutorials. For more information, see [Docker for Jupyter Notebook tutorials](https://druid.apache.org/docs/latest/tutorials/tutorial-jupyter-docker.html).\n",
     "\n",
-    "Next, you'll need a Druid cluster. This tutorial uses the `micro-quickstart` config described in the [Druid quickstart](https://druid.apache.org/docs/latest/tutorials/index.html). So download that and start it if you haven't already. In the root of the Druid folder, run the following command to start Druid:\n",
+    "If you do not use the Docker Compose environment, you need the following:\n",
     "\n",
-    "```bash\n",
-    "./bin/start-micro-quickstart\n",
-    "```\n",
-    "\n",
-    "Finally, you'll need either JupyterLab (recommended) or Jupyter Notebook. Both the quickstart Druid cluster and Jupyter are deployed at `localhost:8888` by default, so you'll need to change the port for Jupyter. To do so, stop Jupyter and start it again with the `port` parameter included. For example, you can use the following command to start Jupyter on port `3001`:\n",
-    "\n",
-    "```bash\n",
-    "# If you're using JupyterLab\n",
-    "jupyter lab --port 3001\n",
-    "# If you're using Jupyter Notebook\n",
-    "jupyter notebook --port 3001 \n",
-    "```"
+    "* A running Druid instance.<br>\n",
+    "     Update the `druid_host` variable to point to your Router endpoint. For example:\n",
+    "     ```\n",
+    "     druid_host = \"http://localhost:8888\"`\n",
+    "     ```\n",
+    " "
    ]
   },
   {
@@ -103,7 +94,12 @@
    "source": [
     "import requests\n",
     "\n",
-    "druid_host = \"http://localhost:8888\"\n",
+    "# druid_host is the hostname and port for your Druid deployment. \n",
+    "# In the Docker Compose tutorial environment, this is the Router\n",
+    "# service running at \"http://router:8888\".\n",
+    "# If you are not using the Docker Compose environment, edit the `druid_host`.\n",
+    "\n",
+    "druid_host = \"http://router:8888\"\n",
     "druid_host"
    ]
   },
@@ -685,7 +681,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.9.6"
+   "version": "3.8.16"
   },
   "vscode": {
    "interpreter": {
diff --git a/examples/quickstart/jupyter-notebooks/kafka-tutorial.ipynb b/examples/quickstart/jupyter-notebooks/kafka-tutorial.ipynb
index 9ab6ce1681..b25f49ff95 100644
--- a/examples/quickstart/jupyter-notebooks/kafka-tutorial.ipynb
+++ b/examples/quickstart/jupyter-notebooks/kafka-tutorial.ipynb
@@ -4,7 +4,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "# Tutorial: Ingest and query data from Apache Kafka\n",
+    "Ingest and query data from Apache Kafka\n",
     "\n",
     "<!--\n",
     "  ~ Licensed to the Apache Software Foundation (ASF) under one\n",
@@ -50,11 +50,14 @@
    "source": [
     "## Prerequisites\n",
     "\n",
+    "This tutorial works with Druid 25.0.0 or later.\n",
+    "\n",
     "Launch this tutorial and all prerequisites using the `all-services` profile of the Docker Compose file for Jupyter-based Druid tutorials. For more information, see [Docker for Jupyter Notebook tutorials](https://druid.apache.org/docs/latest/tutorials/tutorial-jupyter-docker.html).\n",
     "\n",
-    "Otherwise, you need the following:\n",
+    "If you do not use the Docker Compose environment, you need the following:\n",
     "* A running Druid instance.\n",
     "   * Update the `druid_host` variable to point to your Router endpoint. For example, `druid_host = \"http://localhost:8888\"`.\n",
+    "   * Update the `rest_client` variable to point to your Coordinator endpoint. For example, `\"http://localhost:8081\"`.\n",
     "* A running Kafka cluster.\n",
     "   * Update the Kafka bootstrap servers to point to your servers. For example, `bootstrap_servers=[\"localhost:9092\"]`.\n",
     "* The following Python packages:\n",
@@ -132,9 +135,12 @@
     "import json\n",
     "\n",
     "# druid_host is the hostname and port for your Druid deployment. \n",
-    "# In a distributed environment, you can point to other Druid services.\n",
-    "# In this tutorial, you'll use the Router service as the `druid_host`.\n",
+    "# In the Docker Compose tutorial environment, this is the Router\n",
+    "# service running at \"http://router:8888\".\n",
+    "# If you are not using the Docker Compose environment, edit the `druid_host`.\n",
+    "\n",
     "druid_host = \"http://router:8888\"\n",
+    "druid_host\n",
     "\n",
     "druid = druidapi.jupyter_client(druid_host)\n",
     "display = druid.display\n",
@@ -769,7 +775,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.10.8"
+   "version": "3.8.16"
   },
   "vscode": {
    "interpreter": {
@@ -778,5 +784,5 @@
   }
  },
  "nbformat": 4,
- "nbformat_minor": 2
+ "nbformat_minor": 4
 }
diff --git a/examples/quickstart/jupyter-notebooks/sql-tutorial.ipynb b/examples/quickstart/jupyter-notebooks/sql-tutorial.ipynb
index 558afe0f1c..54b461f9a0 100644
--- a/examples/quickstart/jupyter-notebooks/sql-tutorial.ipynb
+++ b/examples/quickstart/jupyter-notebooks/sql-tutorial.ipynb
@@ -46,15 +46,21 @@
    "source": [
     "## Prerequisites\n",
     "\n",
-    "Make sure that you meet the requirements outlined in the README.md file of the [apache/druid repo](https://github.com/apache/druid/tree/master/examples/quickstart/jupyter-notebooks/).\n",
-    "Specifically, you need the following:\n",
-    "- Knowledge of SQL\n",
-    "- [Python3](https://www.python.org/downloads/)\n",
-    "- The [`requests` package](https://requests.readthedocs.io/en/latest/user/install/) for Python\n",
-    "- [JupyterLab](https://jupyter.org/install#jupyterlab) (recommended) or [Jupyter Notebook](https://jupyter.org/install#jupyter-notebook) running on a non-default port. Druid and Jupyter both default to port `8888`, so you need to start Jupyter on a different port. \n",
-    "- An available Druid instance. This tutorial uses the automatic single-machine configuration described in the [Druid quickstart](https://druid.apache.org/docs/latest/tutorials/index.html), so no authentication or authorization is required unless explicitly mentioned. If you haven’t already, download Druid version 25.0 or higher and start Druid services as described in the quickstart.\n",
+    "This tutorial works with Druid 25.0.0 or later.\n",
+    "\n",
+    "Launch this tutorial and all prerequisites using the `druid-jupyter` or `all-services` profiles of the Docker Compose file for Jupyter-based Druid tutorials. For more information, see [Docker for Jupyter Notebook tutorials](https://druid.apache.org/docs/latest/tutorials/tutorial-jupyter-docker.html).\n",
+    "\n",
+    "If you do not use the Docker Compose environment, you need the following:\n",
+    "\n",
+    "* A running Druid instance.<br>\n",
+    "     Update the `druid_host` variable to point to your Router endpoint. For example:\n",
+    "     ```\n",
+    "     druid_host = \"http://localhost:8888\"\n",
+    "     ```\n",
+    "* The [Druid Python API](https://github.com/apache/druid/blob/master/examples/quickstart/jupyter-notebooks/) to simplify access to Druid.\n",
+    "\n",
+    "It will also help to have a working knowledge of SQL.\n",
     "\n",
-    "This tutorial uses the [Druid Python API](Python_API_Tutorial.ipynb) to simplify access to Druid.\n",
     "\n",
     "To start the tutorial, run the following cell. It imports the required Python packages and defines a variable for the Druid client, and another for the SQL client used to run SQL commands."
    ]
@@ -71,10 +77,13 @@
     "import druidapi\n",
     "\n",
     "# druid_host is the hostname and port for your Druid deployment. \n",
-    "# In a distributed environment, you can point to other Druid services.\n",
-    "# In this tutorial, you'll use the Router service as the `druid_host`.\n",
-    "druid_host = \"http://localhost:8888\"\n",
-    "dataSourceName = \"wikipedia-sql-tutorial\"\n",
+    "# In the Docker Compose tutorial environment, this is the Router\n",
+    "# service running at \"http://router:8888\".\n",
+    "# If you are not using the Docker Compose environment, edit the `druid_host`.\n",
+    "\n",
+    "druid_host = \"http://router:8888\"\n",
+    "druid_host\n",
+    "\n",
     "\n",
     "druid = druidapi.jupyter_client(druid_host)\n",
     "display = druid.display\n",
@@ -652,7 +661,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.9.6"
+   "version": "3.8.16"
   },
   "toc-autonumbering": false,
   "toc-showcode": false,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org