Mac安装Apache Druid-0.16.0-incubating

Mac安装Apache Druid-0.16.0-incubating教程

安装

参考官网教程

brew安装

1
brew install druid

quer

下载安装

1
2
3
$ curl https://www-us.apache.org/dist/incubator/druid/0.16.0-incubating/apache-druid-0.16.0-incubating-bin.tar.gz
$ tar -xzf apache-druid-0.16.0-incubating-bin.tar.gz
$ cd apache-druid-0.16.0-incubating

配置启动

启动druid服务之前需要先启动zookeeper,下面有两种方式启动和使用zookeeper

使用集成zookeeper

1
2
3
4
$ cd $DRUID_HOME // 需要在~/.bash_profile中进行配置
$ curl https://archive.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz -o zookeeper-3.4.14.tar.gz
$ tar -xzf zookeeper-3.4.14.tar.gz
$ mv zookeeper-3.4.14 zk

使用外部zookeeper

修改 $DRUID_HOME/conf/supervise/single-server/micro-quickstart.conf 中的配置

!p10 zk bin/run-zk conf 注释掉

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ vi $DRUID_HOME/conf/supervise/single-server/micro-quickstart.conf

:verify bin/verify-java
:verify bin/verify-default-ports
:kill-timeout 10

# !p10 zk bin/run-zk conf // 这里是运行集成zookeeper的代码,所以要注释掉
coordinator-overlord bin/run-druid coordinator-overlord conf/druid/single-server/micro-quickstart
broker bin/run-druid broker conf/druid/single-server/micro-quickstart
router bin/run-druid router conf/druid/single-server/micro-quickstart
historical bin/run-druid historical conf/druid/single-server/micro-quickstart
!p90 middleManager bin/run-druid middleManager conf/druid/single-server/micro-quickstart

# Uncomment to use Tranquility Server
#!p95 tranquility-server tranquility/bin/tranquility server -configFile conf/tranquility/wikipedia-server.json -Ddruid.extensions.loadList=[]
修改 $DRUID_HOME/conf/druid/single-server/micro-quickstart/_common/common.runtime.properties 中的配置

修改zookeeper的client配置

1
2
3
4
5
6
7
$ vim $DRUID_HOME/conf/druid/single-server/micro-quickstart/_common/common.runtime.properties

# 配置外部zookeeper的信息
# zookeeper,大概在46~55行中间,对zk进行配置
# zookeeper的server运行在2181端口上
druid.zk.service.host=127.0.0.1:2181
druid.zk.paths.base=/druid
修改 $DRUID_HOME/bin/verify-default-ports 中的配置

因为使用了外部zookeeper,并且外部zookeeper的ip:port为127.0.0.1:2181
所以需要将zookeeper的2181端口删除,否则会校验本机2181端口是否被占用,因为本机zookeeper已经将其占用,则会报错,服务不能启动
如果使用的zookeeper的不在本机部署,则可以不注释2181

1
2
3
4
5
$ vi $DRUID_HOME/bin/verify-default-ports

# my @ports = (1527, 2181, 8081, 8082, 8083, 8090, 8091, 8200, 9095);

my @ports = (1527, 8081, 8082, 8083, 8090, 8091, 8200, 9095);

启动服务

1
$ ./bin/start-micro-quickstart

可以到http://localhost:8888查看是否启动成功