sunspot_solr 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (256) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sunspot-solr +2 -6
  3. data/lib/sunspot/solr/server.rb +2 -3
  4. data/solr/README.txt +181 -181
  5. data/solr/bin/post +29 -19
  6. data/solr/bin/solr +247 -428
  7. data/solr/bin/solr.cmd +102 -256
  8. data/solr/bin/solr.in.cmd +15 -7
  9. data/solr/bin/solr.in.sh +26 -12
  10. data/solr/server/README.txt +110 -113
  11. data/solr/server/contexts/solr-jetty-context.xml +8 -8
  12. data/solr/server/etc/jetty-http.xml +47 -0
  13. data/solr/server/etc/jetty-https-ssl.xml +175 -159
  14. data/solr/server/etc/jetty-https.xml +53 -0
  15. data/solr/server/etc/jetty-ssl.xml +46 -0
  16. data/solr/server/etc/jetty.xml +189 -167
  17. data/solr/server/etc/webdefault.xml +527 -527
  18. data/solr/server/lib/javax.servlet-api-3.1.0.jar +0 -0
  19. data/solr/server/lib/jetty-continuation-9.2.11.v20150529.jar +0 -0
  20. data/solr/server/lib/jetty-deploy-9.2.11.v20150529.jar +0 -0
  21. data/solr/server/lib/jetty-http-9.2.11.v20150529.jar +0 -0
  22. data/solr/server/lib/jetty-io-9.2.11.v20150529.jar +0 -0
  23. data/solr/server/lib/jetty-jmx-9.2.11.v20150529.jar +0 -0
  24. data/solr/server/lib/jetty-rewrite-9.2.11.v20150529.jar +0 -0
  25. data/solr/server/lib/jetty-security-9.2.11.v20150529.jar +0 -0
  26. data/solr/server/lib/jetty-server-9.2.11.v20150529.jar +0 -0
  27. data/solr/server/lib/jetty-servlet-9.2.11.v20150529.jar +0 -0
  28. data/solr/server/lib/jetty-servlets-9.2.11.v20150529.jar +0 -0
  29. data/solr/server/lib/jetty-util-9.2.11.v20150529.jar +0 -0
  30. data/solr/server/lib/jetty-webapp-9.2.11.v20150529.jar +0 -0
  31. data/solr/server/lib/jetty-xml-9.2.11.v20150529.jar +0 -0
  32. data/solr/server/modules/http.mod +9 -0
  33. data/solr/server/modules/https.mod +9 -0
  34. data/solr/server/modules/server.mod +11 -0
  35. data/solr/server/modules/ssl.mod +9 -0
  36. data/solr/server/resources/jetty-logging.properties +1 -0
  37. data/solr/server/resources/log4j.properties +24 -24
  38. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-exec-1.3.jar +0 -0
  39. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{hadoop-annotations-2.3.0.jar → hadoop-annotations-2.6.0.jar} +0 -0
  40. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.6.0.jar +0 -0
  41. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.6.0.jar +0 -0
  42. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.6.0.jar +0 -0
  43. data/solr/server/solr-webapp/webapp/WEB-INF/lib/htrace-core-3.0.4.jar +0 -0
  44. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.4.1.jar +0 -0
  45. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.4.1.jar +0 -0
  46. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.4.1.jar +0 -0
  47. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.5.4.jar +0 -0
  48. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-dataformat-smile-2.5.4.jar +0 -0
  49. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-common-5.0.0.jar → lucene-analyzers-common-5.3.1.jar} +0 -0
  50. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-kuromoji-5.0.0.jar → lucene-analyzers-kuromoji-5.3.1.jar} +0 -0
  51. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-phonetic-5.0.0.jar → lucene-analyzers-phonetic-5.3.1.jar} +0 -0
  52. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar +0 -0
  53. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.3.1.jar +0 -0
  54. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.3.1.jar +0 -0
  55. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-expressions-5.0.0.jar → lucene-expressions-5.3.1.jar} +0 -0
  56. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-grouping-5.0.0.jar → lucene-grouping-5.3.1.jar} +0 -0
  57. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.3.1.jar +0 -0
  58. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.3.1.jar +0 -0
  59. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.3.1.jar +0 -0
  60. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.3.1.jar +0 -0
  61. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.3.1.jar +0 -0
  62. data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-queryparser-5.0.0.jar → lucene-queryparser-5.3.1.jar} +0 -0
  63. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-sandbox-5.3.1.jar +0 -0
  64. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.3.1.jar +0 -0
  65. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.3.1.jar +0 -0
  66. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.3.0.jar +0 -0
  67. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.3.0.jar +0 -0
  68. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.3.1.jar +0 -0
  69. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.3.1.jar +0 -0
  70. data/solr/server/solr-webapp/webapp/WEB-INF/lib/t-digest-3.1.jar +0 -0
  71. data/solr/server/solr-webapp/webapp/WEB-INF/web.xml +169 -181
  72. data/solr/server/solr-webapp/webapp/WEB-INF/weblogic.xml +28 -28
  73. data/solr/server/solr-webapp/webapp/admin.html +164 -163
  74. data/solr/server/solr-webapp/webapp/css/angular/analysis.css +304 -0
  75. data/solr/server/solr-webapp/webapp/css/angular/chosen.css +465 -0
  76. data/solr/server/solr-webapp/webapp/css/angular/cloud.css +398 -0
  77. data/solr/server/solr-webapp/webapp/css/angular/common.css +724 -0
  78. data/solr/server/solr-webapp/webapp/css/angular/cores.css +233 -0
  79. data/solr/server/solr-webapp/webapp/css/angular/dataimport.css +370 -0
  80. data/solr/server/solr-webapp/webapp/css/angular/documents.css +179 -0
  81. data/solr/server/solr-webapp/webapp/css/angular/files.css +53 -0
  82. data/solr/server/solr-webapp/webapp/css/angular/index.css +206 -0
  83. data/solr/server/solr-webapp/webapp/css/angular/logging.css +376 -0
  84. data/solr/server/solr-webapp/webapp/css/angular/menu.css +321 -0
  85. data/solr/server/solr-webapp/webapp/css/angular/plugins.css +212 -0
  86. data/solr/server/solr-webapp/webapp/css/angular/query.css +162 -0
  87. data/solr/server/solr-webapp/webapp/css/angular/replication.css +500 -0
  88. data/solr/server/solr-webapp/webapp/css/angular/schema-browser.css +567 -0
  89. data/solr/server/solr-webapp/webapp/css/angular/segments.css +173 -0
  90. data/solr/server/solr-webapp/webapp/css/angular/threads.css +161 -0
  91. data/solr/server/solr-webapp/webapp/css/chosen.css +421 -421
  92. data/solr/server/solr-webapp/webapp/css/styles/analysis.css +311 -311
  93. data/solr/server/solr-webapp/webapp/css/styles/cloud.css +410 -410
  94. data/solr/server/solr-webapp/webapp/css/styles/common.css +701 -701
  95. data/solr/server/solr-webapp/webapp/css/styles/cores.css +244 -244
  96. data/solr/server/solr-webapp/webapp/css/styles/dashboard.css +155 -155
  97. data/solr/server/solr-webapp/webapp/css/styles/dataimport.css +403 -403
  98. data/solr/server/solr-webapp/webapp/css/styles/documents.css +197 -197
  99. data/solr/server/solr-webapp/webapp/css/styles/files.css +54 -54
  100. data/solr/server/solr-webapp/webapp/css/styles/index.css +207 -207
  101. data/solr/server/solr-webapp/webapp/css/styles/java-properties.css +52 -52
  102. data/solr/server/solr-webapp/webapp/css/styles/logging.css +391 -391
  103. data/solr/server/solr-webapp/webapp/css/styles/menu.css +329 -328
  104. data/solr/server/solr-webapp/webapp/css/styles/plugins.css +195 -195
  105. data/solr/server/solr-webapp/webapp/css/styles/query.css +173 -173
  106. data/solr/server/solr-webapp/webapp/css/styles/replication.css +515 -515
  107. data/solr/server/solr-webapp/webapp/css/styles/schema-browser.css +578 -578
  108. data/solr/server/solr-webapp/webapp/css/styles/segments.css +145 -0
  109. data/solr/server/solr-webapp/webapp/css/styles/threads.css +172 -172
  110. data/solr/server/solr-webapp/webapp/img/chosen-sprite-2x.png +0 -0
  111. data/solr/server/solr-webapp/webapp/img/filetypes/README +27 -27
  112. data/solr/server/solr-webapp/webapp/img/solr.svg +39 -39
  113. data/solr/server/solr-webapp/webapp/index.html +208 -0
  114. data/solr/server/solr-webapp/webapp/js/angular/app.js +713 -0
  115. data/solr/server/solr-webapp/webapp/js/angular/controllers/analysis.js +199 -0
  116. data/solr/server/solr-webapp/webapp/js/angular/controllers/cloud.js +528 -0
  117. data/solr/server/solr-webapp/webapp/js/angular/controllers/core-overview.js +225 -0
  118. data/solr/server/solr-webapp/webapp/js/angular/controllers/cores.js +465 -0
  119. data/solr/server/solr-webapp/webapp/js/angular/controllers/dataimport.js +284 -0
  120. data/solr/server/solr-webapp/webapp/js/angular/controllers/documents.js +139 -0
  121. data/solr/server/solr-webapp/webapp/js/angular/controllers/files.js +92 -0
  122. data/solr/server/solr-webapp/webapp/js/angular/controllers/index.js +95 -0
  123. data/solr/server/solr-webapp/webapp/js/angular/controllers/java-properties.js +45 -0
  124. data/solr/server/solr-webapp/webapp/js/angular/controllers/logging.js +146 -0
  125. data/solr/server/solr-webapp/webapp/js/angular/controllers/plugins.js +166 -0
  126. data/solr/server/solr-webapp/webapp/js/angular/controllers/query.js +99 -0
  127. data/solr/server/solr-webapp/webapp/js/angular/controllers/replication.js +227 -0
  128. data/solr/server/solr-webapp/webapp/js/angular/controllers/schema-browser.js +432 -0
  129. data/solr/server/solr-webapp/webapp/js/angular/controllers/segments.js +94 -0
  130. data/solr/server/solr-webapp/webapp/js/angular/controllers/threads.js +51 -0
  131. data/solr/server/solr-webapp/webapp/js/angular/services.js +214 -0
  132. data/solr/server/solr-webapp/webapp/js/lib/ZeroClipboard.js +342 -342
  133. data/solr/server/solr-webapp/webapp/js/lib/chosen.js +982 -982
  134. data/solr/server/solr-webapp/webapp/js/lib/console.js +29 -29
  135. data/solr/server/solr-webapp/webapp/js/lib/d3.js +9373 -9373
  136. data/solr/server/solr-webapp/webapp/js/lib/highlight.js +31 -31
  137. data/solr/server/solr-webapp/webapp/js/lib/jquery-1.7.2.min.js +30 -30
  138. data/solr/server/solr-webapp/webapp/js/lib/jquery.ajaxfileupload.js +184 -184
  139. data/solr/server/solr-webapp/webapp/js/lib/jquery.blockUI.js +523 -523
  140. data/solr/server/solr-webapp/webapp/js/lib/jquery.cookie.js +71 -71
  141. data/solr/server/solr-webapp/webapp/js/lib/jquery.form.js +806 -806
  142. data/solr/server/solr-webapp/webapp/js/lib/jquery.jstree.js +3534 -3534
  143. data/solr/server/solr-webapp/webapp/js/lib/jquery.sammy.js +1863 -1863
  144. data/solr/server/solr-webapp/webapp/js/lib/jquery.timeago.js +189 -189
  145. data/solr/server/solr-webapp/webapp/js/lib/linker.js +48 -48
  146. data/solr/server/solr-webapp/webapp/js/lib/naturalSort.js +82 -0
  147. data/solr/server/solr-webapp/webapp/js/lib/order.js +216 -216
  148. data/solr/server/solr-webapp/webapp/js/main.js +60 -58
  149. data/solr/server/solr-webapp/webapp/js/require.js +11349 -11349
  150. data/solr/server/solr-webapp/webapp/js/scripts/analysis.js +545 -545
  151. data/solr/server/solr-webapp/webapp/js/scripts/app.js +680 -679
  152. data/solr/server/solr-webapp/webapp/js/scripts/cloud.js +877 -877
  153. data/solr/server/solr-webapp/webapp/js/scripts/cores.js +719 -719
  154. data/solr/server/solr-webapp/webapp/js/scripts/dashboard.js +562 -562
  155. data/solr/server/solr-webapp/webapp/js/scripts/dataimport.js +812 -812
  156. data/solr/server/solr-webapp/webapp/js/scripts/documents.js +370 -370
  157. data/solr/server/solr-webapp/webapp/js/scripts/files.js +265 -265
  158. data/solr/server/solr-webapp/webapp/js/scripts/index.js +340 -340
  159. data/solr/server/solr-webapp/webapp/js/scripts/java-properties.js +106 -106
  160. data/solr/server/solr-webapp/webapp/js/scripts/logging.js +578 -576
  161. data/solr/server/solr-webapp/webapp/js/scripts/ping.js +72 -72
  162. data/solr/server/solr-webapp/webapp/js/scripts/plugins.js +462 -462
  163. data/solr/server/solr-webapp/webapp/js/scripts/query.js +229 -229
  164. data/solr/server/solr-webapp/webapp/js/scripts/replication.js +527 -527
  165. data/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js +1229 -1229
  166. data/solr/server/solr-webapp/webapp/js/scripts/segments.js +206 -0
  167. data/solr/server/solr-webapp/webapp/js/scripts/threads.js +158 -158
  168. data/solr/server/solr-webapp/webapp/libs/angular-chosen.js +139 -0
  169. data/solr/server/solr-webapp/webapp/libs/angular-cookies.js +229 -0
  170. data/solr/server/solr-webapp/webapp/libs/angular-cookies.min.js +31 -0
  171. data/solr/server/solr-webapp/webapp/libs/angular-resource.min.js +36 -0
  172. data/solr/server/solr-webapp/webapp/libs/angular-route.js +1018 -0
  173. data/solr/server/solr-webapp/webapp/libs/angular-route.min.js +38 -0
  174. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.js +703 -0
  175. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.min.js +39 -0
  176. data/solr/server/solr-webapp/webapp/libs/angular.js +26093 -0
  177. data/solr/server/solr-webapp/webapp/libs/angular.min.js +273 -0
  178. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.js +1194 -0
  179. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.min.js +30 -0
  180. data/solr/server/solr-webapp/webapp/libs/d3.js +9373 -0
  181. data/solr/server/solr-webapp/webapp/libs/highlight.js +31 -0
  182. data/solr/server/solr-webapp/webapp/libs/jquery-2.1.3.min.js +29 -0
  183. data/solr/server/solr-webapp/webapp/libs/jquery.jstree.js +3534 -0
  184. data/solr/server/solr-webapp/webapp/libs/ngtimeago.js +102 -0
  185. data/solr/server/solr-webapp/webapp/partials/analysis.html +128 -0
  186. data/solr/server/solr-webapp/webapp/partials/cloud.html +104 -0
  187. data/solr/server/solr-webapp/webapp/partials/core_overview.html +227 -0
  188. data/solr/server/solr-webapp/webapp/partials/cores.html +231 -0
  189. data/solr/server/solr-webapp/webapp/partials/dataimport.html +209 -0
  190. data/solr/server/solr-webapp/webapp/partials/documents.html +118 -0
  191. data/solr/server/solr-webapp/webapp/partials/files.html +47 -0
  192. data/solr/server/solr-webapp/webapp/partials/index.html +261 -0
  193. data/solr/server/solr-webapp/webapp/partials/java-properties.html +27 -0
  194. data/solr/server/solr-webapp/webapp/partials/logging-levels.html +56 -0
  195. data/solr/server/solr-webapp/webapp/partials/logging.html +56 -0
  196. data/solr/server/solr-webapp/webapp/partials/plugins.html +72 -0
  197. data/solr/server/solr-webapp/webapp/partials/query.html +356 -0
  198. data/solr/server/solr-webapp/webapp/partials/replication.html +239 -0
  199. data/solr/server/solr-webapp/webapp/partials/schema-browser.html +206 -0
  200. data/solr/server/solr-webapp/webapp/partials/segments.html +99 -0
  201. data/solr/server/solr-webapp/webapp/partials/threads.html +65 -0
  202. data/solr/server/solr-webapp/webapp/tpl/analysis.html +83 -83
  203. data/solr/server/solr-webapp/webapp/tpl/cloud.html +87 -87
  204. data/solr/server/solr-webapp/webapp/tpl/cores.html +226 -226
  205. data/solr/server/solr-webapp/webapp/tpl/dashboard.html +201 -201
  206. data/solr/server/solr-webapp/webapp/tpl/dataimport.html +183 -183
  207. data/solr/server/solr-webapp/webapp/tpl/documents.html +107 -107
  208. data/solr/server/solr-webapp/webapp/tpl/files.html +44 -44
  209. data/solr/server/solr-webapp/webapp/tpl/index.html +250 -250
  210. data/solr/server/solr-webapp/webapp/tpl/logging.html +23 -23
  211. data/solr/server/solr-webapp/webapp/tpl/plugins.html +39 -39
  212. data/solr/server/solr-webapp/webapp/tpl/query.html +361 -361
  213. data/solr/server/solr-webapp/webapp/tpl/replication.html +216 -216
  214. data/solr/server/solr-webapp/webapp/tpl/schema-browser.html +192 -192
  215. data/solr/server/solr-webapp/webapp/tpl/segments.html +49 -0
  216. data/solr/server/solr-webapp/webapp/tpl/threads.html +56 -56
  217. data/solr/server/solr/README.txt +77 -77
  218. data/solr/server/solr/solr.xml +51 -51
  219. data/solr/server/solr/zoo.cfg +17 -17
  220. data/solr/server/start.jar +0 -0
  221. data/spec/server_spec.rb +3 -8
  222. metadata +132 -43
  223. data/solr/server/lib/jetty-continuation-8.1.10.v20130312.jar +0 -0
  224. data/solr/server/lib/jetty-deploy-8.1.10.v20130312.jar +0 -0
  225. data/solr/server/lib/jetty-http-8.1.10.v20130312.jar +0 -0
  226. data/solr/server/lib/jetty-io-8.1.10.v20130312.jar +0 -0
  227. data/solr/server/lib/jetty-jmx-8.1.10.v20130312.jar +0 -0
  228. data/solr/server/lib/jetty-security-8.1.10.v20130312.jar +0 -0
  229. data/solr/server/lib/jetty-server-8.1.10.v20130312.jar +0 -0
  230. data/solr/server/lib/jetty-servlet-8.1.10.v20130312.jar +0 -0
  231. data/solr/server/lib/jetty-util-8.1.10.v20130312.jar +0 -0
  232. data/solr/server/lib/jetty-webapp-8.1.10.v20130312.jar +0 -0
  233. data/solr/server/lib/jetty-xml-8.1.10.v20130312.jar +0 -0
  234. data/solr/server/lib/servlet-api-3.0.jar +0 -0
  235. data/solr/server/solr-webapp/webapp/.gitignore +0 -1
  236. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.3.0.jar +0 -0
  237. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.3.0.jar +0 -0
  238. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.3.0.jar +0 -0
  239. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.3.1.jar +0 -0
  240. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.3.jar +0 -0
  241. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.3.1.jar +0 -0
  242. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.0.0.jar +0 -0
  243. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.0.0.jar +0 -0
  244. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.0.0.jar +0 -0
  245. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.0.0.jar +0 -0
  246. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.0.0.jar +0 -0
  247. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.0.0.jar +0 -0
  248. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.0.0.jar +0 -0
  249. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.0.0.jar +0 -0
  250. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.0.0.jar +0 -0
  251. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.0.0.jar +0 -0
  252. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.1.1.jar +0 -0
  253. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.1.1.jar +0 -0
  254. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.0.0.jar +0 -0
  255. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.0.0.jar +0 -0
  256. data/solr/server/webapps/solr.war +0 -0
