-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to simplify configuration. Moved to CloudSolrSinkConnector i…
…nstead of specifying which DocumentHandler to use.
- Loading branch information
1 parent
58a6486
commit c842233
Showing
22 changed files
with
104 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,54 @@ | ||
|
||
Currently the CloudSolr configuration is the only thing that has been tested. | ||
|
||
|
||
# Topic Configuration | ||
|
||
| Name | Description | Type | Default | Importance | | ||
|------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|---------|----------------------------------------------------------------|------------| | ||
| <solr config instance>.topic | Kafka topic to map to | string | | High | | ||
| <solr config instance>.solr.input.document.converter.class | Factory class used to get the SolrInputDocumentConverter implementation. | class | io.confluent.connect.solr.sink.solr.SolrInputDocumentConverter | High | | ||
| <solr config instance>.commit.within | Configures Solr UpdaterRequest for a commit within the requested number of milliseconds. | int | null | Low | | ||
| <solr config instance>.column.ignore.unknown.fields | Flag to determine if the connector should raise an exception when it encountered a field it doesn't have configured. | boolean | false | Low | | ||
|
||
|
||
# Field Configuration | ||
|
||
Field configuration is driven by a mapping from the source Kafka Connect schema to the SOLR schema. In the table below <connect field name> is replaced with the field name of the connect schema. | ||
|
||
| Name | Description | Type | Default | Importance | | ||
|----------------------------------------------------------------------|---------------------------------------------------|--------|---------|------------| | ||
| <solr config instance>.column.mappings.<connect field name>.field | Name of the field in the solr schema. | string | | High | | ||
| <solr config instance>.column.mappings.<connect field name>.currency | Currency code to use when writing data for field. | string | null | Low | | ||
|
||
# CloudSolr Configuration | ||
|
||
|
||
# CloudSolr Configuration | ||
|
||
CloudSolr can be configured by using `io.confluent.connect.solr.sink.solr.CloudSolrInputDocumentHandlerFactory`. | ||
## Topic Configuration | ||
|
||
``` | ||
solr.input.document.handler.class=io.confluent.connect.solr.sink.solr.CloudSolrInputDocumentHandlerFactory | ||
``` | ||
Multiple topics can be managed by a single connector. This is configured per topic by prefixing a `<solr config instance>`. For example the configuration below uses `solr0` for the first topic, `solr1` for the second, etc. | ||
|
||
The following configuration items are specific to the CloudSolr implementation. | ||
| Name | Description | Type | Default | Importance | | ||
|--------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|---------|----------------------------------------------------------------|------------| | ||
| `<solr config instance>`.topic | Kafka topic to map to | string | | High | | ||
| `<solr config instance>`.collection.name | Solr collection to write the data to | string | | High | | ||
| `<solr config instance>`.solr.input.document.converter.class | Factory class used to get the SolrInputDocumentConverter implementation. | class | io.confluent.connect.solr.sink.SolrInputDocumentConverter | High | | ||
| `<solr config instance>`.commit.within | Configures Solr UpdaterRequest for a commit within the requested number of milliseconds. | int | null | Low | | ||
| `<solr config instance>`.column.ignore.unknown.fields | Flag to determine if the connector should raise an exception when it encountered a field it doesn't have configured. | boolean | false | Low | | ||
|
||
| Name | Description | Type | Default | Importance | | ||
|-----------------------|------------------------------------------------------------|--------|---------|------------| | ||
| solr.zookeeper.hosts | Zookeeper hosts that are used to store solr configuration. | string | | High | | ||
| solr.zookeeper.chroot | Chroot within solr for the zookeeper configuration. | string | null | High | | ||
## Field Configuration | ||
|
||
Field configuration is driven by a mapping from the source Kafka Connect schema to the SOLR schema. In the table below `<connect field name>` is replaced with the field name of the connect schema. | ||
|
||
| Name | Description | Type | Default | Importance | | ||
|--------------------------------------------------------------------------|---------------------------------------------------|--------|---------|------------| | ||
| `<solr config instance>`.column.mappings.`<connect field name>`.field | Name of the field in the solr schema. | string | | High | | ||
| `<solr config instance>`.column.mappings.`<connect field name>`.currency | Currency code to use when writing data for field. | string | null | Low | | ||
|
||
## Complete Example | ||
|
||
The follow example we are pulling from the Kafka topic `twitter` and writing to the SOLR collection `twitter` using 2 tasks. | ||
|
||
``` | ||
name=solrcloud | ||
topics=twitter | ||
tasks.max=2 | ||
connector.class=io.confluent.connect.solr.sink.SolrSinkConnector | ||
solr.input.document.handler.class=io.confluent.connect.solr.sink.solr.CloudSolrInputDocumentHandlerFactory | ||
connector.class=io.confluent.connect.solr.sink.CloudSolrSinkConnector | ||
solr.zookeeper.hosts=192.168.99.100:2181 | ||
solr0.topic=twitter | ||
solr0.collection.name=twitter | ||
solr0.commit.within=1000 | ||
solr0.column.ignore.uknown.fields=true | ||
solr0.column.ignore.unknown.fields=true | ||
solr0.column.mappings.createdAt.field=created_date | ||
solr0.column.mappings.favoriteCount.field=favorite_count | ||
solr0.column.mappings.text.field=text | ||
``` | ||
|
||
# HttpSolr | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/io/confluent/connect/solr/sink/CloudSolrSinkConnector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.confluent.connect.solr.sink; | ||
|
||
import org.apache.kafka.connect.connector.Task; | ||
|
||
public class CloudSolrSinkConnector extends SolrSinkConnector { | ||
@Override | ||
public Class<? extends Task> taskClass() { | ||
return CloudSolrSinkTask.class; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/io/confluent/connect/solr/sink/CloudSolrSinkTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.confluent.connect.solr.sink; | ||
|
||
|
||
import java.util.Map; | ||
|
||
public class CloudSolrSinkTask extends SolrSinkTask { | ||
@Override | ||
protected SolrInputDocumentHandlerFactory getSolrInputDocumentHandlerFactory(Map<String, String> map) { | ||
CloudSolrInputDocumentHandlerFactory cloudSolrInputDocumentHandlerFactory = new CloudSolrInputDocumentHandlerFactory(); | ||
cloudSolrInputDocumentHandlerFactory.initialize(map); | ||
return cloudSolrInputDocumentHandlerFactory; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.