Spark Streamingのサンプルコードがどのように動作しているか確認する。 なお、今回はKafkaを利用してStreamingし、Elastic Searchのインデキシングする例を考える。
- Spark Streaming: v1.1.0
- Local environemnt on Mac OX
| require 'rmagick' | |
| #include Magick | |
| white = Magick::Pixel.new(255*256,255*256,255*256) | |
| img1 = Magick::Image.read('sample6.jpg').first | |
| img1.each_pixel {|pixel,x,y| | |
| if pixel.to_color != "red" then | |
| img1.pixel_color(x,y,white) |
| #!/bin/bash | |
| # You need to install overlayroot | |
| # sudo apt-get install overlayroot | |
| LANG=C | |
| set -e | |
| set -x |
| // Create a new MergeStrategy for aop.xml files | |
| val aopMerge: MergeStrategy = new MergeStrategy { | |
| val name = "aopMerge" | |
| import scala.xml._ | |
| import scala.xml.dtd._ | |
| def apply(tempDir: File, path: String, files: Seq[File]): Either[String, Seq[(File, String)]] = { | |
| val dt = DocType("aspectj", PublicID("-//AspectJ//DTD//EN", "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"), Nil) | |
| val file = MergeStrategy.createMergeTarget(tempDir, path) |
| window.animals = [ | |
| "イヌ", | |
| "ウシ", | |
| "ウマ", | |
| "オス", | |
| "カバ", | |
| "クマ", | |
| "サイ", | |
| "サル", | |
| "シカ", |