Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 32C42200D54 for ; Fri, 8 Dec 2017 10:40:56 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 31565160C0D; Fri, 8 Dec 2017 09:40:56 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 76BE0160BF2 for ; Fri, 8 Dec 2017 10:40:55 +0100 (CET) Received: (qmail 14441 invoked by uid 500); 8 Dec 2017 09:40:53 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 14425 invoked by uid 99); 8 Dec 2017 09:40:53 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Dec 2017 09:40:53 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id E4559180145 for ; Fri, 8 Dec 2017 09:40:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.284 X-Spam-Level: ** X-Spam-Status: No, score=2.284 tagged_above=-999 required=6.31 tests=[SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.972, URI_HEX=1.313] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id EHoJkvMHJSkI for ; Fri, 8 Dec 2017 09:40:51 +0000 (UTC) Received: from n3.nabble.com (n3.nabble.com [162.255.23.22]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 30B635F3D1 for ; Fri, 8 Dec 2017 09:40:51 +0000 (UTC) Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id ADD899EEE2DA for ; Fri, 8 Dec 2017 02:40:49 -0700 (MST) Date: Fri, 8 Dec 2017 02:40:49 -0700 (MST) From: Sabeer Hussain To: solr-user@lucene.apache.org Message-ID: <1512726049709-0.post@n3.nabble.com> Subject: How to perform delta-import on SolrCloud mode through a scheduler? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit archived-at: Fri, 08 Dec 2017 09:40:56 -0000 I am using Solr 7.1 version and deployed it in standalone mode. I have created a scheduler in my application itself to perform delta-import operation based on a pre-configured frequency. I have used the following lines of code (in java) to invoke delta-import operation URL url = new URL("http://localhost:8080/solr/mycorename"); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("GET"); if(connection != null ) { connection.setDoOutput(true); connection.setRequestProperty ("Authorization", getBasicAuthorization()); connection.setConnectTimeout(10000);// 10 seconds String data = URLEncoder.encode("command", "UTF-8") + "=" + URLEncoder.encode("delta-import", "UTF-8"); data += "&" + URLEncoder.encode("optimize", "UTF-8") + "=" + URLEncoder.encode("true", "UTF-8"); data += "&" + URLEncoder.encode("clean", "UTF-8") + "=" + URLEncoder.encode("false", "UTF-8"); data += "&" + URLEncoder.encode("commit", "UTF-8") + "=" + URLEncoder.encode("true", "UTF-8"); OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream()); out.write(data); out.flush(); BufferedReader in = new BufferedReader( new InputStreamReader( connection.getInputStream())); String decodedString; while ((decodedString = in.readLine()) != null) { System.out.println(decodedString); } in.close(); out.close(); in = null; out=null; connection = null; url = null; } Now, I want to deploy the application in SolrCloud mode and for each core, there will be 2 more replicas. Each replica will be running on separate server (say localhost:8983, localhost:8984,localhost:8985). So, my question is, how I can use delta-import operation for my cores using my above code? In the standlone mode, there is only core(s) and no replica available, so, I can directly use that. On Cloud mode, whether I need to check for the active node and create the URLConnection based on that or not. Is there any thing from ZooKeeper that I can use (like SolrJ client). Another issue is that my delta-import scheduler will be available in all the three instances of my application. So, how I can ensure that delta-import operation will be performed from one instance only. -- Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html