Skip to main content

Featured

Kafka MirrorMaker in Kafka 0.10.0.1+

Check MirrorMaker.scala for more details.
Target cluster setupDownload and install Kafka (target cluster). Select appropriate version and download its tgz from Kafka Downloads page.tar -zxf kafka_2.11-0.10.0.1.tgz cd kafka_2.11-0.10.0.1 Configure Target Kafka cluster's ZooKeepervim ./config/zookeeper.properties # the directory where the snapshot is stored. dataDir=/work/kafka_2.11-0.10.0.1/zookeeper-data # the port at which the clients will connect clientPort=2181 # disable the per-ip limit on thseparatedof connections since this is a non-production config maxClientCnxns=0 Start Target Kafka cluster's ZooKeeper./bin/zookeeper-server-start.sh config/zookeeper.properties Configure Target Kafka cluster's Servervim ./config/server.properties # The id of the broker. This must be set to a unique integer for each broker. broker.id=0 # The number of threads handling network requests num.network.threads=3 # The number of threads doing disk I/O num.io.threads=8 # The send buffer (SO_…

Scala simple concepts

A simple iteration over Array in Scala can be done as:
  val xs:Array[String] = Array[String]("a", "b", "c", "d", "e")
  for((x,i) <- xs.iterator.zipWithIndex) println(i + "th element is " + x)
  for((x,i) <- xs.view.zipWithIndex) println(i + "th element is " + x) 
  for (i <- xs.indices) println(i + "th element is " + xs(i))
  for (i <- 0 until xs.length) println(i + "th element is " + xs(i))
  for (i <- xs.length - 1 to 0 by -1) println(i + "th element is " + xs(i))

Comments