> On 九月 9, 2019, 3:16 p.m., Don Bosco Durai wrote: > > plugin-solr/src/main/java/org/apache/ranger/services/solr/client/ServiceSolrConnectionMgr.java > > Line 33 (original), 35 (patched) > > <https://reviews.apache.org/r/71449/diff/1/?file=2164383#file2164383line35> > > > > Instead of spliting the URLs and taking the last URL, can we support > > SolrCloud client using Zookeeper? > > Kehua Wu wrote: > Thank you for your reply! > However, in some scenarios, SolrCloud does not require ZooKeeper to work > with. For example, my own test environment is just a simple SolrCloud mode > without Zookeeper, so I think the way Solr Url needs to be retained. But in > the future, I can open a new feature list to support the SolrCloud > configuration method of ZooKeeper. > > Don Bosco Durai wrote: > In your current implementation, you are connecting to the last Solr URL > in the list. So if that Solr instance is down, we won't be automatically > connecting to the other URLs. Correct me if I am wrong. I feel, the correct > implementation will be to use Zookeeper, else we have to modify our calling > code to use other Solr URLs when one of them fails with connection error. > > Kehua Wu wrote: > Thank you, but my implementation logic is to select the first connection > in the Solr URL to connect, if the connection fails, take the next one until > it succeeds. > And the method "getSolrClient" will be called every time when testing > connection or get SolrCloud resources. > > org.apache.ranger.services.solr.client.ServiceSolrConnectionMgr.getSolrClient(String, > Map<String, String>) > So every time Ranger connects to SolrCloud, it will try every Solr URL > connection until it succeeds. > > Don Bosco Durai wrote: > I am not sure whether it works like the way you are envisioning. Can you > test by bringing your Solr instance down in alternate order, but don't > restart your Ranger. > Also, I was not aware you can have SolrCloud without Zookeeper. Can you > point to the documentation which mentions how to create SolrCloud without > Zookeeper. I can do a quick test. Thanks
Dear Don, I checked my code carefully, and found some problems, then I fixed it, and then I tested the following three scenarios, it is ok. 1. The first url is legal and the second url is illegal. 2. The first url is illegal and the second url is legal. 3. All urls are legal. I built my SolrCloud environment by the page 11 of document 'apache-solr-ref-guide-7.7.pdf'. Please refer to as follow, thanks. *Launch Solr in SolrCloud Mode* To launch Solr, run: bin/solr start -e cloud on Unix or MacOS; bin\solr.cmd start -e cloud on Windows. This will start an interactive session that will start two Solr "servers" on your machine. This command has an option to run without prompting you for input (-noprompt), but we want to modify two of the defaults so we won’t use that option now. ``` solr-7.7.0:$ ./bin/solr start -e cloud Welcome to the SolrCloud example! This interactive session will help you launch a SolrCloud cluster on your local workstation. To begin, how many Solr nodes would you like to run in your local cluster? (specify 1-4 nodes) [2]: ``` The first prompt asks how many nodes we want to run. Note the [2] at the end of the last line; that is the default number of nodes. Two is what we want for this example, so you can simply press enter. ``` Ok, let's start up 2 Solr nodes for your example SolrCloud cluster. Please enter the port for node1 [8983]: ``` This will be the port that the first node runs on. Unless you know you have something else running on port 8983 on your machine, accept this default option also by pressing enter. If something is already using that port, you will be asked to choose another port. ``` Please enter the port for node2 [7574]: ``` This is the port the second node will run on. Again, unless you know you have something else running on port 8983 on your machine, accept this default option also by pressing enter. If something is already using that port, you will be asked to choose another port. Solr will now initialize itself and start running on those two nodes. The script will print the commands it uses for your reference. - Kehua ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/71449/#review217653 ----------------------------------------------------------- On 九月 9, 2019, 8:23 a.m., Kehua Wu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/71449/ > ----------------------------------------------------------- > > (Updated 九月 9, 2019, 8:23 a.m.) > > > Review request for ranger, Ankita Sinha, Don Bosco Durai, Colm O > hEigeartaigh, Gautam Borad, Abhay Kulkarni, Madhan Neethiraj, Mehul Parikh, > Nitin Galave, pengjianhua, Pradeep Agrawal, Ramesh Mani, Selvamohan > Neethiraj, Sailaja Polavarapu, sam rome, Venkat Ranganathan, Velmurugan > Periasamy, Qiang Zhang, and Barna Zsombor Klara. > > > Bugs: RANGER-2562 > https://issues.apache.org/jira/browse/RANGER-2562 > > > Repository: ranger > > > Description > ------- > > When create a new Solr service, we can set only one Solr URL, but as we know > Solr cloud model has more than one Solr service, so we should support for > configuration of multiple Solr URLs in the Solr service. > > eg. > > When I set "http://192.166.1.1:18983/solr" for "Solr URL" in the Solr > service, I click the "Test Connection" button, it will be ok, it shows > "Connected Successfully." > > But when I set "http://192.166.1.1:18983/solr,http://192.166.1.2:28983/solr" > for "Solr URL" in the Solr service, I click the "Test Connection" button, it > will show "Connection Failed." > > > Diffs > ----- > > > plugin-solr/src/main/java/org/apache/ranger/services/solr/client/ServiceSolrConnectionMgr.java > f56373b > > > Diff: https://reviews.apache.org/r/71449/diff/1/ > > > Testing > ------- > > > Thanks, > > Kehua Wu > >