Druid集群配置

Druid集群配置

原创  2016年11月18日 15:19:19
  • 3717

一、默认端口



二、集群配置思想

(一)本集群有五个节点(master, slave1,slave2,slave3,slave4),节点安排情况如下:

master节点:Mysql server, coordinator node, overlord node 

slave1节点:   historical node, middleManager node

slave2节点:   historical node, middleManager node

slave3节点:   broker node 

slave4节点:   realtime node(没有配置,空着)


(二)配置deep storage(保存冷数据)为HDFS


三、集群配置

(一)配置所有节点(master, slave1,slave2,slave3,slave4)的_common/common.runtime.properties文件

[java]  view plain  copy
  1. #  
  2. # Licensed to Metamarkets Group Inc. (Metamarkets) under one  
  3. # or more contributor license agreements. See the NOTICE file  
  4. # distributed with this work for additional information  
  5. # regarding copyright ownership. Metamarkets licenses this file  
  6. # to you under the Apache License, Version 2.0 (the  
  7. "License"); you may not use this file except in compliance  
  8. # with the License. You may obtain a copy of the License at  
  9. #  
  10. # http://www.apache.org/licenses/LICENSE-2.0  
  11. #  
  12. # Unless required by applicable law or agreed to in writing,  
  13. # software distributed under the License is distributed on an  
  14. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY  
  15. # KIND, either express or implied. See the License for the  
  16. # specific language governing permissions and limitations  
  17. # under the License.  
  18. #  
  19.   
  20. #  
  21. # Extensions  
  22. #  
  23.   
  24. # This is not the full list of Druid extensions, but common ones that people often use. You may need to change this list  
  25. # based on your particular setup.  
  26. #  
  27. # Licensed to Metamarkets Group Inc. (Metamarkets) under one  
  28. # or more contributor license agreements. See the NOTICE file  
  29. # distributed with this work for additional information  
  30. # regarding copyright ownership. Metamarkets licenses this file  
  31. # to you under the Apache License, Version 2.0 (the  
  32. "License"); you may not use this file except in compliance  
  33. # with the License. You may obtain a copy of the License at  
  34. #  
  35. # http://www.apache.org/licenses/LICENSE-2.0  
  36. #  
  37. # Unless required by applicable law or agreed to in writing,  
  38. # software distributed under the License is distributed on an  
  39. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY  
  40. # KIND, either express or implied. See the License for the  
  41. # specific language governing permissions and limitations  
  42. # under the License.  
  43. #  
  44.   
  45. #  
  46. # Extensions  
  47. #  
  48.   
  49. # This is not the full list of Druid extensions, but common ones that people often use. You may need to change this list  
  50. # based on your particular setup.  
  51. druid.extensions.loadList=["mysql-metadata-storage","druid-hdfs-storage"]  
  52.   
  53.   
  54. # If you have a different version of Hadoop, place your Hadoop client jar files in your hadoop-dependencies directory  
  55. # and uncomment the line below to point to your directory.  
  56. #druid.extensions.hadoopDependenciesDir=/my/dir/hadoop-dependencies  
  57.   
  58. #  
  59. # Logging  
  60. #  
  61.   
  62. # Log all runtime properties on startup. Disable to avoid logging properties on startup:  
  63. druid.startup.logging.logProperties=true  
  64.   
  65. #  
  66. # Zookeeper  
  67. #  
  68.   
  69. druid.zk.service.host=master:2181,slave1:2181,slave2:2181,slave3:2181,slave4:2181  
  70. #druid.zk.service.host=master:2181  
  71. druid.zk.paths.base=/druid  
  72.   
  73. #  
  74. # Metadata storage  
  75. #  
  76.   
  77. # For Derby server on your Druid Coordinator (only viable in a cluster with a single Coordinator, no fail-over):  
  78. #druid.metadata.storage.type=derby  
  79. #druid.metadata.storage.connector.connectURI=jdbc:derby://metadata.store.ip:1527/var/druid/metadata.db;create=true  
  80. #druid.metadata.storage.connector.host=metadata.store.ip  
  81. #druid.metadata.storage.connector.port=1527  
  82.   
  83. # For MySQL:  
  84. druid.metadata.storage.type=mysql  
  85. druid.metadata.storage.connector.connectURI=jdbc:mysql://localhost:3306/druid?characterEncoding=UTF-8  
  86. druid.metadata.storage.connector.user=***  
  87. druid.metadata.storage.connector.password=***  
  88.   
  89. # For PostgreSQL (make sure to additionally include the Postgres extension):  
  90. #druid.metadata.storage.type=postgresql  
  91. #druid.metadata.storage.connector.connectURI=jdbc:postgresql://db.example.com:5432/druid  
  92. #druid.metadata.storage.connector.user=...  
  93. #druid.metadata.storage.connector.password=...  
  94.   
  95. #  
  96. # Deep storage  
  97. #  
  98.   
  99. # For local disk (only viable in a cluster if this is a network mount):  
  100. #druid.storage.type=local  
  101. #druid.storage.storageDirectory=var/druid/segments  
  102.   
  103. # For HDFS (make sure to include the HDFS extension and that your Hadoop config files in the cp):  
  104. druid.storage.type=hdfs  
  105. druid.storage.storageDirectory=hdfs://master:9000/druid/segments  
  106.   
  107. # For S3:  
  108. #druid.storage.type=s3  
  109. #druid.storage.bucket=your-bucket  
  110. #druid.storage.baseKey=druid/segments  
  111. #druid.s3.accessKey=...  
  112. #druid.s3.secretKey=...  
  113.   
  114. #  
  115. # Indexing service logs  
  116. #  
  117.   
  118. # For local disk (only viable in a cluster if this is a network mount):  
  119. #druid.indexer.logs.type=file  
  120. #druid.indexer.logs.directory=var/druid/indexing-logs  
  121.   
  122. # For HDFS (make sure to include the HDFS extension and that your Hadoop config files in the cp):  
  123. druid.indexer.logs.type=hdfs  
  124. druid.indexer.logs.directory=hdfs://master:9000/druid/indexing-logs  
  125.   
  126. # For S3:  
  127. #druid.indexer.logs.type=s3  
  128. #druid.indexer.logs.s3Bucket=your-bucket  
  129. #druid.indexer.logs.s3Prefix=druid/indexing-logs  
  130.   
  131. #  
  132. # Service discovery  
  133. #  
  134.   
  135. druid.selectors.indexing.serviceName=druid/overlord  
  136. druid.selectors.coordinator.serviceName=druid/coordinator  
  137.   
  138. #  
  139. # Monitoring  
  140. #  
  141.   
  142. druid.monitoring.monitors=["com.metamx.metrics.JvmMonitor"]  
  143. druid.emitter=logging  
  144. druid.emitter.logging.logLevel=info  

