Skip to content

Instantly share code, notes, and snippets.

@joekiller
Last active May 25, 2016 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joekiller/eb8794ad5f71c1430c54cd557ce642e5 to your computer and use it in GitHub Desktop.
Save joekiller/eb8794ad5f71c1430c54cd557ce642e5 to your computer and use it in GitHub Desktop.
Flume With Solr 6
# example.conf: A single-node Flume configuration
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
a1.sources.r1.type = spooldir
a1.sources.r1.channels = c1
a1.sources.r1.spoolDir = /tmp/messages
a1.sources.r1.fileHeader = true
a1.sinks.k1.type = org.apache.flume.sink.solr.morphline.MorphlineSolrSink
a1.sinks.k1.channel = c1
a1.sinks.k1.morphlineFile = conf/morphline.conf
# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 1000
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
SOLR_LOCATOR: {
collection: gettingstarted
zkHost: "127.0.0.1:9893"
}
morphlines : [
{
id : morphline1
importCommands : ["org.kitesdk.**", "org.apache.solr.**"]
commands : [
{
readLine {
charset : UTF-8
}
}
{
grok {
dictionaryString : """
SPACE \s*
DATA .*?
GREEDYDATA .*
"""
expressions : {
message : """%{GREEDYDATA:id}"""
}
}
}
{
sanitizeUnknownSolrFields {
solrLocator : ${SOLR_LOCATOR}
}
}
{ logInfo { format : "output record: {}", args : ["@{}"] } }
# load the record into a Solr server or MapReduce Reducer
{
loadSolr {
solrLocator : ${SOLR_LOCATOR}
}
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment