5 "druid.zk.service.host" = "zk1:2181";
6 "druid.extensions.loadList" = ''[ "druid-histogram", "druid-datasketches", "mysql-metadata-storage", "druid-avro-extensions", "druid-parquet-extensions", "druid-lookups-cached-global", "druid-hdfs-storage","druid-kafka-indexing-service","druid-basic-security","druid-kinesis-indexing-service"]'';
7 "druid.startup.logging.logProperties" = "true";
8 "druid.metadata.storage.connector.connectURI" = "jdbc:mysql://mysql:3306/druid";
9 "druid.metadata.storage.connector.user" = "druid";
10 "druid.metadata.storage.connector.password" = "druid";
11 "druid.request.logging.type" = "file";
12 "druid.request.logging.dir" = "/var/log/druid/requests";
13 "druid.javascript.enabled" = "true";
14 "druid.sql.enable" = "true";
15 "druid.metadata.storage.type" = "mysql";
16 "druid.storage.type" = "hdfs";
17 "druid.storage.storageDirectory" = "/druid-deepstore";
20 <?xml version="1.0" encoding="UTF-8" ?>
21 <Configuration status="WARN">
23 <Console name="Console" target="SYSTEM_OUT">
24 <PatternLayout pattern="%d{ISO8601} %p [%t] %c - %m%n"/>
29 <AppenderRef ref="Console"/>
34 log4j = pkgs.writeText "log4j2.xml" log4jConfig;
36 "fs.defaultFS" = "hdfs://namenode:8020";
39 default = testsForPackage {
40 druidPackage = pkgs.druid;
41 hadoopPackage = pkgs.hadoop_3_2;
46 lib.recurseIntoAttrs {
47 druidCluster = testDruidCluster args;
48 passthru.override = args': testsForPackage (args // args');
51 { druidPackage, hadoopPackage, ... }:
52 pkgs.testers.nixosTest {
58 services.zookeeper.enable = true;
59 networking.firewall.allowedTCPPorts = [ 2181 ];
65 package = hadoopPackage;
80 package = hadoopPackage;
91 virtualisation.memorySize = 1024;
93 inherit commonConfig log4j;
94 package = druidPackage;
95 extraClassPaths = [ "/etc/hadoop-conf" ];
98 "druid.indexer.task.baseTaskDir" = "/tmp/druid/persistent/task";
99 "druid.worker.capacity" = 1;
100 "druid.indexer.logs.type" = "file";
101 "druid.indexer.logs.directory" = "/var/log/druid/indexer";
102 "druid.indexer.runner.startPort" = 8100;
103 "druid.indexer.runner.endPort" = 8101;
110 gatewayRole.enable = true;
111 package = hadoopPackage;
119 inherit commonConfig log4j;
120 package = druidPackage;
121 extraClassPaths = [ "/etc/hadoop-conf" ];
124 "druid.indexer.runner.type" = "remote";
125 "druid.indexer.storage.type" = "metadata";
132 gatewayRole.enable = true;
133 package = hadoopPackage;
141 package = druidPackage;
142 inherit commonConfig log4j;
143 extraClassPaths = [ "/etc/hadoop-conf" ];
146 "druid.plaintextPort" = 8082;
147 "druid.broker.http.numConnections" = "2";
148 "druid.server.http.numThreads" = "2";
149 "druid.processing.buffer.sizeBytes" = "100";
150 "druid.processing.numThreads" = "1";
151 "druid.processing.numMergeBuffers" = "1";
152 "druid.broker.cache.unCacheable" = ''["groupBy"]'';
153 "druid.lookup.snapshotWorkingDir" = "/opt/broker/lookups";
160 gatewayRole.enable = true;
161 package = hadoopPackage;
170 package = druidPackage;
171 inherit commonConfig log4j;
172 extraClassPaths = [ "/etc/hadoop-conf" ];
175 "maxSize" = 200000000;
176 "druid.lookup.snapshotWorkingDir" = "/opt/historical/lookups";
181 "maxSize" = "100000000";
185 "maxSize" = "100000000";
193 gatewayRole.enable = true;
194 package = hadoopPackage;
203 package = druidPackage;
204 inherit commonConfig log4j;
205 extraClassPaths = [ "/etc/hadoop-conf" ];
208 "druid.plaintextPort" = 9091;
209 "druid.service" = "coordinator";
210 "druid.coordinator.startDelay" = "PT10S";
211 "druid.coordinator.period" = "PT10S";
212 "druid.manager.config.pollDuration" = "PT10S";
213 "druid.manager.segments.pollDuration" = "PT10S";
214 "druid.manager.rules.pollDuration" = "PT10S";
221 gatewayRole.enable = true;
222 package = hadoopPackage;
233 package = pkgs.mariadb;
234 initialDatabases = [ { name = "druid"; } ];
235 initialScript = pkgs.writeText "mysql-init.sql" ''
236 CREATE USER 'druid'@'%' IDENTIFIED BY 'druid';
237 GRANT ALL PRIVILEGES ON druid.* TO 'druid'@'%';
240 networking.firewall.allowedTCPPorts = [ 3306 ];
246 namenode.wait_for_unit("hdfs-namenode")
247 namenode.wait_for_unit("network.target")
248 namenode.wait_for_open_port(8020)
249 namenode.succeed("ss -tulpne | systemd-cat")
250 namenode.succeed("cat /etc/hadoop*/hdfs-site.xml | systemd-cat")
251 namenode.wait_for_open_port(9870)
252 datanode.wait_for_unit("hdfs-datanode")
253 datanode.wait_for_unit("network.target")
255 mm.succeed("mkdir -p /quickstart/")
256 mm.succeed("cp -r ${pkgs.druid}/quickstart/* /quickstart/")
257 mm.succeed("touch /quickstart/tutorial/wikiticker-2015-09-12-sampled.json")
258 mm.succeed("zcat /quickstart/tutorial/wikiticker-2015-09-12-sampled.json.gz | head -n 10 > /quickstart/tutorial/wikiticker-2015-09-12-sampled.json || true")
259 mm.succeed("rm /quickstart/tutorial/wikiticker-2015-09-12-sampled.json.gz && gzip /quickstart/tutorial/wikiticker-2015-09-12-sampled.json")
261 namenode.succeed("sudo -u hdfs hdfs dfs -mkdir /druid-deepstore")
262 namenode.succeed("HADOOP_USER_NAME=druid sudo -u hdfs hdfs dfs -chown druid:hadoop /druid-deepstore")
266 coordinator.wait_for_unit("druid-coordinator")
267 overlord.wait_for_unit("druid-overlord")
268 historical.wait_for_unit("druid-historical")
269 mm.wait_for_unit("druid-middleManager")
271 coordinator.wait_for_open_port(9091)
272 overlord.wait_for_open_port(8090)
273 historical.wait_for_open_port(8083)
274 mm.wait_for_open_port(8091)
276 broker.wait_for_unit("network.target")
277 broker.wait_for_open_port(8082)
279 broker.succeed("curl -X 'POST' -H 'Content-Type:application/json' -d @${pkgs.druid}/quickstart/tutorial/wikipedia-index.json http://coordinator:9091/druid/indexer/v1/task")
280 broker.wait_until_succeeds("curl http://coordinator:9091/druid/coordinator/v1/metadata/datasources | grep 'wikipedia'")
282 broker.wait_until_succeeds("curl http://localhost:8082/druid/v2/datasources/ | grep wikipedia")
283 broker.succeed("curl -X 'POST' -H 'Content-Type:application/json' -d @${pkgs.druid}/quickstart/tutorial/wikipedia-top-pages.json http://localhost:8082/druid/v2/")