How to execute solr zookeeper CLI to upload solr configuration

My scala app needs to interact with solr cloud via zookeeper.I need to upload the solr configuration files(conf folder) to the zookeeper. It is done using the following shell command :

 cloud-scripts/zkcli.sh -cmd upconfig -zkhost zkHostAddress:2181 -d solr/collection/conf/ -n collection

I need this config upload to be done from my scala app itself and not use this shell command . How can I achieve this ?

Answers


Netflix wrote a good Zookeeper library called Curator (now an Apache project) that works quite well from Scala e.g the following code establishes a connection to ZooKeeper

private def getConnection(connection : String): Option[CuratorFramework] = {
   val retryPolicy = new ExponentialBackoffRetry(100,3)
    val newConn = CuratorFrameworkFactory.builder().
      connectString(connection).
      retryPolicy(retryPolicy).connectionTimeoutMs(1000).
      build
    try {
    newConn.start()
    newConn.checkExists.forPath(SOME_PATH)

    Some(newConn)
    } catch {
      case e:Exception => {
        error(e)
        None
      }
    }
}

Need Your Help

Rails: Omniauth Facebook Permissions currently staggered - why is that?

ruby-on-rails facebook-graph-api omniauth

When I initially register with my app via Omniauth, the popup dialog box says that Facebook will ask only for my public information. When I check the user in the rails console, the email field is "...

a simple 3 level flex layout with bottom right alignment

css html5 layout svg flexbox

I need to make a flexible header which takes the calculated height of the svg logo and takes the available width to fit the nav: