|
| 1 | +This project provides two [OpenTSDB](http://opentsdb.net) *rpc* plugins. |
| 2 | + |
| 3 | +### The Thrift Plugin |
| 4 | + |
| 5 | +This is just a simple Thrift server that will be start when OpenTSDB starts. |
| 6 | + |
| 7 | +By default, it binds to _0.0.0.0_, which is configable var property `em.thrift.host` and listen port is `9999`, |
| 8 | + which also can be changed using property `em.thrift.port` |
| 9 | + |
| 10 | +The thrift IDL used here can be found at _src/main/thrift/metrics.thrift_ which will |
| 11 | + provided very detailed view of how to use this thrift service. |
| 12 | + |
| 13 | +As defined in the IDL, this server accepts two types of metrics data, simple text or *Tsdata* which is a predefined |
| 14 | +thrift struct. |
| 15 | + |
| 16 | +The plain text type data is just like the OpenTSDB's telent service, so one can write a thrift client and put same data |
| 17 | +that used in the telnet service, it uses same metrics syntax. |
| 18 | + |
| 19 | + |
| 20 | +### The Kafka Plugin |
| 21 | + |
| 22 | +While, this is somehow misusing the OpenTSDB's RPC mechanism, since it is not a *RPC* plugin at all. |
| 23 | + |
| 24 | +What this plugin does is simple start a kafka consumer and fetch data from kafka and then write it to OpenTSDB. |
| 25 | + |
| 26 | +This kafka consumer reads at most two topics, the purpose is same as above, one topic for the plain text type data, |
| 27 | +and the other is for the tsdata's binary data. |
| 28 | + |
| 29 | +The plain text's topic name can be configured with property `em.kafka.text.topic` and it's partition number is configured |
| 30 | +with property `em.kafka.text.topic.partition`. |
| 31 | + |
| 32 | +The tsdata's topic name is configured with property `em.kafka.tsdata.topic` and `em.kafka.tsdata.topic.partiton` |
| 33 | + |
| 34 | +Note: the topic name property has no default value, so if there is no such property provided, then this plugin will not fetch |
| 35 | +any data from kafka but just quite. |
| 36 | + |
| 37 | +The partiton property is used to caucalute the consumer thread count, by default it is the cpu cores. |
| 38 | + |
| 39 | +There are also two properties that should be defined in the configuration file: |
| 40 | + |
| 41 | +1. em.kafka.zookeeper.connect |
| 42 | + |
| 43 | + The zk host which will be used for the kafka consumer to connect to. |
| 44 | + |
| 45 | + If there is no such property, then the value of property `tsd.storage.hbase.zk_quorum` will be used. |
| 46 | + |
| 47 | +2. em.kafka.client.id |
| 48 | + |
| 49 | + The client id used to identify kafka consumer group |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +### How to build |
| 54 | + |
| 55 | + ./gradlew clean build assembleMainDist |
| 56 | + |
| 57 | +The artifact will be build and save to *build/distributions/* |
| 58 | + |
| 59 | +### Install |
| 60 | + |
| 61 | +Copy the build artifact and copy the jars to the OpenTSDB's lib dir, please note some dependencies of this project maybe already |
| 62 | +exist in the OpenTSDB's distribution, so just skip such jars and only copy non-exist ones. |
| 63 | + |
| 64 | +Then modify OpenTSDB's conf file and add properties required by this plugin, |
| 65 | +all properties can be found in the class com.easemob.tsdb.thrift.rpc.Constants |
0 commit comments