data/solr/bin/solr CHANGED
@@ -50,9 +50,9 @@ verbose=false
50
50
  THIS_OS=`uname -s`
51
51
 
52
52
  if hash jar 2>/dev/null ; then # hash returns true if jar is on the path
53
- UNPACK_WAR_CMD="$(command -v jar) xf"
53
+ UNPACK_WAR_CMD=("$(command -v jar)" xf)
54
54
  elif hash unzip 2>/dev/null ; then # hash returns true if unzip is on the path
55
- UNPACK_WAR_CMD="$(command -v unzip) -q"
55
+ UNPACK_WAR_CMD=("$(command -v unzip)" -q)
56
56
  else
57
57
  echo -e "This script requires extracting a WAR file with either the jar or unzip utility, please install these utilities or contact your administrator for assistance."
58
58
  exit 1
@@ -81,7 +81,7 @@ done
81
81
 
82
82
  SOLR_TIP=`dirname "$SOLR_SCRIPT"`/..
83
83
  SOLR_TIP=`cd "$SOLR_TIP"; pwd`
84
- DEFAULT_SERVER_DIR=$SOLR_TIP/server
84
+ DEFAULT_SERVER_DIR="$SOLR_TIP/server"
85
85
 
86
86
  # If an include wasn't specified in the environment, then search for one...
87
87
  if [ -z "$SOLR_INCLUDE" ]; then
@@ -102,11 +102,11 @@ elif [ -r "$SOLR_INCLUDE" ]; then
102
102
  fi
103
103
 
104
104
  if [ -z "$SOLR_PID_DIR" ]; then
105
- SOLR_PID_DIR=$SOLR_TIP/bin
105
+ SOLR_PID_DIR="$SOLR_TIP/bin"
106
106
  fi
107
107
 
108
108
  if [ -n "$SOLR_JAVA_HOME" ]; then
109
- JAVA=$SOLR_JAVA_HOME/bin/java
109
+ JAVA="$SOLR_JAVA_HOME/bin/java"
110
110
  elif [ -n "$JAVA_HOME" ]; then
111
111
  for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
112
112
  if [ -x "$java" ]; then
@@ -126,26 +126,55 @@ else
126
126
  fi
127
127
 
128
128
  # test that Java exists and is executable on this server
