Apache Zeppelin 的 MongoDB 解释器
概述
MongoDB 是一个通用的、基于文档的、分布式数据库,专为现代应用程序开发者和云时代构建。
此解释器使用 mongo shell 来执行 脚本
使用 mongo-shell JavaScript 根据需要分析数据。
安装与配置
首先,你需要在同一台机器上安装带有Zeppelin的mongo shell。
如果你使用mac并安装了brew,请按照以下说明操作。
brew tap mongodb/brew
brew install mongodb/brew/mongodb-community-shell
或者你可以按照这个mongo shell的说明操作。
其次,在Zeppelin中创建mongodb解释器。
| 名称 | 默认值 | 描述 |
|---|---|---|
| mongo.shell.path | mongo | MongoDB shell本地路径。 在linux或mac上使用 which mongo获取本地路径。 |
| mongo.shell.command.table.limit | 1000 | 表格中显示的文档限制。 从mongodb获取数据时使用表格函数 |
| mongo.shell.command.timeout | 60000 | MongoDB shell命令超时时间(毫秒) |
| mongo.server.host | localhost | 要连接的MongoDB服务器主机 |
| mongo.server.port | 27017 | 要连接的MongoDB服务器端口 |
| mongo.server.database | test | MongoDB数据库名称 |
| mongo.server.authentdatabase | 用于认证的MongoDB数据库名称 | |
| mongo.server.username | 用于认证的用户名 | |
| mongo.server.password | 用于认证的密码 | |
| mongo.interpreter.concurrency.max | 10 | 调度器并发的最大数量 |
示例
以下示例演示了在Zeppelin笔记本中使用MongoDB的基本用法。
或者您可以监控mongodb集合的统计信息。
