介绍
前面几个章节对Druid的整体架构做了简单的说明,本文主要描述如何部署Druid的环境
Imply提供了一套完整的部署方式,包括依赖库,Druid,图形化的数据展示页面,SQL查询组件等。本文将基于Imply套件进行说明
单机部署
依赖
- Java 8 or better
- Node.js 4.5.x or better
- Linux, Mac OS X, or other Unix-like OS (Windows is not supported)
- At least 4GB of RAM
下载与安装
- 从https://imply.io/get-started 下载最新版本安装包
- tar -xzf imply-2.3.9.tar.gz
- cd imply-2.3.9
目录说明如下:
- bin/ - run scripts for included software.
- conf/ - template configurations for a clustered setup.
- conf-quickstart/* - configurations for the single-machine quickstart.
- dist/ - all included software.
- quickstart/ - files related to the single-machine quickstart.
启动服务
- 1
- 2
安装验证
导入测试数据
安装包中包含一些测试的数据,可以通过执行预先定义好的数据说明文件进行导入
- 1
可视化控制台
- overlord 控制页面:http://localhost:8090/console.html.
- druid集群页面:http://localhost:8081
- 数据可视化页面:http://localhost:9095
数据展示与查询
- 数据展示:对渠道进行统计的柱状图
- SQL数据查询:使用sql查询编辑次数最多的10个page
- HTTP POST数据查询
命令:curl -L -H’Content-Type: application/json’ -XPOST –data-binary @quickstart/wikiticker-top-pages.json http://localhost:8082/druid/v2?pretty
结果:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
集群部署
集群配置的规划需要根据需求来定制,下面以一个开发环境机器搭建为例,描述如何搭建一个有HA特性的Druid集群.
集群部署有以下几点需要说明
1. 为了保证HA,主节点部署两台
2. 管理节点与查询节点可以考虑多核大内存的机器
部署规划
角色 | 机器 | 配置 | 集群角色 |
---|---|---|---|
主节点 | 10.5.24.137 | 8C16G | Coordinator,Overlord |
主节点 | 10.5.24.138 | 8C16G | Coordinator,Overlord |
数据节点,查询节点 | 10.5.24.139 | 8C16G | Historical, MiddleManager, Tranquility,Broker,Pivot Web |
数据节点,查询节点 | 10.5.24.140 | 8C16G | Historical, MiddleManager, Tranquility,(数据节点,查询节点)Broker |
部署步骤
公共配置
编辑conf/druid/_common/common.runtime.properties 文件内容
1. loadList配置:==此处需要统一在一个位置统一定义,否则会出现extension加载的问题==
- 1
- Zookeeper
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- MetaData:使用Mysql
- 1
- 2
- 3
- 4
- 5
- 6
- Deepstorage:使用HDFS
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
主节点配置
- 创建配置文件:cp conf/supervise/master-no-zk.conf conf/supervise/master.conf
- 编辑master.conf 内容如下:
- 1
- 2
- 3
- 4
- 5
- 6
- 目前的版本中,mysql-metadata-storage没有包含在默认的安装包中,如果使用mysql存储元数据,需要单独安装下对应的扩展,是用下列命令在两个master节点上对需要用到的扩展进行安装:
- 1
==默认mysql-metadata-storage带的mysql驱动是针对Mysql 5.1的,如果使用Mysql的版本是5.5 或是其他版本,可能会出现”Communications link failure”的错误,此时需要更新Mysql的驱动。==
- 在10.5.24.137/138上启动master相关服务:nohup bin/supervise -c conf/supervise/master.conf > master.log &
数据节点与查询节点配置
- 安装NodeJS:apt-get install nodejs
- 创建配置文件:vim conf/supervise/data-with-query.conf
- 编辑data-with-query.conf 内容如下:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 对于集群模式,pivot的配置文件必须调整为mysql,sqllite会导致无法查看datasource,修改conf/pivot/config.xml文件
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 在10.5.24.139/140两台机器上分别执行:nohup bin/supervise -c conf/supervise/data-with-query.conf > data-with-query.log &
验证
可视化控制台
- overlord 控制页面:http://10.5.24.138:8090/console.html.
- druid集群页面:http://10.5.24.138:8081
- 数据可视化页面:http://10.5.24.139:9095