129
- $JAVA -version >/dev/null 2>&1 || {
129
+ "$JAVA" -version >/dev/null 2>&1 || {
130
130
  echo >&2 "Java not found, or an error was encountered when running java."
131
- echo >&2 "A working Java 8 is required to run Solr!"
132
- echo >&2 "Please install Java 8 or fix JAVA_HOME before running this script."
131
+ echo >&2 "A working Java 7 or later is required to run Solr!"
132
+ echo >&2 "Please install Java or fix JAVA_HOME before running this script."
133
133
  echo >&2 "Command that we tried: '${JAVA} -version'"
134
134
  echo >&2 "Active Path:"
135
135
  echo >&2 "${PATH}"
136
136
  exit 1
137
137
  }
138
138
 
139
- # URL scheme for contacting Solr
139
+ # Select HTTP OR HTTPS related configurations
140
140
  SOLR_URL_SCHEME=http
141
- if [ -n "$SOLR_SSL_OPTS" ]; then
141
+ SOLR_JETTY_CONFIG=()
142
+ SOLR_SSL_OPTS=""
143
+ if [ -n "$SOLR_SSL_KEY_STORE" ]; then
144
+ SOLR_JETTY_CONFIG+=("--module=https")
142
145
  SOLR_URL_SCHEME=https
146
+ SOLR_SSL_OPTS=" -Dsolr.jetty.keystore=$SOLR_SSL_KEY_STORE \
147
+ -Dsolr.jetty.keystore.password=$SOLR_SSL_KEY_STORE_PASSWORD \
148
+ -Dsolr.jetty.truststore=$SOLR_SSL_TRUST_STORE \
149
+ -Dsolr.jetty.truststore.password=$SOLR_SSL_TRUST_STORE_PASSWORD \
150
+ -Dsolr.jetty.ssl.needClientAuth=$SOLR_SSL_NEED_CLIENT_AUTH \
151
+ -Dsolr.jetty.ssl.wantClientAuth=$SOLR_SSL_WANT_CLIENT_AUTH"
152
+ if [ -n "$SOLR_SSL_CLIENT_KEY_STORE" ]; then
153
+ SOLR_SSL_OPTS+=" -Djavax.net.ssl.keyStore=$SOLR_SSL_CLIENT_KEY_STORE \
154
+ -Djavax.net.ssl.keyStorePassword=$SOLR_SSL_CLIENT_KEY_STORE_PASSWORD \
155
+ -Djavax.net.ssl.trustStore=$SOLR_SSL_CLIENT_TRUST_STORE \
156
+ -Djavax.net.ssl.trustStorePassword=$SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD"
157
+ else
158
+ SOLR_SSL_OPTS+=" -Djavax.net.ssl.keyStore=$SOLR_SSL_KEY_STORE \
159
+ -Djavax.net.ssl.keyStorePassword=$SOLR_SSL_KEY_STORE_PASSWORD \
160
+ -Djavax.net.ssl.trustStore=$SOLR_SSL_TRUST_STORE \
161
+ -Djavax.net.ssl.trustStorePassword=$SOLR_SSL_TRUST_STORE_PASSWORD"
162
+ fi
163
+ else
164
+ SOLR_JETTY_CONFIG+=("--module=http")
165
+ fi
166
+
167
+ # Authentication options
168
+ if [ "$SOLR_AUTHENTICATION_CLIENT_CONFIGURER" != "" ]; then
169
+ AUTHC_CLIENT_CONFIGURER_ARG="-Dsolr.authentication.httpclient.configurer=$SOLR_AUTHENTICATION_CLIENT_CONFIGURER"
143
170
  fi
171
+ AUTHC_OPTS="$AUTHC_CLIENT_CONFIGURER_ARG $SOLR_AUTHENTICATION_OPTS"
144
172
 
145
- # Which Jetty config file to use - leave blank to use the default: etc/jetty.xml
146
- SOLR_JETTY_CONFIG=
147
- if [ -n "$SOLR_SSL_OPTS" ]; then
148
- SOLR_JETTY_CONFIG=$SOLR_TIP/server/etc/jetty-https-ssl.xml
173
+ # Set the SOLR_TOOL_HOST variable for use when connecting to a running Solr instance
174
+ if [ "$SOLR_HOST" != "" ]; then
175
+ SOLR_TOOL_HOST="$SOLR_HOST"
176
+ else
177
+ SOLR_TOOL_HOST="localhost"
149
178
  fi
150
179
 
151
180
  function print_usage() {
@@ -200,9 +229,9 @@ function print_usage() {
200
229
  echo " -s <dir> Sets the solr.solr.home system property; Solr will create core directories under"
201
230
  echo " this directory. This allows you to run multiple Solr instances on the same host"
202
231
  echo " while reusing the same server directory set using the -d parameter. If set, the"
203
- echo " specified directory should contain a solr.xml file. The default value is server/solr."
232
+ echo " specified directory should contain a solr.xml file, unless solr.xml exists in ZooKeeper."
204
233
  echo " This parameter is ignored when running examples (-e), as the solr.solr.home depends"
205
- echo " on which example is run."
234
+ echo " on which example is run. The default value is server/solr."
206
235
  echo ""
207
236
  echo " -e <example> Name of the example to run; available examples:"
208
237
  echo " cloud: SolrCloud example"
@@ -341,7 +370,7 @@ function spinner() {
341
370
  local pid=$1
342
371
  local delay=0.5
343
372
  local spinstr='|/-\'
344
- while [ "$(ps aux | awk '{print $2}' | grep $pid)" ]; do
373
+ while [ "$(ps aux | awk '{print $2}' | grep -w $pid)" ]; do
345
374
  local temp=${spinstr#?}
346
375
  printf " [%c] " "$spinstr"
347
376
  local spinstr=$temp${spinstr%"$temp"}
@@ -355,8 +384,8 @@ function spinner() {
355
384
  function solr_pid_by_port() {
356
385
  THE_PORT="$1"
357
386
  if [ -e "$SOLR_PID_DIR/solr-$THE_PORT.pid" ]; then
358
- PID=`cat $SOLR_PID_DIR/solr-$THE_PORT.pid`
359
- CHECK_PID=`ps auxww | awk '{print $2}' | grep $PID | sort -r | tr -d ' '`
387
+ PID=`cat "$SOLR_PID_DIR/solr-$THE_PORT.pid"`
388
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $PID | sort -r | tr -d ' '`
360
389
  if [ "$CHECK_PID" != "" ]; then
361
390
  local solrPID=$PID
362
391
  fi
@@ -367,7 +396,7 @@ function solr_pid_by_port() {
367
396
  # extract the value of the -Djetty.port parameter from a running Solr process
368
397
  function jetty_port() {
369
398
  SOLR_PID="$1"
370
- SOLR_PROC=`ps auxww | grep $SOLR_PID | grep start.jar | grep jetty.port`
399
+ SOLR_PROC=`ps auxww | grep -w $SOLR_PID | grep start\.jar | grep jetty.port`
371
400
  IFS=' ' read -a proc_args <<< "$SOLR_PROC"
372
401
  for arg in "${proc_args[@]}"
373
402
  do
@@ -383,15 +412,11 @@ function jetty_port() {
383
412
  # run a Solr command-line tool using the SolrCLI class;
384
413
  # useful for doing cross-platform work from the command-line using Java
385
414
  function run_tool() {
386
-
387
- # Extract the solr.war if it hasn't been done already (so we can access the SolrCLI class)
388
- if [[ -e $DEFAULT_SERVER_DIR/webapps/solr.war && ! -d "$DEFAULT_SERVER_DIR/solr-webapp/webapp" ]]; then
389
- (mkdir -p $DEFAULT_SERVER_DIR/solr-webapp/webapp && cd $DEFAULT_SERVER_DIR/solr-webapp/webapp && $UNPACK_WAR_CMD $DEFAULT_SERVER_DIR/webapps/solr.war)
390
- fi
391
-
392
- "$JAVA" $SOLR_SSL_OPTS -Dsolr.install.dir=$SOLR_TIP -Dlog4j.configuration=file:$DEFAULT_SERVER_DIR/resources/log4j.properties \
415
+
416
+ "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS -Dsolr.install.dir="$SOLR_TIP" \
417
+ -Dlog4j.configuration="file:$DEFAULT_SERVER_DIR/scripts/cloud-scripts/log4j.properties" \
393
418
  -classpath "$DEFAULT_SERVER_DIR/solr-webapp/webapp/WEB-INF/lib/*:$DEFAULT_SERVER_DIR/lib/ext/*" \
394
- org.apache.solr.util.SolrCLI $*
419
+ org.apache.solr.util.SolrCLI "$@"
395
420
 
396
421
  return $?
397
422
  } # end run_tool function
@@ -399,16 +424,16 @@ function run_tool() {
399
424
  # get information about any Solr nodes running on this host
400
425
  function get_info() {
401
426
  # first, see if Solr is running
402
- numSolrs=`find $SOLR_PID_DIR -name "solr-*.pid" -type f | wc -l | tr -d ' '`
427
+ numSolrs=`find "$SOLR_PID_DIR" -name "solr-*.pid" -type f | wc -l | tr -d ' '`
403
428
  if [ "$numSolrs" != "0" ]; then
404
429
  echo -e "\nFound $numSolrs Solr nodes: "
405
- for PIDF in `find $SOLR_PID_DIR -name "solr-*.pid" -type f`
430
+ find "$SOLR_PID_DIR" -name "solr-*.pid" -type f | while read PIDF
406
431
  do
407
- ID=`cat $PIDF`
432
+ ID=`cat "$PIDF"`
408
433
  port=`jetty_port "$ID"`
409
434
  if [ "$port" != "" ]; then
410
435
  echo -e "\nSolr process $ID running on port $port"
411
- run_tool status -solr $SOLR_URL_SCHEME://localhost:$port/solr
436
+ run_tool status -solr "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr"
412
437
  echo ""
413
438
  else
414
439
  echo -e "\nSolr process $ID from $PIDF not found."
@@ -416,16 +441,16 @@ function get_info() {
416
441
  done
417
442
  else
418
443
  # no pid files but check using ps just to be sure
419
- numSolrs=`ps auxww | grep start.jar | grep solr.solr.home | grep -v grep | wc -l | sed -e 's/^[ \t]*//'`
444
+ numSolrs=`ps auxww | grep start\.jar | grep solr.solr.home | grep -v grep | wc -l | sed -e 's/^[ \t]*//'`
420
445
  if [ "$numSolrs" != "0" ]; then
421
446
  echo -e "\nFound $numSolrs Solr nodes: "
422
- for ID in `ps auxww | grep start.jar | grep solr.solr.home | grep -v grep | awk '{print $2}' | sort -r`
447
+ for ID in `ps auxww | grep start\.jar | grep solr.solr.home | grep -v grep | awk '{print $2}' | sort -r`
423
448
  do
424
449
  port=`jetty_port "$ID"`
425
450
  if [ "$port" != "" ]; then
426
451
  echo ""
427
452
  echo "Solr process $ID running on port $port"
428
- run_tool status -solr $SOLR_URL_SCHEME://localhost:$port/solr
453
+ run_tool status -solr "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr"
429
454
  echo ""
430
455
  fi
431
456
  done
@@ -448,25 +473,25 @@ function stop_solr() {
448
473
 
449
474
  if [ "$SOLR_PID" != "" ]; then
450
475
  echo -e "Sending stop command to Solr running on port $SOLR_PORT ... waiting 5 seconds to allow Jetty process $SOLR_PID to stop gracefully."
451
- $JAVA $SOLR_SSL_OPTS -jar $DIR/start.jar $SOLR_JETTY_CONFIG STOP.PORT=$STOP_PORT STOP.KEY=$STOP_KEY --stop || true
476
+ "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS -jar "$DIR/start.jar" "STOP.PORT=$STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true
452
477
  (sleep 5) &
453
478
  spinner $!
454
- rm -f $SOLR_PID_DIR/solr-$SOLR_PORT.pid
479
+ rm -f "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
455
480
  else
456
481
  echo -e "No Solr nodes found to stop."
457
482
  exit 0
458
483
  fi
459
484
 
460
- CHECK_PID=`ps auxww | awk '{print $2}' | grep $SOLR_PID | sort -r | tr -d ' '`
485
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $SOLR_PID | sort -r | tr -d ' '`
461
486
  if [ "$CHECK_PID" != "" ]; then
462
487
  echo -e "Solr process $SOLR_PID is still running; forcefully killing it now."
463
488
  kill -9 $SOLR_PID
464
489
  echo "Killed process $SOLR_PID"
465
- rm -f $SOLR_PID_DIR/solr-$SOLR_PORT.pid
490
+ rm -f "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
466
491
  sleep 1
467
492
  fi
468
493
 
469
- CHECK_PID=`ps auxww | awk '{print $2}' | grep $SOLR_PID | sort -r | tr -d ' '`
494
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $SOLR_PID | sort -r | tr -d ' '`
470
495
  if [ "$CHECK_PID" != "" ]; then
471
496
  echo "ERROR: Failed to kill previous Solr Java process $SOLR_PID ... script fails."
472
497
  exit 1
@@ -492,7 +517,7 @@ if [ $# -gt 0 ]; then
492
517
  if [[ $1 == -* ]]; then
493
518
  SCRIPT_CMD="start"
494
519
  else
495
- SCRIPT_CMD=$1
520
+ SCRIPT_CMD="$1"
496
521
  shift
497
522
  fi
498
523
  else
@@ -513,13 +538,13 @@ if [ "$SCRIPT_CMD" == "healthcheck" ]; then
513
538
 
514
539
  if [ $# -gt 0 ]; then
515
540
  while true; do
516
- case $1 in
541
+ case "$1" in
517
542
  -c|-collection)
518
543
  if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
519
544
  print_usage "$SCRIPT_CMD" "Collection name is required when using the $1 option!"
520
545
  exit 1
521
546
  fi
522
- HEALTHCHECK_COLLECTION=$2
547
+ HEALTHCHECK_COLLECTION="$2"
523
548
  shift 2
524
549
  ;;
525
550
  -z|-zkhost)
@@ -560,7 +585,7 @@ if [ "$SCRIPT_CMD" == "healthcheck" ]; then
560
585
  exit 1
561
586
  fi
562
587
 
563
- run_tool healthcheck -zkHost $ZK_HOST -collection $HEALTHCHECK_COLLECTION
588
+ run_tool healthcheck -zkHost "$ZK_HOST" -collection "$HEALTHCHECK_COLLECTION"
564
589
 
565
590
  exit $?
566
591
  fi
@@ -573,13 +598,13 @@ if [[ "$SCRIPT_CMD" == "create" || "$SCRIPT_CMD" == "create_core" || "$SCRIPT_CM
573
598
 
574
599
  if [ $# -gt 0 ]; then
575
600
  while true; do
576
- case $1 in
601
+ case "$1" in
577
602
  -c|-core|-collection)
578
603
  if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
579
604
  print_usage "$SCRIPT_CMD" "name is required when using the $1 option!"
580
605
  exit 1
581
606
  fi
582
- CREATE_NAME=$2
607
+ CREATE_NAME="$2"
583
608
  shift 2
584
609
  ;;
585
610
  -n|-confname)
@@ -643,7 +668,7 @@ if [[ "$SCRIPT_CMD" == "create" || "$SCRIPT_CMD" == "create_core" || "$SCRIPT_CM
643
668
  fi
644
669
 
645
670
  if [ -z "$CREATE_CONFDIR" ]; then
646
- CREATE_CONFDIR=data_driven_schema_configs
671
+ CREATE_CONFDIR='data_driven_schema_configs'
647
672
  fi
648
673
 
649
674
  # validate the confdir arg
@@ -660,11 +685,11 @@ if [[ "$SCRIPT_CMD" == "create" || "$SCRIPT_CMD" == "create_core" || "$SCRIPT_CM
660
685
 
661
686
  # If not defined, use the collection name for the name of the configuration in ZooKeeper
662
687
  if [ -z "$CREATE_CONFNAME" ]; then
663
- CREATE_CONFNAME=$CREATE_NAME
688
+ CREATE_CONFNAME="$CREATE_NAME"
664
689
  fi
665
690
 
666
691
  if [ -z "$CREATE_PORT" ]; then
667
- for ID in `ps auxww | grep java | grep start.jar | awk '{print $2}' | sort -r`
692
+ for ID in `ps auxww | grep java | grep start\.jar | awk '{print $2}' | sort -r`
668
693
  do
669
694
  port=`jetty_port "$ID"`
670
695
  if [ "$port" != "" ]; then
@@ -680,14 +705,14 @@ if [[ "$SCRIPT_CMD" == "create" || "$SCRIPT_CMD" == "create_core" || "$SCRIPT_CM
680
705
  fi
681
706
 
682
707
  if [ "$SCRIPT_CMD" == "create_core" ]; then
683
- run_tool create_core -name $CREATE_NAME -solrUrl $SOLR_URL_SCHEME://localhost:$CREATE_PORT/solr \
684
- -confdir $CREATE_CONFDIR -configsetsDir $SOLR_TIP/server/solr/configsets
708
+ run_tool create_core -name "$CREATE_NAME" -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$CREATE_PORT/solr" \
709
+ -confdir "$CREATE_CONFDIR" -configsetsDir "$SOLR_TIP/server/solr/configsets"
685
710
  exit $?
686
711
  else
687
- run_tool $SCRIPT_CMD -name $CREATE_NAME -shards $CREATE_NUM_SHARDS -replicationFactor $CREATE_REPFACT \
688
- -confname $CREATE_CONFNAME -confdir $CREATE_CONFDIR \
689
- -configsetsDir $SOLR_TIP/server/solr/configsets \
690
- -solrUrl $SOLR_URL_SCHEME://localhost:$CREATE_PORT/solr
712
+ run_tool "$SCRIPT_CMD" -name "$CREATE_NAME" -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$CREATE_PORT/solr" \
713
+ -shards "$CREATE_NUM_SHARDS" -replicationFactor "$CREATE_REPFACT" \
714
+ -confname "$CREATE_CONFNAME" -confdir "$CREATE_CONFDIR" \
715
+ -configsetsDir "$SOLR_TIP/server/solr/configsets"
691
716
  exit $?
692
717
  fi
693
718
  fi
@@ -697,13 +722,13 @@ if [[ "$SCRIPT_CMD" == "delete" ]]; then
697
722
 
698
723
  if [ $# -gt 0 ]; then
699
724
  while true; do
700
- case $1 in
725
+ case "$1" in
701
726
  -c|-core|-collection)
702
727
  if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
703
728
  print_usage "$SCRIPT_CMD" "name is required when using the $1 option!"
704
729
  exit 1
705
730
  fi
706
- DELETE_NAME=$2
731
+ DELETE_NAME="$2"
707
732
  shift 2
708
733
  ;;
709
734
  -p|-port)
@@ -754,7 +779,7 @@ if [[ "$SCRIPT_CMD" == "delete" ]]; then
754
779
  fi
755
780
 
756
781
  if [ -z "$DELETE_PORT" ]; then
757
- for ID in `ps auxww | grep java | grep start.jar | awk '{print $2}' | sort -r`
782
+ for ID in `ps auxww | grep java | grep start\.jar | awk '{print $2}' | sort -r`
758
783
  do
759
784
  port=`jetty_port "$ID"`
760
785
  if [ "$port" != "" ]; then
@@ -769,8 +794,8 @@ if [[ "$SCRIPT_CMD" == "delete" ]]; then
769
794
  exit 1
770
795
  fi
771
796
 
772
- run_tool delete -name $DELETE_NAME -deleteConfig $DELETE_CONFIG \
773
- -solrUrl $SOLR_URL_SCHEME://localhost:$DELETE_PORT/solr
797
+ run_tool delete -name "$DELETE_NAME" -deleteConfig "$DELETE_CONFIG" \
798
+ -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$DELETE_PORT/solr"
774
799
  exit $?
775
800
  fi
776
801
 
@@ -783,12 +808,15 @@ fi
783
808
  # Run in foreground (default is to run in the background)
784
809
  FG="false"
785
810
  noprompt=false
811
+ SOLR_OPTS=($SOLR_OPTS)
812
+ PASS_TO_RUN_EXAMPLE=
786
813
 
787
814
  if [ $# -gt 0 ]; then
788
815
  while true; do
789
- case $1 in
816
+ case "$1" in
790
817
  -c|-cloud)
791
818
  SOLR_MODE="solrcloud"
819
+ PASS_TO_RUN_EXAMPLE+=" -c"
792
820
  shift
793
821
  ;;
794
822
  -d|-dir)
@@ -798,17 +826,17 @@ if [ $# -gt 0 ]; then
798
826
  fi
799
827
 
800
828
  if [[ "$2" == "." || "$2" == "./" || "$2" == ".." || "$2" == "../" ]]; then
801
- SOLR_SERVER_DIR=`pwd`/$2
829
+ SOLR_SERVER_DIR="$(pwd)/$2"
802
830
  else
803
831
  # see if the arg value is relative to the tip vs full path
804
- if [[ $2 != /* ]] && [[ -d "$SOLR_TIP/$2" ]]; then
832
+ if [[ "$2" != /* ]] && [[ -d "$SOLR_TIP/$2" ]]; then
805
833
  SOLR_SERVER_DIR="$SOLR_TIP/$2"
806
834
  else
807
835
  SOLR_SERVER_DIR="$2"
808
836
  fi
809
837
  fi
810
838
  # resolve it to an absolute path
811
- SOLR_SERVER_DIR=`cd "$SOLR_SERVER_DIR"; pwd`
839
+ SOLR_SERVER_DIR="$(cd "$SOLR_SERVER_DIR"; pwd)"
812
840
  shift 2
813
841
  ;;
814
842
  -s|-solr.home)
@@ -838,6 +866,7 @@ if [ $# -gt 0 ]; then
838
866
  exit 1
839
867
  fi
840
868
  SOLR_HOST="$2"
869
+ PASS_TO_RUN_EXAMPLE+=" -h $SOLR_HOST"
841
870
  shift 2
842
871
  ;;
843
872
  -m|-memory)
@@ -846,6 +875,7 @@ if [ $# -gt 0 ]; then
846
875
  exit 1
847
876
  fi
848
877
  SOLR_HEAP="$2"
878
+ PASS_TO_RUN_EXAMPLE+=" -m $SOLR_HEAP"
849
879
  shift 2
850
880
  ;;
851
881
  -p|-port)
@@ -854,6 +884,7 @@ if [ $# -gt 0 ]; then
854
884
  exit 1
855
885
  fi
856
886
  SOLR_PORT="$2"
887
+ PASS_TO_RUN_EXAMPLE+=" -p $SOLR_PORT"
857
888
  shift 2
858
889
  ;;
859
890
  -z|-zkhost)
@@ -863,10 +894,12 @@ if [ $# -gt 0 ]; then
863
894
  fi
864
895
  ZK_HOST="$2"
865
896
  SOLR_MODE="solrcloud"
897
+ PASS_TO_RUN_EXAMPLE+=" -z $ZK_HOST"
866
898
  shift 2
867
899
  ;;
868
900
  -a|-addlopts)
869
901
  ADDITIONAL_CMD_OPTS="$2"
902
+ PASS_TO_RUN_EXAMPLE+=" -a \"$ADDITIONAL_CMD_OPTS\""
870
903
  shift 2
871
904
  ;;
872
905
  -k|-key)
@@ -879,10 +912,12 @@ if [ $# -gt 0 ]; then
879
912
  ;;
880
913
  -noprompt)
881
914
  noprompt=true
915
+ PASS_TO_RUN_EXAMPLE+=" -noprompt"
882
916
  shift
883
917
  ;;
884
918
  -V|-verbose)
885
919
  verbose=true
920
+ PASS_TO_RUN_EXAMPLE+=" --verbose"
886
921
  shift
887
922
  ;;
888
923
  -all)
@@ -896,7 +931,8 @@ if [ $# -gt 0 ]; then
896
931
  *)
897
932
  if [ "${1:0:2}" == "-D" ]; then
898
933
  # pass thru any opts that begin with -D (java system props)
899
- SOLR_OPTS="$SOLR_OPTS $1"
934
+ SOLR_OPTS+=("$1")
935
+ PASS_TO_RUN_EXAMPLE+=" $1"
900
936
  shift
901
937
  else
902
938
  if [ "$1" != "" ]; then
@@ -911,20 +947,8 @@ if [ $# -gt 0 ]; then
911
947
  done
912
948
  fi
913
949
 
914
- if $verbose ; then
915
- echo "Using Solr root directory: $SOLR_TIP"
916
- echo "Using Java: $JAVA"
917
- $JAVA -version
918
- fi
919
-
920
- if [ "$SOLR_HOST" != "" ]; then
921
- SOLR_HOST_ARG="-Dhost=$SOLR_HOST"
922
- else
923
- SOLR_HOST_ARG=""
924
- fi
925
-
926
950
  if [ -z "$SOLR_SERVER_DIR" ]; then
927
- SOLR_SERVER_DIR=$DEFAULT_SERVER_DIR
951
+ SOLR_SERVER_DIR="$DEFAULT_SERVER_DIR"
928
952
  fi
929
953
 
930
954
  if [ ! -e "$SOLR_SERVER_DIR" ]; then
@@ -932,157 +956,65 @@ if [ ! -e "$SOLR_SERVER_DIR" ]; then
932
956
  exit 1
933
957
  fi
934
958
 
935
- CLOUD_NUM_NODES=2
936
- declare -a CLOUD_PORTS=('8983' '7574' '8984' '7575');
937
-
938
- # select solr.solr.home based on the desired example
939
- if [ "$EXAMPLE" != "" ]; then
940
- case $EXAMPLE in
941
- cloud)
942
- #
943
- # Engage in an interactive session with user to setup the SolrCloud example
944
- #
945
- echo -e "\nWelcome to the SolrCloud example!\n\n"
946
- if $noprompt ; then
947
- CLOUD_NUM_NODES=2
948
- echo -e "Starting up $CLOUD_NUM_NODES Solr nodes for your example SolrCloud cluster."
949
- else
950
- echo -e "This interactive session will help you launch a SolrCloud cluster on your local workstation.\n"
951
- read -e -p "To begin, how many Solr nodes would you like to run in your local cluster? (specify 1-4 nodes) [2] " USER_INPUT
952
- while true
953
- do
954
- CLOUD_NUM_NODES=`echo $USER_INPUT | tr -d ' '`
955
- if [ -z "$CLOUD_NUM_NODES" ]; then
956
- CLOUD_NUM_NODES=2
957
- fi
958
- if [[ $CLOUD_NUM_NODES > 4 || $CLOUD_NUM_NODES < 1 ]]; then
959
- read -e -p "Please provide a node count between 1 and 4 [2] " USER_INPUT
960
- else
961
- break;
962
- fi
963
- done
964
-
965
- echo -e "Ok, let's start up $CLOUD_NUM_NODES Solr nodes for your example SolrCloud cluster.\n"
966
- for (( s=0; s<$CLOUD_NUM_NODES; s++ ))
967
- do
968
- read -e -p "Please enter the port for node$[$s+1] [${CLOUD_PORTS[$s]}] " USER_INPUT
969
- while true
970
- do
971
- # trim whitespace out of the user input
972
- CLOUD_PORT=`echo $USER_INPUT | tr -d ' '`
973
-
974
- # handle the default selection or empty input
975
- if [ -z "$CLOUD_PORT" ]; then
976
- CLOUD_PORT=${CLOUD_PORTS[$s]}
977
- fi
978
-
979
- # check to see if something is already bound to that port
980
- if hash lsof 2>/dev/null ; then # hash returns true if lsof is on the path
981
- PORT_IN_USE=`lsof -Pni:$CLOUD_PORT`
982
- if [ "$PORT_IN_USE" != "" ]; then
983
- read -e -p "Oops! Looks like port $CLOUD_PORT is already being used by another process. Please choose a different port. " USER_INPUT
984
- else
985
- CLOUD_PORTS[$s]=$CLOUD_PORT
986
- echo $CLOUD_PORT
987
- break;
988
- fi
989
- else
990
- CLOUD_PORTS[$s]=$CLOUD_PORT
991
- echo $CLOUD_PORT
992
- break;
993
- fi
994
- done
995
- done
996
- fi
997
-
998
- # setup a unqiue solr.solr.home directory for each node
999
- CLOUD_EXAMPLE_DIR=$SOLR_TIP/example/cloud
1000
- if [ ! -d "$CLOUD_EXAMPLE_DIR/node1/solr" ]; then
1001
- echo "Creating Solr home directory $CLOUD_EXAMPLE_DIR/node1/solr"
1002
- mkdir -p $CLOUD_EXAMPLE_DIR/node1/solr
1003
- cp $DEFAULT_SERVER_DIR/solr/solr.xml $CLOUD_EXAMPLE_DIR/node1/solr/
1004
- cp $DEFAULT_SERVER_DIR/solr/zoo.cfg $CLOUD_EXAMPLE_DIR/node1/solr/
1005
- fi
959
+ if [[ "$FG" == 'true' && "$EXAMPLE" != "" ]]; then
960
+ FG='false'
961
+ echo -e "\nWARNING: Foreground mode (-f) not supported when running examples.\n"
962
+ fi
1006
963
 
1007
- for (( s=1; s<$CLOUD_NUM_NODES; s++ ))
1008
- do
1009
- ndx=$[$s+1]
1010
- if [ ! -d "$CLOUD_EXAMPLE_DIR/node$ndx" ]; then
1011
- echo "Cloning Solr home directory $CLOUD_EXAMPLE_DIR/node1 into $CLOUD_EXAMPLE_DIR/node$ndx"
1012
- cp -r $CLOUD_EXAMPLE_DIR/node1 $CLOUD_EXAMPLE_DIR/node$ndx
1013
- fi
1014
- done
1015
- SOLR_MODE="solrcloud"
1016
- SOLR_SERVER_DIR="$SOLR_TIP/server"
1017
- SOLR_HOME="$CLOUD_EXAMPLE_DIR/node1/solr"
1018
- SOLR_PORT=${CLOUD_PORTS[0]}
1019
- shift
1020
- ;;
1021
- techproducts)
1022
- SOLR_HOME="$SOLR_TIP/example/techproducts/solr"
1023
- mkdir -p $SOLR_HOME
1024
- if [ ! -f "$SOLR_HOME/solr.xml" ]; then
1025
- cp $DEFAULT_SERVER_DIR/solr/solr.xml $SOLR_HOME/solr.xml
1026
- cp $DEFAULT_SERVER_DIR/solr/zoo.cfg $SOLR_HOME/zoo.cfg
1027
- fi
1028
- EXAMPLE_CONFIGSET=sample_techproducts_configs
1029
- shift
1030
- ;;
1031
- dih)
1032
- SOLR_HOME="$SOLR_TIP/example/example-DIH/solr"
1033
- shift
1034
- ;;
1035
- schemaless)
1036
- SOLR_HOME="$SOLR_TIP/example/schemaless/solr"
1037
- mkdir -p $SOLR_HOME
1038
- if [ ! -f "$SOLR_HOME/solr.xml" ]; then
1039
- cp $DEFAULT_SERVER_DIR/solr/solr.xml $SOLR_HOME/solr.xml
1040
- cp $DEFAULT_SERVER_DIR/solr/zoo.cfg $SOLR_HOME/zoo.cfg
1041
- fi
1042
- EXAMPLE_CONFIGSET=data_driven_schema_configs
1043
- shift
1044
- ;;
1045
- *)
1046
- print_usage "start" "Unsupported example $EXAMPLE! Please choose one of: cloud, dih, schemaless, or techproducts"
1047
- exit 1
1048
- ;;
1049
- esac
964
+ #
965
+ # If the user specified an example to run, invoke the run_example tool (Java app) and exit
966
+ # otherwise let this script proceed to process the user request
967
+ #
968
+ if [ -n "$EXAMPLE" ] && [ "$SCRIPT_CMD" == "start" ]; then
969
+ run_tool run_example -e $EXAMPLE -d "$SOLR_SERVER_DIR" -urlScheme $SOLR_URL_SCHEME $PASS_TO_RUN_EXAMPLE
970
+ exit $?
1050
971
  fi
1051
972
 
1052
- if [[ "$FG" == "true" && "$EXAMPLE" != "" ]]; then
1053
- FG="false"
1054
- echo -e "\nWARNING: Foreground mode (-f) not supported when running examples.\n"
973
+ ############# start/stop logic below here ################
974
+
975
+ if $verbose ; then
976
+ echo "Using Solr root directory: $SOLR_TIP"
977
+ echo "Using Java: $JAVA"
978
+ "$JAVA" -version
979
+ fi
980
+
981
+ if [ "$SOLR_HOST" != "" ]; then
982
+ SOLR_HOST_ARG=("-Dhost=$SOLR_HOST")
983
+ else
984
+ SOLR_HOST_ARG=()
1055
985
  fi
1056
986
 
1057
987
  if [ -z "$STOP_KEY" ]; then
1058
- STOP_KEY="solrrocks"
988
+ STOP_KEY='solrrocks'
1059
989
  fi
1060
990
 
1061
991
  # stop all if no port specified
1062
992
  if [[ "$SCRIPT_CMD" == "stop" && -z "$SOLR_PORT" ]]; then
1063
993
  if $stop_all; then
1064
994
  none_stopped=true
1065
- for PIDF in `find $SOLR_PID_DIR -name "solr-*.pid" -type f`
995
+ find "$SOLR_PID_DIR" -name "solr-*.pid" -type f | while read PIDF
1066
996
  do
1067
- NEXT_PID=`cat $PIDF`
997
+ NEXT_PID=`cat "$PIDF"`
1068
998
  port=`jetty_port "$NEXT_PID"`
1069
999
  if [ "$port" != "" ]; then
1070
1000
  stop_solr "$SOLR_SERVER_DIR" "$port" "$STOP_KEY" "$NEXT_PID"
1071
1001
  none_stopped=false
1072
1002
  fi
1073
- rm -f $PIDF
1003
+ rm -f "$PIDF"
1074
1004
  done
1075
- if $none_stopped; then
1076
- echo -e "\nNo Solr nodes found to stop.\n"
1077
- fi
1005
+ # TODO: none_stopped doesn't get reflected across the subshell
1006
+ # This can be uncommented once we find a clean way out of it
1007
+ # if $none_stopped; then
1008
+ # echo -e "\nNo Solr nodes found to stop.\n"
1009
+ # fi
1078
1010
  else
1079
1011
  # not stopping all and don't have a port, but if we can find the pid file for the default port 8983, then use that
1080
1012
  none_stopped=true
1081
- numSolrs=`find $SOLR_PID_DIR -name "solr-*.pid" -type f | wc -l | tr -d ' '`
1013
+ numSolrs=`find "$SOLR_PID_DIR" -name "solr-*.pid" -type f | wc -l | tr -d ' '`
1082
1014
  if [ $numSolrs -eq 1 ]; then
1083
1015
  # only do this if there is only 1 node running, otherwise they must provide the -p or -all
1084
- PID=`find $SOLR_PID_DIR -name "solr-*.pid" -type f -exec cat {} \;`
1085
- CHECK_PID=`ps auxww | awk '{print $2}' | grep $PID | sort -r | tr -d ' '`
1016
+ PID="$(cat "$(find "$SOLR_PID_DIR" -name "solr-*.pid" -type f)")"
1017
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $PID | sort -r | tr -d ' '`
1086
1018
  if [ "$CHECK_PID" != "" ]; then
1087
1019
  port=`jetty_port "$CHECK_PID"`
1088
1020
  if [ "$port" != "" ]; then
@@ -1105,7 +1037,7 @@ if [[ "$SCRIPT_CMD" == "stop" && -z "$SOLR_PORT" ]]; then
1105
1037
  fi
1106
1038
 
1107
1039
  if [ -z "$SOLR_PORT" ]; then
1108
- SOLR_PORT="8983"
1040
+ SOLR_PORT=8983
1109
1041
  fi
1110
1042
 
1111
1043
  if [ -z "$STOP_PORT" ]; then
@@ -1115,10 +1047,12 @@ fi
1115
1047
  if [[ "$SCRIPT_CMD" == "start" ]]; then
1116
1048
  # see if Solr is already running
1117
1049
  SOLR_PID=`solr_pid_by_port "$SOLR_PORT"`
1050
+
1118
1051
  if [ -z "$SOLR_PID" ]; then
1119
1052
  # not found using the pid file ... but use ps to ensure not found
1120
- SOLR_PID=`ps auxww | grep start.jar | grep $SOLR_PORT | grep -v grep | awk '{print $2}' | sort -r`
1053
+ SOLR_PID=`ps auxww | grep start\.jar | grep -w $SOLR_PORT | grep -v grep | awk '{print $2}' | sort -r`
1121
1054
  fi
1055
+
1122
1056
  if [ "$SOLR_PID" != "" ]; then
1123
1057
  echo -e "\nPort $SOLR_PORT is already being used by another process (pid: $SOLR_PID)\nPlease choose a different port using the -p option.\n"
1124
1058
  exit 1
@@ -1129,7 +1063,7 @@ else
1129
1063
  SOLR_PID=`solr_pid_by_port "$SOLR_PORT"`
1130
1064
  if [ -z "$SOLR_PID" ]; then
1131
1065
  # not found using the pid file ... but use ps to ensure not found
1132
- SOLR_PID=`ps auxww | grep start.jar | grep $SOLR_PORT | grep -v grep | awk '{print $2}' | sort -r`
1066
+ SOLR_PID=`ps auxww | grep start\.jar | grep -w $SOLR_PORT | grep -v grep | awk '{print $2}' | sort -r`
1133
1067
  fi
1134
1068
  if [ "$SOLR_PID" != "" ]; then
1135
1069
  stop_solr "$SOLR_SERVER_DIR" "$SOLR_PORT" "$STOP_KEY" "$SOLR_PID"
@@ -1146,25 +1080,26 @@ if [ -z "$SOLR_HOME" ]; then
1146
1080
  else
1147
1081
  if [[ $SOLR_HOME != /* ]] && [[ -d "$SOLR_SERVER_DIR/$SOLR_HOME" ]]; then
1148
1082
  SOLR_HOME="$SOLR_SERVER_DIR/$SOLR_HOME"
1149
- SOLR_PID_DIR=$SOLR_HOME
1083
+ SOLR_PID_DIR="$SOLR_HOME"
1150
1084
  elif [[ $SOLR_HOME != /* ]] && [[ -d "`pwd`/$SOLR_HOME" ]]; then
1151
- SOLR_HOME="`pwd`/$SOLR_HOME"
1085
+ SOLR_HOME="$(pwd)/$SOLR_HOME"
1152
1086
  fi
1153
1087
  fi
1154
1088
 
1155
1089
  # This is quite hacky, but examples rely on a different log4j.properties
1156
1090
  # so that we can write logs for examples to $SOLR_HOME/../logs
1157
1091
  if [ -z "$SOLR_LOGS_DIR" ]; then
1158
- SOLR_LOGS_DIR=$SOLR_SERVER_DIR/logs
1092
+ SOLR_LOGS_DIR="$SOLR_SERVER_DIR/logs"
1159
1093
  fi
1160
- EXAMPLE_DIR=$SOLR_TIP/example
1161
- if [ "${SOLR_HOME:0:${#EXAMPLE_DIR}}" = $EXAMPLE_DIR ]; then
1162
- LOG4J_PROPS=$EXAMPLE_DIR/resources/log4j.properties
1163
- SOLR_LOGS_DIR=$SOLR_HOME/../logs
1094
+ EXAMPLE_DIR="$SOLR_TIP/example"
1095
+ if [ "${SOLR_HOME:0:${#EXAMPLE_DIR}}" = "$EXAMPLE_DIR" ]; then
1096
+ LOG4J_PROPS="$EXAMPLE_DIR/resources/log4j.properties"
1097
+ SOLR_LOGS_DIR="$SOLR_HOME/../logs"
1164
1098
  fi
1165
1099
 
1100
+ LOG4J_CONFIG=()
1166
1101
  if [ -n "$LOG4J_PROPS" ]; then
1167
- LOG4J_CONFIG="-Dlog4j.configuration=file:$LOG4J_PROPS"
1102
+ LOG4J_CONFIG+=("-Dlog4j.configuration=file:$LOG4J_PROPS")
1168
1103
  fi
1169
1104
 
1170
1105
  if [ "$SCRIPT_CMD" == "stop" ]; then
@@ -1178,87 +1113,106 @@ if [ ! -e "$SOLR_HOME" ]; then
1178
1113
  echo -e "\nSolr home directory $SOLR_HOME not found!\n"
1179
1114
  exit 1
1180
1115
  fi
1181
- if [ ! -e "$SOLR_HOME/solr.xml" ]; then
1182
- echo -e "\nSolr home directory $SOLR_HOME must contain a solr.xml file!\n"
1183
- exit 1
1184
- fi
1185
1116
 
1186
1117
  # backup the log files before starting
1187
- if [ -f $SOLR_LOGS_DIR/solr.log ]; then
1118
+ if [ -f "$SOLR_LOGS_DIR/solr.log" ]; then
1188
1119
  if $verbose ; then
1189
1120
  echo "Backing up $SOLR_LOGS_DIR/solr.log"
1190
1121
  fi
1191
- mv $SOLR_LOGS_DIR/solr.log $SOLR_LOGS_DIR/solr_log_`date +"%Y%m%d_%H%M"`
1122
+ mv "$SOLR_LOGS_DIR/solr.log" "$SOLR_LOGS_DIR/solr_log_$(date +"%Y%m%d_%H%M")"
1192
1123
  fi
1193
1124
 
1194
- if [ -f $SOLR_LOGS_DIR/solr_gc.log ]; then
1125
+ if [ -f "$SOLR_LOGS_DIR/solr_gc.log" ]; then
1195
1126
  if $verbose ; then
1196
1127
  echo "Backing up $SOLR_LOGS_DIR/solr_gc.log"
1197
1128
  fi
1198
- mv $SOLR_LOGS_DIR/solr_gc.log $SOLR_LOGS_DIR/solr_gc_log_`date +"%Y%m%d_%H%M"`
1129
+ mv "$SOLR_LOGS_DIR/solr_gc.log" "$SOLR_LOGS_DIR/solr_gc_log_$(date +"%Y%m%d_%H%M")"
1130
+ fi
1131
+
1132
+ java_ver_out=`echo "$("$JAVA" -version 2>&1)"`
1133
+ JAVA_VERSION=`echo $java_ver_out | grep "java version" | awk '{ print substr($3, 2, length($3)-2); }'`
1134
+ JAVA_VENDOR="Oracle"
1135
+ if [ "`echo $java_ver_out | grep -i "IBM J9"`" != "" ]; then
1136
+ JAVA_VENDOR="IBM J9"
1199
1137
  fi
1200
1138
 
1201
1139
  # if verbose gc logging enabled, setup the location of the log file
1202
1140
  if [ "$GC_LOG_OPTS" != "" ]; then
1203
- GC_LOG_OPTS="$GC_LOG_OPTS -Xloggc:$SOLR_LOGS_DIR/solr_gc.log"
1141
+ gc_log_flag="-Xloggc"
1142
+ if [ "$JAVA_VENDOR" == "IBM J9" ]; then
1143
+ gc_log_flag="-Xverbosegclog"
1144
+ fi
1145
+ GC_LOG_OPTS=($GC_LOG_OPTS "$gc_log_flag:$SOLR_LOGS_DIR/solr_gc.log")
1146
+ else
1147
+ GC_LOG_OPTS=()
1148
+ fi
1149
+
1150
+ # If ZK_HOST is defined, the assume SolrCloud mode
1151
+ if [[ -n "$ZK_HOST" ]]; then
1152
+ SOLR_MODE="solrcloud"
1204
1153
  fi
1205
1154
 
1206
- if [ "$SOLR_MODE" == "solrcloud" ]; then
1155
+ if [ "$SOLR_MODE" == 'solrcloud' ]; then
1207
1156
  if [ -z "$ZK_CLIENT_TIMEOUT" ]; then
1208
1157
  ZK_CLIENT_TIMEOUT="15000"
1209
1158
  fi
1210
1159
 
1211
- CLOUD_MODE_OPTS="-DzkClientTimeout=$ZK_CLIENT_TIMEOUT"
1160
+ CLOUD_MODE_OPTS=("-DzkClientTimeout=$ZK_CLIENT_TIMEOUT")
1212
1161
 
1213
1162
  if [ "$ZK_HOST" != "" ]; then
1214
- CLOUD_MODE_OPTS="$CLOUD_MODE_OPTS -DzkHost=$ZK_HOST"
1163
+ CLOUD_MODE_OPTS+=("-DzkHost=$ZK_HOST")
1215
1164
  else
1216
1165
  if $verbose ; then
1217
1166
  echo "Configuring SolrCloud to launch an embedded ZooKeeper using -DzkRun"
1218
1167
  fi
1219
1168
 
1220
- CLOUD_MODE_OPTS="$CLOUD_MODE_OPTS -DzkRun"
1169
+ CLOUD_MODE_OPTS+=('-DzkRun')
1221
1170
  fi
1222
1171
 
1223
1172
  # and if collection1 needs to be bootstrapped
1224
1173
  if [ -e "$SOLR_HOME/collection1/core.properties" ]; then
1225
- CLOUD_MODE_OPTS="$CLOUD_MODE_OPTS -Dbootstrap_confdir=./solr/collection1/conf -Dcollection.configName=myconf -DnumShards=1"
1174
+ CLOUD_MODE_OPTS+=('-Dbootstrap_confdir=./solr/collection1/conf' '-Dcollection.configName=myconf' '-DnumShards=1')
1226
1175
  fi
1227
1176
 
1177
+ else
1178
+ if [ ! -e "$SOLR_HOME/solr.xml" ]; then
1179
+ echo -e "\nSolr home directory $SOLR_HOME must contain a solr.xml file!\n"
1180
+ exit 1
1181
+ fi
1228
1182
  fi
1229
1183
 
1230
1184
  # These are useful for attaching remote profilers like VisualVM/JConsole
1231
1185
  if [ "$ENABLE_REMOTE_JMX_OPTS" == "true" ]; then
1232
1186
 
1233
1187
  if [ -z "$RMI_PORT" ]; then
1234
- RMI_PORT=1$SOLR_PORT
1188
+ RMI_PORT="1$SOLR_PORT"
1235
1189
  fi
1236
1190
 
1237
- REMOTE_JMX_OPTS="-Dcom.sun.management.jmxremote \
1238
- -Dcom.sun.management.jmxremote.local.only=false \
1239
- -Dcom.sun.management.jmxremote.ssl=false \
1240
- -Dcom.sun.management.jmxremote.authenticate=false \
1241
- -Dcom.sun.management.jmxremote.port=$RMI_PORT \
1242
- -Dcom.sun.management.jmxremote.rmi.port=$RMI_PORT"
1191
+ REMOTE_JMX_OPTS=('-Dcom.sun.management.jmxremote' \
1192
+ '-Dcom.sun.management.jmxremote.local.only=false' \
1193
+ '-Dcom.sun.management.jmxremote.ssl=false' \
1194
+ '-Dcom.sun.management.jmxremote.authenticate=false' \
1195
+ "-Dcom.sun.management.jmxremote.port=$RMI_PORT" \
1196
+ "-Dcom.sun.management.jmxremote.rmi.port=$RMI_PORT")
1243
1197
 
1244
1198
  # if the host is set, then set that as the rmi server hostname
1245
1199
  if [ "$SOLR_HOST" != "" ]; then
1246
- REMOTE_JMX_OPTS="$REMOTE_JMX_OPTS -Djava.rmi.server.hostname=$SOLR_HOST"
1200
+ REMOTE_JMX_OPTS+=("-Djava.rmi.server.hostname=$SOLR_HOST")
1247
1201
  fi
1248
1202
  else
1249
- REMOTE_JMX_OPTS=""
1203
+ REMOTE_JMX_OPTS=()
1250
1204
  fi
1251
1205
 
1252
- if [ "$SOLR_HEAP" != "" ]; then
1253
- SOLR_JAVA_MEM="-Xms$SOLR_HEAP -Xmx$SOLR_HEAP"
1254
- fi
1255
-
1256
- if [ -z "$SOLR_JAVA_MEM" ]; then
1257
- SOLR_JAVA_MEM="-Xms512m -Xmx512m"
1206
+ JAVA_MEM_OPTS=()
1207
+ if [ -z "$SOLR_HEAP" ] && [ -n "$SOLR_JAVA_MEM" ]; then
1208
+ JAVA_MEM_OPTS=($SOLR_JAVA_MEM)
1209
+ else
1210
+ SOLR_HEAP="${SOLR_HEAP:-512m}"
1211
+ JAVA_MEM_OPTS=("-Xms$SOLR_HEAP" "-Xmx$SOLR_HEAP")
1258
1212
  fi
1259
1213
 
1260
1214
  if [ -z "$SOLR_TIMEZONE" ]; then
1261
- SOLR_TIMEZONE="UTC"
1215
+ SOLR_TIMEZONE='UTC'
1262
1216
  fi
1263
1217
 
1264
1218
  # Launches Solr in foreground/background depending on parameters
@@ -1269,26 +1223,30 @@ function launch_solr() {
1269
1223
 
1270
1224
  SOLR_ADDL_ARGS="$2"
1271
1225
 
1226
+ GC_TUNE=($GC_TUNE)
1272
1227
  # deal with Java version specific GC and other flags
1273
- JAVA_VERSION=`echo "$($JAVA -version 2>&1)" | grep "java version" | awk '{ print substr($3, 2, length($3)-2); }'`
1274
1228
  if [ "${JAVA_VERSION:0:3}" == "1.7" ]; then
1275
1229
  # Specific Java version hacking
1276
- GC_TUNE="$GC_TUNE -XX:CMSFullGCsBeforeCompaction=1 -XX:CMSTriggerPermRatio=80"
1277
- JAVA_MINOR_VERSION=${JAVA_VERSION:(-2)}
1278
- if [[ $JAVA_MINOR_VERSION -ge 40 && $JAVA_MINOR_VERSION -le 51 ]]; then
1279
- GC_TUNE="$GC_TUNE -XX:-UseSuperWord"
1280
- echo -e "\nWARNING: Java version $JAVA_VERSION has known bugs with Lucene and requires the -XX:-UseSuperWord flag. Please consider upgrading your JVM.\n"
1230
+ GC_TUNE+=('-XX:CMSFullGCsBeforeCompaction=1' '-XX:CMSTriggerPermRatio=80')
1231
+ if [ "$JAVA_VENDOR" != "IBM J9" ]; then
1232
+ JAVA_MINOR_VERSION=${JAVA_VERSION:(-2)}
1233
+ if [[ $JAVA_MINOR_VERSION -ge 40 && $JAVA_MINOR_VERSION -le 51 ]]; then
1234
+ GC_TUNE+=('-XX:-UseSuperWord')
1235
+ echo -e "\nWARNING: Java version $JAVA_VERSION has known bugs with Lucene and requires the -XX:-UseSuperWord flag. Please consider upgrading your JVM.\n"
1236
+ fi
1281
1237
  fi
1282
1238
  fi
1283
1239
 
1284
1240
  # If SSL-related system props are set, add them to SOLR_OPTS
1285
1241
  if [ -n "$SOLR_SSL_OPTS" ]; then
1286
- # If using SSL and jetty.ssl.port not set explicitly, use the jetty.port
1287
- SSL_PORT_PROP="-Djetty.ssl.port=$SOLR_PORT"
1288
- if [ -n "$SOLR_SSL_PORT" ]; then
1289
- SSL_PORT_PROP="-Djetty.ssl.port=$SOLR_SSL_PORT"
1290
- fi
1291
- SOLR_OPTS="$SOLR_OPTS $SOLR_SSL_OPTS $SSL_PORT_PROP"
1242
+ # If using SSL and solr.jetty.https.port not set explicitly, use the jetty.port
1243
+ SSL_PORT_PROP="-Dsolr.jetty.https.port=$SOLR_PORT"
1244
+ SOLR_OPTS+=($SOLR_SSL_OPTS "$SSL_PORT_PROP")
1245
+ fi
1246
+
1247
+ # If authentication system props are set, add them to SOLR_OPTS
1248
+ if [ -n "$AUTHC_OPTS" ]; then
1249
+ SOLR_OPTS+=($AUTHC_OPTS)
1292
1250
  fi
1293
1251
 
1294
1252
  if $verbose ; then
@@ -1299,17 +1257,17 @@ function launch_solr() {
1299
1257
  echo -e " SOLR_HOST = $SOLR_HOST"
1300
1258
  echo -e " SOLR_PORT = $SOLR_PORT"
1301
1259
  echo -e " STOP_PORT = $STOP_PORT"
1302
- echo -e " SOLR_JAVA_MEM = $SOLR_JAVA_MEM"
1303
- echo -e " GC_TUNE = $GC_TUNE"
1304
- echo -e " GC_LOG_OPTS = $GC_LOG_OPTS"
1260
+ echo -e " JAVA_MEM_OPTS = ${JAVA_MEM_OPTS[@]}"
1261
+ echo -e " GC_TUNE = ${GC_TUNE[@]}"
1262
+ echo -e " GC_LOG_OPTS = ${GC_LOG_OPTS[@]}"
1305
1263
  echo -e " SOLR_TIMEZONE = $SOLR_TIMEZONE"
1306
1264
 
1307
1265
  if [ "$SOLR_MODE" == "solrcloud" ]; then
1308
- echo -e " CLOUD_MODE_OPTS = $CLOUD_MODE_OPTS"
1266
+ echo -e " CLOUD_MODE_OPTS = ${CLOUD_MODE_OPTS[@]}"
1309
1267
  fi
1310
1268
 
1311
1269
  if [ "$SOLR_OPTS" != "" ]; then
1312
- echo -e " SOLR_OPTS = $SOLR_OPTS"
1270
+ echo -e " SOLR_OPTS = ${SOLR_OPTS[@]}"
1313
1271
  fi
1314
1272
 
1315
1273
  if [ "$SOLR_ADDL_ARGS" != "" ]; then
@@ -1318,214 +1276,75 @@ function launch_solr() {
1318
1276
 
1319
1277
  if [ "$ENABLE_REMOTE_JMX_OPTS" == "true" ]; then
1320
1278
  echo -e " RMI_PORT = $RMI_PORT"
1321
- echo -e " REMOTE_JMX_OPTS = $REMOTE_JMX_OPTS"
1279
+ echo -e " REMOTE_JMX_OPTS = ${REMOTE_JMX_OPTS[@]}"
1322
1280
  fi
1323
1281
  echo -e "\n"
1324
1282
  fi
1325
1283
 
1326
1284
  # need to launch solr from the server dir
1327
- cd $SOLR_SERVER_DIR
1285
+ cd "$SOLR_SERVER_DIR"
1328
1286
 
1329
1287
  if [ ! -e "$SOLR_SERVER_DIR/start.jar" ]; then
1330
1288
  echo -e "\nERROR: start.jar file not found in $SOLR_SERVER_DIR!\nPlease check your -d parameter to set the correct Solr server directory.\n"
1331
1289
  exit 1
1332
1290
  fi
1333
1291
 
1334
- SOLR_START_OPTS="-server -Xss256k $SOLR_JAVA_MEM $GC_TUNE $GC_LOG_OPTS $REMOTE_JMX_OPTS \
1335
- $CLOUD_MODE_OPTS \
1336
- -DSTOP.PORT=$stop_port -DSTOP.KEY=$STOP_KEY \
1337
- $SOLR_HOST_ARG -Djetty.port=$SOLR_PORT \
1338
- -Dsolr.solr.home=$SOLR_HOME \
1339
- -Dsolr.install.dir=$SOLR_TIP \
1340
- -Duser.timezone=$SOLR_TIMEZONE \
1341
- -Djava.net.preferIPv4Stack=true $LOG4J_CONFIG \
1342
- $SOLR_OPTS"
1343
-
1292
+ SOLR_START_OPTS=('-server' '-Xss256k' "${JAVA_MEM_OPTS[@]}" "${GC_TUNE[@]}" "${GC_LOG_OPTS[@]}" \
1293
+ "${REMOTE_JMX_OPTS[@]}" "${CLOUD_MODE_OPTS[@]}" \
1294
+ "-Djetty.port=$SOLR_PORT" "-DSTOP.PORT=$stop_port" "-DSTOP.KEY=$STOP_KEY" \
1295
+ "${SOLR_HOST_ARG[@]}" "-Duser.timezone=$SOLR_TIMEZONE" \
1296
+ "-Djetty.home=$SOLR_SERVER_DIR" "-Dsolr.solr.home=$SOLR_HOME" "-Dsolr.install.dir=$SOLR_TIP" \
1297
+ "${LOG4J_CONFIG[@]}" "${SOLR_OPTS[@]}")
1298
+
1344
1299
  if [ "$SOLR_MODE" == "solrcloud" ]; then
1345
1300
  IN_CLOUD_MODE=" in SolrCloud mode"
1346
1301
  fi
1347
1302
 
1348
- mkdir -p $SOLR_LOGS_DIR
1303
+ mkdir -p "$SOLR_LOGS_DIR"
1349
1304
 
1350
1305
  if [ "$run_in_foreground" == "true" ]; then
1351
1306
  echo -e "\nStarting Solr$IN_CLOUD_MODE on port $SOLR_PORT from $SOLR_SERVER_DIR\n"
1352
- $JAVA $SOLR_START_OPTS $SOLR_ADDL_ARGS -jar start.jar $SOLR_JETTY_CONFIG
1307
+ "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar "${SOLR_JETTY_CONFIG[@]}"
1353
1308
  else
1354
1309
  # run Solr in the background
1355
- nohup $JAVA $SOLR_START_OPTS $SOLR_ADDL_ARGS -XX:OnOutOfMemoryError="$SOLR_TIP/bin/oom_solr.sh $SOLR_PORT $SOLR_LOGS_DIR" -jar start.jar $SOLR_JETTY_CONFIG 1>$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log 2>&1 & echo $! > $SOLR_PID_DIR/solr-$SOLR_PORT.pid
1356
-
1310
+ nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar \
1311
+ "-XX:OnOutOfMemoryError=$SOLR_TIP/bin/oom_solr.sh $SOLR_PORT $SOLR_LOGS_DIR" "${SOLR_JETTY_CONFIG[@]}" \
1312
+ 1>"$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log" 2>&1 & echo $! > "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
1313
+
1357
1314
  # no lsof on cygwin though
1358
1315
  if hash lsof 2>/dev/null ; then # hash returns true if lsof is on the path
1359
- echo -n "Waiting to see Solr listening on port $SOLR_PORT"
1316
+ echo -n "Waiting up to 30 seconds to see Solr running on port $SOLR_PORT"
1360
1317
  # Launch in a subshell to show the spinner
1361
1318
  (loops=0
1362
1319
  while true
1363
1320
  do
1364
- running=`lsof -Pni:$SOLR_PORT`
1321
+ running=`lsof -PniTCP:$SOLR_PORT -sTCP:LISTEN`
1365
1322
  if [ -z "$running" ]; then
1366
1323
  if [ $loops -lt 6 ]; then
1367
1324
  sleep 5
1368
1325
  loops=$[$loops+1]
1369
1326
  else
1370
1327
  echo -e "Still not seeing Solr listening on $SOLR_PORT after 30 seconds!"
1371
- tail -30 $SOLR_LOGS_DIR/solr.log
1372
- exit;
1328
+ tail -30 "$SOLR_LOGS_DIR/solr.log"
1329
+ exit # subshell!
1373
1330
  fi
1374
1331
  else
1375
- SOLR_PID=`ps auxww | grep start.jar | grep $SOLR_PORT | grep -v grep | awk '{print $2}' | sort -r`
1332
+ SOLR_PID=`ps auxww | grep start\.jar | grep -w $SOLR_PORT | grep -v grep | awk '{print $2}' | sort -r`
1376
1333
  echo -e "\nStarted Solr server on port $SOLR_PORT (pid=$SOLR_PID). Happy searching!\n"
1377
- exit;
1334
+ exit # subshell!
1378
1335
  fi
1379
1336
  done) &
1380
1337
  spinner $!
1381
1338
  else
1382
- SOLR_PID=`ps auxww | grep start.jar | grep $SOLR_PORT | grep -v grep | awk '{print $2}' | sort -r`
1339
+ echo -e "NOTE: Please install lsof as this script needs it to determine if Solr is listening on port $SOLR_PORT."
1340
+ sleep 10
1341
+ SOLR_PID=`ps auxww | grep start\.jar | grep -w $SOLR_PORT | grep -v grep | awk '{print $2}' | sort -r`
1383
1342
  echo -e "\nStarted Solr server on port $SOLR_PORT (pid=$SOLR_PID). Happy searching!\n"
1384
- exit;
1343
+ return;
1385
1344
  fi
1386
1345
  fi
1387
1346
  }
1388
1347
 
1389
- if [ "$EXAMPLE" != "cloud" ]; then
1390
- launch_solr "$FG" "$ADDITIONAL_CMD_OPTS"
1391
-
1392
- # create the core/collection for the requested example after launching Solr
1393
- if [[ "$EXAMPLE" == "schemaless" || "$EXAMPLE" == "techproducts" ]]; then
1394
-
1395
- if [ "$EXAMPLE" == "schemaless" ]; then
1396
- EXAMPLE_NAME=gettingstarted
1397
- else
1398
- EXAMPLE_NAME=$EXAMPLE
1399
- fi
1400
-
1401
- run_tool create -name $EXAMPLE_NAME -shards 1 -replicationFactor 1 \
1402
- -confname $EXAMPLE_NAME -confdir $EXAMPLE_CONFIGSET \
1403
- -configsetsDir $SOLR_TIP/server/solr/configsets -solrUrl $SOLR_URL_SCHEME://localhost:$SOLR_PORT/solr
1404
- if [ $? -ne 0 ]; then
1405
- exit 1
1406
- fi
1407
-
1408
- if [ "$EXAMPLE" == "techproducts" ]; then
1409
- echo "Indexing tech product example docs from $SOLR_TIP/example/exampledocs"
1410
- "$JAVA" $SOLR_SSL_OPTS -Durl=$SOLR_URL_SCHEME://localhost:$SOLR_PORT/solr/$EXAMPLE/update -jar $SOLR_TIP/example/exampledocs/post.jar $SOLR_TIP/example/exampledocs/*.xml
1411
- fi
1412
-
1413
- echo -e "\nSolr $EXAMPLE example launched successfully. Direct your Web browser to $SOLR_URL_SCHEME://localhost:$SOLR_PORT/solr to visit the Solr Admin UI\n"
1414
- fi
1415
- else
1416
- #
1417
- # SolrCloud example is a bit involved so needs special handling here
1418
- #
1419
- SOLR_SERVER_DIR=$SOLR_TIP/server
1420
- SOLR_HOME=$SOLR_TIP/example/cloud/node1/solr
1421
- SOLR_PORT=${CLOUD_PORTS[0]}
1422
-
1423
- if [ "$ZK_HOST" != "" ]; then
1424
- DASHZ="-z $ZK_HOST"
1425
- fi
1426
-
1427
- if [ "$SOLR_HEAP" != "" ]; then
1428
- DASHM="-m $SOLR_HEAP"
1429
- fi
1430
-
1431
- if [ "$ADDITIONAL_CMD_OPTS" != "" ]; then
1432
- DASHA="-a $ADDITIONAL_CMD_OPTS"
1433
- fi
1434
-
1435
- echo -e "\nStarting up SolrCloud node1 on port ${CLOUD_PORTS[0]} using command:\n"
1436
- echo -e "solr start -cloud -s example/cloud/node1/solr -p $SOLR_PORT $DASHZ $DASHM $DASHA\n\n"
1437
-
1438
- # can't launch this node in the foreground else we can't run anymore commands
1439
- launch_solr "false" "$ADDITIONAL_CMD_OPTS"
1440
-
1441
- # if user did not define a specific -z parameter, assume embedded in first cloud node we launched above
1442
- zk_host=$ZK_HOST
1443
- if [ -z "$zk_host" ]; then
1444
- zk_port=$[$SOLR_PORT+1000]
1445
- zk_host=localhost:$zk_port
1446
- fi
1447
-
1448
- for (( s=1; s<$CLOUD_NUM_NODES; s++ ))
1449
- do
1450
- ndx=$[$s+1]
1451
- next_port=${CLOUD_PORTS[$s]}
1452
- echo -e "\n\nStarting node$ndx on port $next_port using command:\n"
1453
- echo -e "solr start -cloud -s example/cloud/node$ndx/solr -p $next_port -z $zk_host $DASHM $DASHA \n\n"
1454
- # call this script again with correct args for next node
1455
- $SOLR_TIP/bin/solr start -cloud -s $SOLR_TIP/example/cloud/node$ndx/solr -p $next_port -z $zk_host $DASHM $DASHA
1456
- done
1457
-
1458
- # TODO: better (shorter) name??
1459
- CLOUD_COLLECTION=gettingstarted
1460
-
1461
- if $noprompt ; then
1462
- CLOUD_NUM_SHARDS=2
1463
- CLOUD_REPFACT=2
1464
- CLOUD_CONFIG=data_driven_schema_configs
1465
- else
1466
- echo -e "\nNow let's create a new collection for indexing documents in your $CLOUD_NUM_NODES-node cluster.\n"
1467
- read -e -p "Please provide a name for your new collection: [gettingstarted] " USER_INPUT
1468
- # trim whitespace out of the user input
1469
- CLOUD_COLLECTION=`echo $USER_INPUT | tr -d ' '`
1470
-
1471
- # handle the default selection or empty input
1472
- if [ -z "$CLOUD_COLLECTION" ]; then
1473
- CLOUD_COLLECTION=gettingstarted
1474
- fi
1475
- echo $CLOUD_COLLECTION
1476
-
1477
- USER_INPUT=
1478
- read -e -p "How many shards would you like to split $CLOUD_COLLECTION into? [2] " USER_INPUT
1479
- # trim whitespace out of the user input
1480
- CLOUD_NUM_SHARDS=`echo $USER_INPUT | tr -d ' '`
1481
-
1482
- # handle the default selection or empty input
1483
- if [ -z "$CLOUD_NUM_SHARDS" ]; then
1484
- CLOUD_NUM_SHARDS=2
1485
- fi
1486
- echo $CLOUD_NUM_SHARDS
1487
-
1488
- USER_INPUT=
1489
- read -e -p "How many replicas per shard would you like to create? [2] " USER_INPUT
1490
- # trim whitespace out of the user input
1491
- CLOUD_REPFACT=`echo $USER_INPUT | tr -d ' '`
1492
-
1493
- # handle the default selection or empty input
1494
- if [ -z "$CLOUD_REPFACT" ]; then
1495
- CLOUD_REPFACT=2
1496
- fi
1497
- echo $CLOUD_REPFACT
1498
-
1499
- USER_INPUT=
1500
- echo "Please choose a configuration for the $CLOUD_COLLECTION collection, available options are:"
1501
- read -e -p "basic_configs, data_driven_schema_configs, or sample_techproducts_configs [data_driven_schema_configs] " USER_INPUT
1502
- while true
1503
- do
1504
- # trim whitespace out of the user input
1505
- CLOUD_CONFIG=`echo $USER_INPUT | tr -d ' '`
1506
-
1507
- # handle the default selection or empty input
1508
- if [ -z "$CLOUD_CONFIG" ]; then
1509
- CLOUD_CONFIG=data_driven_schema_configs
1510
- fi
1511
-
1512
- # validate the confdir arg
1513
- if [[ ! -d "$SOLR_TIP/server/solr/configsets/$CLOUD_CONFIG" && ! -d "$CLOUD_CONFIG" ]]; then
1514
- echo -e "\nOops! Specified configuration $CLOUD_CONFIG not found!"
1515
- read -e -p "Choose one of: basic_configs, data_driven_schema_configs, or sample_techproducts_configs [data_driven_schema_configs] " USER_INPUT
1516
- CLOUD_CONFIG=
1517
- else
1518
- break;
1519
- fi
1520
- done
1521
-
1522
- fi
1523
-
1524
- run_tool create_collection -name $CLOUD_COLLECTION -shards $CLOUD_NUM_SHARDS -replicationFactor $CLOUD_REPFACT \
1525
- -confname $CLOUD_COLLECTION -confdir $CLOUD_CONFIG \
1526
- -configsetsDir $SOLR_TIP/server/solr/configsets -solrUrl $SOLR_URL_SCHEME://localhost:$SOLR_PORT/solr
1527
-
1528
- echo -e "\n\nSolrCloud example running, please visit $SOLR_URL_SCHEME://localhost:$SOLR_PORT/solr \n\n"
1529
- fi
1348
+ launch_solr "$FG" "$ADDITIONAL_CMD_OPTS"
1530
1349
 
1531
1350
  exit $?