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

Reply via email to