(二)配置master节点的coordinator(在coordinator/runtime.properties文件里) 

[java]  view plain  copy
  1. druid.service=druid/coordinator  
  2. druid.port=8081  
  3.   
  4. druid.coordinator.startDelay=PT30S  
  5. druid.coordinator.period=PT30S  
  6.   
  7. #Below it's append by fenghui for test  
  8. druid.host=master  



      配置master节点的 overlord(在overlord/runtime.properties文件里) 

[java]  view plain  copy
  1. druid.service=druid/overlord  
  2. druid.port=8090  
  3.   
  4. #druid.indexer.queue.startDelay=PT30S  
  5.   
  6. druid.indexer.runner.type=remote  
  7. druid.indexer.storage.type=metadata  
  8.   
  9. #below it is append by fenghui for test!  
  10. druid.host=master  
  11.   
  12. #druid.indexer.logs.type=hdfs  
  13. #druid.indexer.logs.directory=/druid/indexing-logs  

(三)配置slave1节点的historical (在historical /runtime.properties文件里) 

[java]  view plain  copy
  1. druid.service=druid/historical  
  2. druid.port=8083  
  3.   
  4. # HTTP server threads  
  5. druid.server.http.numThreads=25  
  6.   
  7. # Processing threads and buffers  
  8. druid.processing.buffer.sizeBytes=6870912  
  9. druid.processing.numThreads=7  
  10.   
  11. # Segment storage  
  12. druid.segmentCache.locations=[{"path":"var/druid/segment-cache","maxSize"\:130000000000}]  
  13. druid.server.maxSize=130000000000  
  14.   
  15.   
  16.   
  17. druid.host=slave1  
  18.   
  19.   
  20. druid.historical.cache.useCache=false  
  21. druid.historical.cache.populateCache=false  


    配置slave1节点的middleManager (在middleManager /runtime.properties文件里) 

