diff --git a/GettingStarted/chapter-2.md b/GettingStarted/chapter-2.md deleted file mode 100644 index 053e536..0000000 --- a/GettingStarted/chapter-2.md +++ /dev/null @@ -1,163 +0,0 @@ - - - - - -### 快速开始 - -在本快速入门教程中,我们将下载Druid并将其安装在一台服务器上,完成初始安装后,向集群中加载数据。 - -在开始快速入门之前,阅读[Druid概述](./chapter-1.md)和[数据摄取概述](../DataIngestion/index.md)会很有帮助,因为当前教程会引用这些页面上讨论的概念。 - -#### 预备条件 -##### 软件 -* **Java 8(8u92+)** -* Linux, Mac OS X, 或者其他类UNIX系统(Windows不支持) - -> [!WARNING] -> Druid服务运行依赖Java 8,可以使用环境变量`DRUID_JAVA_HOME`或`JAVA_HOME`指定在何处查找Java,有关更多详细信息,请运行`verify-java`脚本。 - -##### 硬件 - -Druid安装包提供了几个[单服务器配置](./chapter-3.md)的示例,以及使用这些配置启动Druid进程的脚本。 - -如果您正在使用便携式等小型计算机上运行服务,则配置为4CPU/16GB RAM环境的`micro-quickstart`配置是一个不错的选择。 - -如果您打算在本教程之外使用单机部署进行进一步试验评估,则建议使用比`micro-quickstart`更大的配置。 - -#### 入门开始 - -[下载](https://www.apache.org/dyn/closer.cgi?path=/druid/0.17.0/apache-druid-0.17.0-bin.tar.gz)Druid最新0.17.0release安装包 - -在终端中运行以下命令来提取Druid - -```json -tar -xzf apache-druid-0.17.0-bin.tar.gz -cd apache-druid-0.17.0 -``` - -在安装包中有以下文件: - -* `LICENSE`和`NOTICE`文件 -* `bin/*` - 启停等脚本 -* `conf/*` - 用于单节点部署和集群部署的示例配置 -* `extensions/*` - Druid核心扩展 -* `hadoop-dependencies/*` - Druid Hadoop依赖 -* `lib/*` - Druid核心库和依赖 -* `quickstart/*` - 配置文件,样例数据,以及快速入门教材的其他文件 - -#### 启动服务 - -以下命令假定您使用的是`micro-quickstart`单机配置,如果使用的是其他配置,在`bin`目录下有每一种配置对应的脚本,如`bin/start-single-server-small` - -在`apache-druid-0.17.0`安装包的根目录下执行命令: - -```json -./bin/start-micro-quickstart -``` -然后将在本地计算机上启动Zookeeper和Druid服务实例,例如: - -```json -$ ./bin/start-micro-quickstart -[Fri May 3 11:40:50 2019] Running command[zk], logging to[/apache-druid-0.17.0/var/sv/zk.log]: bin/run-zk conf -[Fri May 3 11:40:50 2019] Running command[coordinator-overlord], logging to[/apache-druid-0.17.0/var/sv/coordinator-overlord.log]: bin/run-druid coordinator-overlord conf/druid/single-server/micro-quickstart -[Fri May 3 11:40:50 2019] Running command[broker], logging to[/apache-druid-0.17.0/var/sv/broker.log]: bin/run-druid broker conf/druid/single-server/micro-quickstart -[Fri May 3 11:40:50 2019] Running command[router], logging to[/apache-druid-0.17.0/var/sv/router.log]: bin/run-druid router conf/druid/single-server/micro-quickstart -[Fri May 3 11:40:50 2019] Running command[historical], logging to[/apache-druid-0.17.0/var/sv/historical.log]: bin/run-druid historical conf/druid/single-server/micro-quickstart -[Fri May 3 11:40:50 2019] Running command[middleManager], logging to[/apache-druid-0.17.0/var/sv/middleManager.log]: bin/run-druid middleManager conf/druid/single-server/micro-quickstart -``` - -所有的状态(例如集群元数据存储和服务的segment文件)将保留在`apache-druid-0.17.0`软件包根目录下的`var`目录中, 服务的日志位于 `var/sv`。 - -稍后,如果您想停止服务,请按`CTRL-C`退出`bin/start-micro-quickstart`脚本,该脚本将终止Druid进程。 - -集群启动后,可以访问[http://localhost:8888](http://localhost:8888)来Druid控制台,控制台由Druid Router进程启动。 - -![tutorial-quickstart](img/tutorial-quickstart-01.png) - -所有Druid进程完全启动需要花费几秒钟。 如果在启动服务后立即打开控制台,则可能会看到一些可以安全忽略的错误。 - -#### 加载数据 -##### 教程使用的数据集 - -对于以下数据加载教程,我们提供了一个示例数据文件,其中包含2015年9月12日发生的Wikipedia页面编辑事件。 - -该样本数据位于Druid包根目录的`quickstart/tutorial/wikiticker-2015-09-12-sampled.json.gz`中,页面编辑事件作为JSON对象存储在文本文件中。 - -示例数据包含以下几列,示例事件如下所示: - -* added -* channel -* cityName -* comment -* countryIsoCode -* countryName -* deleted -* delta -* isAnonymous -* isMinor -* isNew -* isRobot -* isUnpatrolled -* metroCode -* namespace -* page -* regionIsoCode -* regionName -* user - -```json -{ - "timestamp":"2015-09-12T20:03:45.018Z", - "channel":"#en.wikipedia", - "namespace":"Main", - "page":"Spider-Man's powers and equipment", - "user":"foobar", - "comment":"/* Artificial web-shooters */", - "cityName":"New York", - "regionName":"New York", - "regionIsoCode":"NY", - "countryName":"United States", - "countryIsoCode":"US", - "isAnonymous":false, - "isNew":false, - "isMinor":false, - "isRobot":false, - "isUnpatrolled":false, - "added":99, - "delta":99, - "deleted":0, -} -``` - -##### 数据加载 - -以下教程演示了将数据加载到Druid的各种方法,包括批处理和流处理用例。 所有教程均假定您使用的是上面提到的`micro-quickstart`单机配置。 - -* [加载本地文件](../Tutorials/chapter-1.md) - 本教程演示了如何使用Druid的本地批处理摄取来执行批文件加载 -* [从Kafka加载流数据](../Tutorials/chapter-2.md) - 本教程演示了如何从Kafka主题加载流数据 -* [从Hadoop加载数据](../Tutorials/chapter-3.md) - 本教程演示了如何使用远程Hadoop集群执行批处理文件加载 -* [编写一个自己的数据摄取规范](../Tutorials/chapter-10.md) - 本教程演示了如何编写新的数据摄取规范并使用它来加载数据 - -##### 重置集群状态 - -如果要在清理服务后重新启动,请删除`var`目录,然后再次运行`bin/start-micro-quickstart`脚本。 - -一旦每个服务都启动,您就可以加载数据了。 - -##### 重置Kafka - -如果您完成了[教程:从Kafka加载流数据](../Tutorials/chapter-2.md)并希望重置集群状态,则还应该清除所有Kafka状态。 - -在停止ZooKeeper和Druid服务之前,使用`CTRL-C`关闭`Kafka Broker`,然后删除`/tmp/kafka-logs`中的Kafka日志目录: - -``` -rm -rf /tmp/kafka-logs -``` diff --git a/tutorials/index.md b/tutorials/index.md index 5c8bdd4..7a87dc8 100644 --- a/tutorials/index.md +++ b/tutorials/index.md @@ -1,65 +1,40 @@ ---- -id: index -title: "Quickstart" ---- +# 快速开始 - +在本快速开始的内容部分,将向你介绍有关如何开始使用 Apache Druid 和一些相关的基本特性。 +当你按照给出的步骤完成操作后,你将能够安装并且运行 Druid 和使用自带的批量数据摄取(ingestion)特性向安装成功的 Druid 实例中导入数据。 + +在开始我们下面的步骤之前,请先阅读 [Druid 概述](../design/index.md) 和 [数据摄取(ingestion)概述](../ingestion/index.md) 中的内容。 +因为下面使用的步骤将会参照在前面 2 个 页面中提到过的一些概念和定义。 + +## 安装要求 + +你可以按照后续的步骤在一个相对机器性能比较小的计算机上进行安装。例如我们说的笔记本电脑(4 CPU 和 16 GB 的内存)。 + +针对不同的机器性能和安装条件,Druid 有一系列的安装配置属性。例如, `micro-quickstart` 配置属性对需要进行 Druid 评估时候的计算机性能进行了配置。 +如果你希望对 Druid 的计算性能进行评估或者对计算能力进行调整的话,你可能需要更大和更好性能的计算机并且配置属性(profile)。 + +Druid 配置属性包括有从 _Nano-Quickstart_ 配置 (1 CPU, 4GB RAM) 到 _X-Large_ 配置(64 CPU, 512GB RAM)。 + +有关更多的配置信息,请参考 [独立服务器部署](../operations/single-server.md) 页面中的内容 +另外,如果你希望对 Druid 进行集群部署的话,请参考 [集群服务器部署](./cluster.md) 页面中的内容来了解更多有关 Druid 集群部署中的配置。 + +针对运行 Druid 的计算机,你需要完成下面的软件配置: + +* Linux, Mac OS X, 或者其他基于 Unix 的操作系统(**不能部署在 Windows 上**) +* Java 8, Update 92 或者后续版本 (8u92+) + +> Druid 官方只支持 Java 8 only。对其他主要的 Java 版本进行支持目前还主要是实验性的。 + +> Druid 通过计算机中的环境变量 `JAVA_HOME` 或者 `DRUID_JAVA_HOME` 来找到安装的 Java 版本。如果你的计算机中安装有多个版本的 Java,那么你可以通过 +> 设置环境变量 `DRUID_JAVA_HOME` 来让你安装的 Druid 实例找到相应的 Java 版本。 +> 可以运行 Druid 程序中的 `bin/verify-java` 脚本来查看当前运行的 Java 版本。 + +在将 Druid 安装到生产环境的时候,你需要注意 Druid 实例运行的用户账号是什么。因为 Druid 控制台用户的权限和当前 Druid 实例运行的用户权限是相同的。 +例如,如果你使用 Druid 的控制台对文件进行浏览的话,那么操作系统通只显示这个用户能够访问到的文件,或者说有权限进行查看的文件进行显示。 +一般来说,我们是不希望 Druid 以 root 用户的权限来运行的。因此针对 Druid 的安装环境,可以考虑针对 Druid 实例,在操作系统中创建一个只供 Druid 运行的用户。 -This quickstart gets you started with Apache Druid and introduces you to some of its basic features. -Following these steps, you will install Druid and load sample -data using its native batch ingestion feature. - -Before starting, you may want to read the [general Druid overview](../design/index.md) and -[ingestion overview](../ingestion/index.md), as the tutorials refer to concepts discussed on those pages. - -## Requirements - -You can follow these steps on a relatively small machine, such as a laptop with around 4 CPU and 16 GB of RAM. - -Druid comes with several startup configuration profiles for a range of machine sizes. -The `micro-quickstart`configuration profile shown here is suitable for evaluating Druid. If you want to -try out Druid's performance or scaling capabilities, you'll need a larger machine and configuration profile. - -The configuration profiles included with Druid range from the even smaller _Nano-Quickstart_ configuration (1 CPU, 4GB RAM) -to the _X-Large_ configuration (64 CPU, 512GB RAM). For more information, see -[Single server deployment](../operations/single-server.md). Alternatively, see [Clustered deployment](./cluster.md) for -information on deploying Druid services across clustered machines. - -The software requirements for the installation machine are: - -* Linux, Mac OS X, or other Unix-like OS (Windows is not supported) -* Java 8, Update 92 or later (8u92+) - -> Druid officially supports Java 8 only. Support for later major versions of Java is currently in experimental status. - -> Druid relies on the environment variables `JAVA_HOME` or `DRUID_JAVA_HOME` to find Java on the machine. You can set -`DRUID_JAVA_HOME` if there is more than one instance of Java. To verify Java requirements for your environment, run the -`bin/verify-java` script. - -Before installing a production Druid instance, be sure to consider the user account on the operating system under -which Druid will run. This is important because any Druid console user will have, effectively, the same permissions as -that user. So, for example, the file browser UI will show console users the files that the underlying user can -access. In general, avoid running Druid as root user. Consider creating a dedicated user account for running Druid. - -## Step 1. Install Druid +## 第 1 步:安装 Druid After confirming the [requirements](#requirements), follow these steps: @@ -73,7 +48,7 @@ the [{{DRUIDVERSION}} release](https://www.apache.org/dyn/closer.cgi?path=/druid ``` In the directory, you'll find `LICENSE` and `NOTICE` files and subdirectories for executable files, configuration files, sample data and more. -## Step 2: Start up Druid services +## 第 2 步:启动 Druid 服务 Start up Druid services using the `micro-quickstart` single-machine configuration. @@ -105,7 +80,7 @@ To stop Druid at any time, use CTRL-C in the terminal. This exits the `bin/start terminates all Druid processes. -## Step 3. Open the Druid console +## 第 3 步:访问 Druid 控制台 After the Druid services finish startup, open the [Druid console](../operations/druid-console.md) at [http://localhost:8888](http://localhost:8888). @@ -114,7 +89,7 @@ After the Druid services finish startup, open the [Druid console](../operations/ It may take a few seconds for all Druid services to finish starting, including the [Druid router](../design/router.md), which serves the console. If you attempt to open the Druid console before startup is complete, you may see errors in the browser. Wait a few moments and try again. -## Step 4. Load data +## 第 4 步:导入数据 Ingestion specs define the schema of the data Druid reads and stores. You can write ingestion specs by hand or using the _data loader_, @@ -224,7 +199,7 @@ in the Druid root directory represents Wikipedia page edits for a given day. A successful task means that one or more segments have been built and are now picked up by our data servers. -## Step 5. Query the data +## 第 5 步:查询数据 You can now see the data as a datasource in the console and try out a query, as follows: @@ -248,7 +223,7 @@ Congratulations! You've gone from downloading Druid to querying data in just one section for what to do next. -## Next steps +## 下一步 After finishing the quickstart, check out the [query tutorial](../tutorials/tutorial-query.md) to further explore Query features in the Druid console. @@ -265,4 +240,140 @@ running the `bin/start-micro-quickstart` script again. You will likely want to d since in them you will create the same wikipedia datasource. +##### 硬件 +Druid安装包提供了几个[单服务器配置](./chapter-3.md)的示例,以及使用这些配置启动Druid进程的脚本。 + +如果您正在使用便携式等小型计算机上运行服务,则配置为4CPU/16GB RAM环境的`micro-quickstart`配置是一个不错的选择。 + +如果您打算在本教程之外使用单机部署进行进一步试验评估,则建议使用比`micro-quickstart`更大的配置。 + +#### 入门开始 + +[下载](https://www.apache.org/dyn/closer.cgi?path=/druid/0.17.0/apache-druid-0.17.0-bin.tar.gz)Druid最新0.17.0release安装包 + +在终端中运行以下命令来提取Druid + +```json +tar -xzf apache-druid-0.17.0-bin.tar.gz +cd apache-druid-0.17.0 +``` + +在安装包中有以下文件: + +* `LICENSE`和`NOTICE`文件 +* `bin/*` - 启停等脚本 +* `conf/*` - 用于单节点部署和集群部署的示例配置 +* `extensions/*` - Druid核心扩展 +* `hadoop-dependencies/*` - Druid Hadoop依赖 +* `lib/*` - Druid核心库和依赖 +* `quickstart/*` - 配置文件,样例数据,以及快速入门教材的其他文件 + +#### 启动服务 + +以下命令假定您使用的是`micro-quickstart`单机配置,如果使用的是其他配置,在`bin`目录下有每一种配置对应的脚本,如`bin/start-single-server-small` + +在`apache-druid-0.17.0`安装包的根目录下执行命令: + +```json +./bin/start-micro-quickstart +``` +然后将在本地计算机上启动Zookeeper和Druid服务实例,例如: + +```json +$ ./bin/start-micro-quickstart +[Fri May 3 11:40:50 2019] Running command[zk], logging to[/apache-druid-0.17.0/var/sv/zk.log]: bin/run-zk conf +[Fri May 3 11:40:50 2019] Running command[coordinator-overlord], logging to[/apache-druid-0.17.0/var/sv/coordinator-overlord.log]: bin/run-druid coordinator-overlord conf/druid/single-server/micro-quickstart +[Fri May 3 11:40:50 2019] Running command[broker], logging to[/apache-druid-0.17.0/var/sv/broker.log]: bin/run-druid broker conf/druid/single-server/micro-quickstart +[Fri May 3 11:40:50 2019] Running command[router], logging to[/apache-druid-0.17.0/var/sv/router.log]: bin/run-druid router conf/druid/single-server/micro-quickstart +[Fri May 3 11:40:50 2019] Running command[historical], logging to[/apache-druid-0.17.0/var/sv/historical.log]: bin/run-druid historical conf/druid/single-server/micro-quickstart +[Fri May 3 11:40:50 2019] Running command[middleManager], logging to[/apache-druid-0.17.0/var/sv/middleManager.log]: bin/run-druid middleManager conf/druid/single-server/micro-quickstart +``` + +所有的状态(例如集群元数据存储和服务的segment文件)将保留在`apache-druid-0.17.0`软件包根目录下的`var`目录中, 服务的日志位于 `var/sv`。 + +稍后,如果您想停止服务,请按`CTRL-C`退出`bin/start-micro-quickstart`脚本,该脚本将终止Druid进程。 + +集群启动后,可以访问[http://localhost:8888](http://localhost:8888)来Druid控制台,控制台由Druid Router进程启动。 + +![tutorial-quickstart](img/tutorial-quickstart-01.png) + +所有Druid进程完全启动需要花费几秒钟。 如果在启动服务后立即打开控制台,则可能会看到一些可以安全忽略的错误。 + +#### 加载数据 +##### 教程使用的数据集 + +对于以下数据加载教程,我们提供了一个示例数据文件,其中包含2015年9月12日发生的Wikipedia页面编辑事件。 + +该样本数据位于Druid包根目录的`quickstart/tutorial/wikiticker-2015-09-12-sampled.json.gz`中,页面编辑事件作为JSON对象存储在文本文件中。 + +示例数据包含以下几列,示例事件如下所示: + +* added +* channel +* cityName +* comment +* countryIsoCode +* countryName +* deleted +* delta +* isAnonymous +* isMinor +* isNew +* isRobot +* isUnpatrolled +* metroCode +* namespace +* page +* regionIsoCode +* regionName +* user + +```json +{ + "timestamp":"2015-09-12T20:03:45.018Z", + "channel":"#en.wikipedia", + "namespace":"Main", + "page":"Spider-Man's powers and equipment", + "user":"foobar", + "comment":"/* Artificial web-shooters */", + "cityName":"New York", + "regionName":"New York", + "regionIsoCode":"NY", + "countryName":"United States", + "countryIsoCode":"US", + "isAnonymous":false, + "isNew":false, + "isMinor":false, + "isRobot":false, + "isUnpatrolled":false, + "added":99, + "delta":99, + "deleted":0, +} +``` + +##### 数据加载 + +以下教程演示了将数据加载到Druid的各种方法,包括批处理和流处理用例。 所有教程均假定您使用的是上面提到的`micro-quickstart`单机配置。 + +* [加载本地文件](../Tutorials/chapter-1.md) - 本教程演示了如何使用Druid的本地批处理摄取来执行批文件加载 +* [从Kafka加载流数据](../Tutorials/chapter-2.md) - 本教程演示了如何从Kafka主题加载流数据 +* [从Hadoop加载数据](../Tutorials/chapter-3.md) - 本教程演示了如何使用远程Hadoop集群执行批处理文件加载 +* [编写一个自己的数据摄取规范](../Tutorials/chapter-10.md) - 本教程演示了如何编写新的数据摄取规范并使用它来加载数据 + +##### 重置集群状态 + +如果要在清理服务后重新启动,请删除`var`目录,然后再次运行`bin/start-micro-quickstart`脚本。 + +一旦每个服务都启动,您就可以加载数据了。 + +##### 重置Kafka + +如果您完成了[教程:从Kafka加载流数据](../Tutorials/chapter-2.md)并希望重置集群状态,则还应该清除所有Kafka状态。 + +在停止ZooKeeper和Druid服务之前,使用`CTRL-C`关闭`Kafka Broker`,然后删除`/tmp/kafka-logs`中的Kafka日志目录: + +``` +rm -rf /tmp/kafka-logs +```