|
| 1 | + |
| 2 | +# Introduction |
| 3 | + |
| 4 | + |
| 5 | +# Sink Connectors |
| 6 | + |
| 7 | + |
| 8 | +## RedisSinkConnector |
| 9 | + |
| 10 | +Sink connector for writing data to Redis |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +### Important |
| 15 | + |
| 16 | +This connector expects to received data with a key of bytes and a values of bytes. If your data is structured you need to use a Transformation to convert this data from structured data like a Struct to an array of bytes for the key and value. |
| 17 | + |
| 18 | +### Note |
| 19 | + |
| 20 | +This connector supports deletes. It will issue a delete to the Redis cluster for any key that does not have a corresponding value. In Kafka a record that contains a key and a null value is considered a delete. |
| 21 | + |
| 22 | + |
| 23 | +### Configuration |
| 24 | + |
| 25 | +##### `redis.hosts` |
| 26 | +*Importance:* High |
| 27 | + |
| 28 | +*Type:* List |
| 29 | + |
| 30 | +*Default Value:* [localhost:6379] |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +##### `redis.client.mode` |
| 35 | +*Importance:* Medium |
| 36 | + |
| 37 | +*Type:* String |
| 38 | + |
| 39 | +*Default Value:* Standalone |
| 40 | + |
| 41 | +*Validator:* ValidEnum{enum=ClientMode, allowed=[Standalone, Cluster]} |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +##### `redis.database` |
| 46 | +*Importance:* Medium |
| 47 | + |
| 48 | +*Type:* Int |
| 49 | + |
| 50 | +*Default Value:* 1 |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | +##### `redis.operation.timeout.ms` |
| 55 | +*Importance:* Medium |
| 56 | + |
| 57 | +*Type:* Long |
| 58 | + |
| 59 | +*Default Value:* 10000 |
| 60 | + |
| 61 | +*Validator:* [100,...] |
| 62 | + |
| 63 | + |
| 64 | +redis.operation.timeout.ms |
| 65 | +##### `redis.password` |
| 66 | +*Importance:* Medium |
| 67 | + |
| 68 | +*Type:* Password |
| 69 | + |
| 70 | +*Default Value:* [hidden] |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +##### `redis.ssl.enabled` |
| 75 | +*Importance:* Medium |
| 76 | + |
| 77 | +*Type:* Boolean |
| 78 | + |
| 79 | +*Default Value:* false |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +##### `redis.ssl.keystore.password` |
| 84 | +*Importance:* Medium |
| 85 | + |
| 86 | +*Type:* Password |
| 87 | + |
| 88 | +*Default Value:* [hidden] |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +##### `redis.ssl.keystore.path` |
| 93 | +*Importance:* Medium |
| 94 | + |
| 95 | +*Type:* String |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +##### `redis.ssl.truststore.password` |
| 100 | +*Importance:* Medium |
| 101 | + |
| 102 | +*Type:* Password |
| 103 | + |
| 104 | +*Default Value:* [hidden] |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +##### `redis.ssl.truststore.path` |
| 109 | +*Importance:* Medium |
| 110 | + |
| 111 | +*Type:* String |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | +##### `redis.auto.reconnect.enabled` |
| 116 | +*Importance:* Low |
| 117 | + |
| 118 | +*Type:* Boolean |
| 119 | + |
| 120 | +*Default Value:* true |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | +##### `redis.request.queue.size` |
| 125 | +*Importance:* Low |
| 126 | + |
| 127 | +*Type:* Int |
| 128 | + |
| 129 | +*Default Value:* 2147483647 |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | +##### `redis.socket.connect.timeout.ms` |
| 134 | +*Importance:* Low |
| 135 | + |
| 136 | +*Type:* Int |
| 137 | + |
| 138 | +*Default Value:* 10000 |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | +##### `redis.socket.keep.alive.enabled` |
| 143 | +*Importance:* Low |
| 144 | + |
| 145 | +*Type:* Boolean |
| 146 | + |
| 147 | +*Default Value:* false |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | +##### `redis.socket.tcp.no.delay.enabled` |
| 152 | +*Importance:* Low |
| 153 | + |
| 154 | +*Type:* Boolean |
| 155 | + |
| 156 | +*Default Value:* true |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | +##### `redis.ssl.provider` |
| 161 | +*Importance:* Low |
| 162 | + |
| 163 | +*Type:* String |
| 164 | + |
| 165 | +*Default Value:* JDK |
| 166 | + |
| 167 | +*Validator:* ValidEnum{enum=RedisSslProvider, allowed=[OPENSSL, JDK]} |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | +#### Examples |
| 173 | + |
| 174 | +##### Standalone Example |
| 175 | + |
| 176 | +This configuration is used typically along with [standalone mode](http://docs.confluent.io/current/connect/concepts.html#standalone-workers). |
| 177 | + |
| 178 | +```properties |
| 179 | +name=RedisSinkConnector1 |
| 180 | +connector.class=com.github.jcustenborder.kafka.connect.redis.RedisSinkConnector |
| 181 | +tasks.max=1 |
| 182 | +topics=< Required Configuration > |
| 183 | +``` |
| 184 | + |
| 185 | +##### Distributed Example |
| 186 | + |
| 187 | +This configuration is used typically along with [distributed mode](http://docs.confluent.io/current/connect/concepts.html#distributed-workers). |
| 188 | +Write the following json to `connector.json`, configure all of the required values, and use the command below to |
| 189 | +post the configuration to one the distributed connect worker(s). |
| 190 | + |
| 191 | +```json |
| 192 | +{ |
| 193 | + "config" : { |
| 194 | + "name" : "RedisSinkConnector1", |
| 195 | + "connector.class" : "com.github.jcustenborder.kafka.connect.redis.RedisSinkConnector", |
| 196 | + "tasks.max" : "1", |
| 197 | + "topics" : "< Required Configuration >" |
| 198 | + } |
| 199 | +} |
| 200 | +``` |
| 201 | + |
| 202 | +Use curl to post the configuration to one of the Kafka Connect Workers. Change `http://localhost:8083/` the the endpoint of |
| 203 | +one of your Kafka Connect worker(s). |
| 204 | + |
| 205 | +Create a new instance. |
| 206 | +```bash |
| 207 | +curl -s -X POST -H 'Content-Type: application/json' --data @connector.json http://localhost:8083/connectors |
| 208 | +``` |
| 209 | + |
| 210 | +Update an existing instance. |
| 211 | +```bash |
| 212 | +curl -s -X PUT -H 'Content-Type: application/json' --data @connector.json http://localhost:8083/connectors/TestSinkConnector1/config |
| 213 | +``` |
0 commit comments