[java]  view plain  copy
  1. druid.service=druid/middleManager  
  2. druid.port=8091  
  3.   
  4. # Number of tasks per middleManager  
  5. druid.worker.capacity=3  
  6.   
  7. # Task launch parameters  
  8. druid.indexer.runner.javaOpts=-server -Xmx256m -Duser.timezone=UTC -Dfile.encoding=UTF-8 -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager  
  9. druid.indexer.task.baseTaskDir=var/druid/task  
  10.   
  11. # HTTP server threads  
  12. druid.server.http.numThreads=25  
  13.   
  14. # Processing threads and buffers  
  15. druid.processing.buffer.sizeBytes=65536  
  16. druid.processing.numThreads=2  
  17.   
  18. # Hadoop indexing  
  19. druid.indexer.task.hadoopWorkingPath=var/druid/hadoop-tmp  
  20. druid.indexer.task.defaultHadoopCoordinates=["org.apache.hadoop:hadoop-client:2.3.0"]  
  21.   
  22.   
  23.   
  24. #below it's append by fenghui for test  
  25. druid.host=slave1  
  26.   
  27. #druid.indexer.logs.type=hdfs  
  28. #druid.indexer.logs.directory=/druid/indexing-logs  

(四)配置slave2节点(同slave1节点)


(五)配置slave1节点的broker(broker/runtime.properties文件里) 

[java]  view plain  copy
  1. druid.service=druid/broker  
  2. druid.port=8082  
  3.   
  4. # HTTP server threads  
  5. druid.broker.http.numConnections=5  
  6. druid.server.http.numThreads=25  
  7.   
  8. # Processing threads and buffers  
  9. druid.processing.buffer.sizeBytes=32768  
  10. druid.processing.numThreads=2  
  11.   
  12. # Query cache  
  13. druid.broker.cache.useCache=true  
  14. druid.broker.cache.populateCache=true  
  15. druid.cache.type=local  
  16. druid.cache.sizeInBytes=2000000000  
  17.   
  18. druid.host=slave3  


三、启动集群命令

    分别到每个节点master, slave1,slave2,slave3,slave4)去启动相应的服务,命令如下(下面是启动broker的命令):     java -Xmx256m -Duser.timezone=UTC -Dfile.encoding=UTF-8 -classpath conf/druid/_common:conf/druid/broker:lib/* io.druid.cli.Main server broker &


四、验证集群

(一)打开web端

http://master:8090/console.html



http://master:8081/#/




(二)下载测试文件,把文件解压到每个节点(master, slave1,slave2,slave3,slave4)的druid-0.9.1.1目录下,然后再file目录下执行 bash submit_task.sh命令,可以在http://master:8090/console.html下查看状态

    在file目录下执行bash query_task.sh命令





参考文件:

druid.io_druid.io本地集群搭建 / 扩展集群搭建

http://druid.io/docs/latest/tutorials/cluster.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Druid是一个高性能、分布式的列存储数据库,它支持快速查询和聚合操作,并且能够处理PB级别的数据。 以下是Druid的基本配置和使用步骤: 1. 下载Druid 首先需要下载和安装Druid,可以从官方网站(http://druid.apache.org/)下载最新版本。 2. 配置Zookeeper Druid使用Zookeeper来协调集群节点之间的状态,因此需要先配置Zookeeper。可以从Zookeeper的官方网站(https://zookeeper.apache.org/)下载最新版本,并按照官方文档进行配置。 3. 配置Druid服务 需要创建一个Druid服务,以便在其中运行Druid进程。可以使用默认的配置文件,也可以根据需要进行自定义。配置文件通常位于`conf/druid/single-server/middlemanager/runtime.properties`。 4. 启动Druid服务 启动Druid服务需要在命令行中输入以下命令: ``` java -Xmx256m -Duser.timezone=UTC -Dfile.encoding=UTF-8 -classpath "config/_common:config/realtime:lib/*" io.druid.cli.Main server middleManager ``` 其中`middleManager`是Druid服务的名称,可以根据需要进行更改。 5. 使用DruidDruid服务启动后,可以使用Druid的API或者控制台来进行查询和管理操作。可以使用以下命令启动控制台: ``` java -classpath "config/_common:config/middlemanager:lib/*" io.druid.cli.Main server middleManager ``` 然后在浏览器中打开`http://localhost:8081`即可访问Druid的控制台。 以上是Druid的基本配置和使用步骤,具体操作可以参考官方文档。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值