├── .gitignore
├── .project
├── LICENSE.txt
├── README.md
├── kubernetes
├── config
│ └── zookeeper-standalone-config.yaml
└── zookeeper-standalone.yaml
├── sbin
├── build-images.sh
├── clean-data-dir.sh
└── solrcloud-zookeeper-docker
├── solrcloud-3-nodes-zookeeper-ensemble
├── docker-compose.yml
├── start.sh
└── stop.sh
├── solrcloud
├── docker-compose.yml
├── start.sh
└── stop.sh
├── start-cluster.sh
├── start-zookeeper-ensemble.sh
├── start-zookeeper-standalone.sh
├── start.sh
├── stop-cluster.sh
├── stop-zookeeper-ensemble.sh
├── stop-zookeeper-standalone.sh
├── stop.sh
├── templates
└── solr
│ ├── docker-entrypoint-initdb.d
│ ├── log-config.sh
│ ├── log4j.properties
│ └── store-solr-config.sh
│ └── solr.xml
├── zkcli-util.sh
├── zookeeper-ensemble
├── docker-compose.yml
├── start.sh
└── stop.sh
└── zookeeper
├── docker-compose.yml
├── start.sh
└── stop.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | data/
2 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | solrcloud-zookeeper-docker
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.dltk.core.scriptbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.dltk.ruby.core.nature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
204 |
205 |
206 | Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
207 | derived from unicode conversion examples available at
208 | http://www.unicode.org/Public/PROGRAMS/CVTUTF. Here is the copyright
209 | from those sources:
210 |
211 | /*
212 | * Copyright 2001-2004 Unicode, Inc.
213 | *
214 | * Disclaimer
215 | *
216 | * This source code is provided as is by Unicode, Inc. No claims are
217 | * made as to fitness for any particular purpose. No warranties of any
218 | * kind are expressed or implied. The recipient agrees to determine
219 | * applicability of information provided. If this file has been
220 | * purchased on magnetic or optical media from Unicode, Inc., the
221 | * sole remedy for any claim will be exchange of defective media
222 | * within 90 days of receipt.
223 | *
224 | * Limitations on Rights to Redistribute This Code
225 | *
226 | * Unicode, Inc. hereby grants the right to freely use the information
227 | * supplied in this file in the creation of products supporting the
228 | * Unicode Standard, and to make copies of this file in any form
229 | * for internal or external distribution as long as this notice
230 | * remains attached.
231 | */
232 |
233 |
234 | Some code in core/src/java/org/apache/lucene/util/ArrayUtil.java was
235 | derived from Python 2.4.2 sources available at
236 | http://www.python.org. Full license is here:
237 |
238 | http://www.python.org/download/releases/2.4.2/license/
239 |
240 | Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
241 | derived from Python 3.1.2 sources available at
242 | http://www.python.org. Full license is here:
243 |
244 | http://www.python.org/download/releases/3.1.2/license/
245 |
246 | Some code in core/src/java/org/apache/lucene/util/automaton was
247 | derived from Brics automaton sources available at
248 | www.brics.dk/automaton/. Here is the copyright from those sources:
249 |
250 | /*
251 | * Copyright (c) 2001-2009 Anders Moeller
252 | * All rights reserved.
253 | *
254 | * Redistribution and use in source and binary forms, with or without
255 | * modification, are permitted provided that the following conditions
256 | * are met:
257 | * 1. Redistributions of source code must retain the above copyright
258 | * notice, this list of conditions and the following disclaimer.
259 | * 2. Redistributions in binary form must reproduce the above copyright
260 | * notice, this list of conditions and the following disclaimer in the
261 | * documentation and/or other materials provided with the distribution.
262 | * 3. The name of the author may not be used to endorse or promote products
263 | * derived from this software without specific prior written permission.
264 | *
265 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
266 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
267 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
268 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
269 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
270 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
271 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
272 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
273 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
274 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275 | */
276 |
277 | The levenshtein automata tables in core/src/java/org/apache/lucene/util/automaton
278 | were automatically generated with the moman/finenight FSA package.
279 | Here is the copyright for those sources:
280 |
281 | # Copyright (c) 2010, Jean-Philippe Barrette-LaPierre,
282 | #
283 | # Permission is hereby granted, free of charge, to any person
284 | # obtaining a copy of this software and associated documentation
285 | # files (the "Software"), to deal in the Software without
286 | # restriction, including without limitation the rights to use,
287 | # copy, modify, merge, publish, distribute, sublicense, and/or sell
288 | # copies of the Software, and to permit persons to whom the
289 | # Software is furnished to do so, subject to the following
290 | # conditions:
291 | #
292 | # The above copyright notice and this permission notice shall be
293 | # included in all copies or substantial portions of the Software.
294 | #
295 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
296 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
297 | # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
298 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
299 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
300 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
301 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
302 | # OTHER DEALINGS IN THE SOFTWARE.
303 |
304 | Some code in core/src/java/org/apache/lucene/util/UnicodeUtil.java was
305 | derived from ICU (http://www.icu-project.org)
306 | The full license is available here:
307 | https://github.com/unicode-org/icu/blob/main/icu4c/LICENSE
308 |
309 | /*
310 | * Copyright (C) 1999-2010, International Business Machines
311 | * Corporation and others. All Rights Reserved.
312 | *
313 | * Permission is hereby granted, free of charge, to any person obtaining a copy
314 | * of this software and associated documentation files (the "Software"), to deal
315 | * in the Software without restriction, including without limitation the rights
316 | * to use, copy, modify, merge, publish, distribute, and/or sell copies of the
317 | * Software, and to permit persons to whom the Software is furnished to do so,
318 | * provided that the above copyright notice(s) and this permission notice appear
319 | * in all copies of the Software and that both the above copyright notice(s) and
320 | * this permission notice appear in supporting documentation.
321 | *
322 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
323 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
324 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
325 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
326 | * LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR
327 | * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
328 | * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
329 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
330 | *
331 | * Except as contained in this notice, the name of a copyright holder shall not
332 | * be used in advertising or otherwise to promote the sale, use or other
333 | * dealings in this Software without prior written authorization of the
334 | * copyright holder.
335 | */
336 |
337 | The following license applies to the Snowball stemmers:
338 |
339 | Copyright (c) 2001, Dr Martin Porter
340 | Copyright (c) 2002, Richard Boulton
341 | All rights reserved.
342 |
343 | Redistribution and use in source and binary forms, with or without
344 | modification, are permitted provided that the following conditions are met:
345 |
346 | * Redistributions of source code must retain the above copyright notice,
347 | * this list of conditions and the following disclaimer.
348 | * Redistributions in binary form must reproduce the above copyright
349 | * notice, this list of conditions and the following disclaimer in the
350 | * documentation and/or other materials provided with the distribution.
351 | * Neither the name of the copyright holders nor the names of its contributors
352 | * may be used to endorse or promote products derived from this software
353 | * without specific prior written permission.
354 |
355 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
356 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
357 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
358 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
359 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
360 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
361 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
362 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
363 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
364 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
365 |
366 | The following license applies to the KStemmer:
367 |
368 | Copyright © 2003,
369 | Center for Intelligent Information Retrieval,
370 | University of Massachusetts, Amherst.
371 | All rights reserved.
372 |
373 | Redistribution and use in source and binary forms, with or without modification,
374 | are permitted provided that the following conditions are met:
375 |
376 | 1. Redistributions of source code must retain the above copyright notice, this
377 | list of conditions and the following disclaimer.
378 |
379 | 2. Redistributions in binary form must reproduce the above copyright notice,
380 | this list of conditions and the following disclaimer in the documentation
381 | and/or other materials provided with the distribution.
382 |
383 | 3. The names "Center for Intelligent Information Retrieval" and
384 | "University of Massachusetts" must not be used to endorse or promote products
385 | derived from this software without prior written permission. To obtain
386 | permission, contact info@ciir.cs.umass.edu.
387 |
388 | THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF MASSACHUSETTS AND OTHER CONTRIBUTORS
389 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
390 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
391 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
392 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
393 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
394 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
395 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
396 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
397 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
398 | SUCH DAMAGE.
399 |
400 | The following license applies to the Morfologik project:
401 |
402 | Copyright (c) 2006 Dawid Weiss
403 | Copyright (c) 2007-2011 Dawid Weiss, Marcin Miłkowski
404 | All rights reserved.
405 |
406 | Redistribution and use in source and binary forms, with or without modification,
407 | are permitted provided that the following conditions are met:
408 |
409 | * Redistributions of source code must retain the above copyright notice,
410 | this list of conditions and the following disclaimer.
411 |
412 | * Redistributions in binary form must reproduce the above copyright notice,
413 | this list of conditions and the following disclaimer in the documentation
414 | and/or other materials provided with the distribution.
415 |
416 | * Neither the name of Morfologik nor the names of its contributors
417 | may be used to endorse or promote products derived from this software
418 | without specific prior written permission.
419 |
420 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
421 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
422 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
423 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
424 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
425 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
426 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
427 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
428 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
429 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
430 |
431 | ---
432 |
433 | The dictionary comes from Morfologik project. Morfologik uses data from
434 | Polish ispell/myspell dictionary hosted at http://www.sjp.pl/slownik/en/ and
435 | is licenced on the terms of (inter alia) LGPL and Creative Commons
436 | ShareAlike. The part-of-speech tags were added in Morfologik project and
437 | are not found in the data from sjp.pl. The tagset is similar to IPI PAN
438 | tagset.
439 |
440 | ---
441 |
442 | The following license applies to the Morfeusz project,
443 | used by org.apache.lucene.analysis.morfologik.
444 |
445 | BSD-licensed dictionary of Polish (SGJP)
446 | http://sgjp.pl/morfeusz/
447 |
448 | Copyright © 2011 Zygmunt Saloni, Włodzimierz Gruszczyński,
449 | Marcin Woliński, Robert Wołosz
450 |
451 | All rights reserved.
452 |
453 | Redistribution and use in source and binary forms, with or without
454 | modification, are permitted provided that the following conditions are
455 | met:
456 |
457 | 1. Redistributions of source code must retain the above copyright
458 | notice, this list of conditions and the following disclaimer.
459 |
460 | 2. Redistributions in binary form must reproduce the above copyright
461 | notice, this list of conditions and the following disclaimer in the
462 | documentation and/or other materials provided with the
463 | distribution.
464 |
465 | THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS “AS IS” AND ANY EXPRESS
466 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
467 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
468 | DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS BE
469 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
470 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
471 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
472 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
473 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
474 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
475 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
476 |
477 | ---
478 |
479 | core/src/java/org/apache/lucene/util/compress/LZ4.java is a Java
480 | implementation of the LZ4 (https://github.com/lz4/lz4/tree/dev/lib)
481 | compression format for Lucene's DataInput/DataOutput abstractions.
482 |
483 | LZ4 Library
484 | Copyright (c) 2011-2016, Yann Collet
485 | All rights reserved.
486 |
487 | Redistribution and use in source and binary forms, with or without modification,
488 | are permitted provided that the following conditions are met:
489 |
490 | * Redistributions of source code must retain the above copyright notice, this
491 | list of conditions and the following disclaimer.
492 |
493 | * Redistributions in binary form must reproduce the above copyright notice, this
494 | list of conditions and the following disclaimer in the documentation and/or
495 | other materials provided with the distribution.
496 |
497 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
498 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
499 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
500 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
501 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
502 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
503 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
504 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
505 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
506 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
507 |
508 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | solrcloud-zookeeper-docker
2 | ================
3 |
4 | This project aims to help developers and newbies that would try latest version of SolrCloud (and Zookeeper) in a Docker environment.
5 |
6 | This version of this project is entirely based on the newer Solr and Zookeeper official images.
7 |
8 | ## Prerequisite
9 |
10 | * Mac-OS or Linux environment
11 | * Docker lastest version - https://docs.docker.com/engine/installation/
12 | * Docker-Compose latest version - https://docs.docker.com/compose/install/
13 |
14 | ## Quick start
15 |
16 | If you want try a lightweight configuration with 1 SolrCloud container and 1 Zookeeper container, just run:
17 |
18 | git clone https://github.com/freedev/solrcloud-zookeeper-docker.git
19 | cd solrcloud-zookeeper-docker
20 | ./start.sh
21 |
22 | The script will output the list of container started, their ip addresses and ports. For example executing `start.sh` will output:
23 |
24 | [...]
25 | ZOO_SERVERS: localhost:2181
26 | Ensemble ready.
27 |
28 | Starting container: solr-1_1 (localhost) on port: 8081 ...
29 |
30 | SolrCloud cluster running!
31 |
32 | ## Start your SolrCloud cluster
33 |
34 | Start a 3 container SolrCloud and a 3 container Zookeeper ensemble running:
35 |
36 | ./start-cluster.sh
37 |
38 | The script will output the list of container started, their ip addresses and ports. For example executing `start-cluster.sh` will output:
39 |
40 | [...]
41 | Starting zoo-2 ... done
42 | Starting zoo-3 ... done
43 | Starting zoo-1 ... done
44 | Starting solr-1 ... done
45 | Starting solr-3 ... done
46 | Starting solr-2 ... done
47 |
48 | ZOO_SERVERS: localhost:2181,localhost:2182,localhost:2183
49 | Ensemble ready.
50 |
51 | Starting container: solr-1_1 (localhost) on port: 8081 ...
52 | Starting container: solr-2_1 (localhost) on port: 8082 ...
53 | Starting container: solr-3_1 (localhost) on port: 8083 ...
54 |
55 | SolrCloud cluster running!
56 |
57 | try connecting to http://localhost:8081/solr
58 |
59 | ## How to move your standalone Solr to SolrCloud
60 |
61 | 1. (Optional step) Copy your `lib/*.jar` files into `solrcloud-zookeeper-docker/solrcloud/data/solr-1/store/shared-lib`.
62 |
63 | 2. Upload the collection configuration into Zookeeper. To upload the configuration just use `zkcli-util.sh`. You'll find `zkcli-util.sh` into `solrcloud-zookeeper-docker`.
64 |
65 | `./zkcli-util.sh --cmd upconfig -confname collection1 -confdir /path/to/collection1/conf/ -zkhost 127.0.0.1:2181`
66 |
67 | 3. Go into the Solr Admin and have a look at http://localhost:8081/solr/#/~cloud?view=tree
68 | And double check zookeeper `/config/` folder, there you should see your configuration.
69 |
70 | 4. Create your collection (for example using [Collections API - CREATE](https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-CREATE:CreateaCollection)).
71 |
72 | 5. Now can load your documents into the fresh collection. Theoretically, at this point, if your standalone version of Solr is the same of SolrCloud, given you're using the same version of Lucene indexes you could try to brutally copy the index data. But first you have to shutdown SolrCloud.
73 |
74 | ## Note about Zookeeper configuration
75 | Given that: "Every machine that is part of the ZooKeeper ensemble should know about every other machine in the ensemble".
76 |
77 | So when a cluster starts, in detail, this script will:
78 |
79 | - enter the directory solrcloud-3-nodes-zookeeper-ensemble
80 | - generate the zookeeper configuration as environment variable
81 | - execute docker-compose
82 | - Create 3 Zookeeper containers and 3 Solr containers
83 | - Start Zookeeper ensemble with the given configuration.
84 | - Create and start 3 SolrCloud containers linked to Zookeeper ensemble
85 |
86 | If you want connect your clients to SolrCloud or want read by Zookeeper ensemble and SolrCloud can be exposed externally through ZKHOST env variable
87 |
88 | # Boot
89 | In order to help who want restart all the container automatically with Linux at every boot, an init.d start/stop script has been provided.
90 |
91 | You should link the script into `/etc/inid.d`:
92 |
93 | export SZD_HOME=/home/ubuntu/solrcloud-zookeeper-docker
94 | sudo ln -s $SZD_HOME/sbin/solrcloud-zookeeper-docker /etc/init.d/solrcloud-zookeeper-docker
95 |
96 | Edit `solrcloud-zookeeper-docker` script and modify:
97 |
98 | ZK_CLUSTER_SIZE=1
99 | SOLRCLOUD_CLUSTER_SIZE=1
100 |
101 | Under Ubuntu you can configure boot start and stop in this way:
102 |
103 | sudo update-rc.d solrcloud-zookeeper-docker defaults
104 |
105 | Note:
106 | The first version of this project was written when there wasn't docker-compose and there weren't official images for Solr, Zookeeper and even Java 8. Hence the project had its own custom images for every piece of the architecture and I had to create the docker network in order to start a zookeeper ensemble.
107 |
108 | Finally the official images are ready for almost everything, so I had re-build the entire project from the ground up using docker-compose and official images.
109 |
110 |
--------------------------------------------------------------------------------
/kubernetes/config/zookeeper-standalone-config.yaml:
--------------------------------------------------------------------------------
1 | kind: ConfigMap
2 | apiVersion: v1
3 | metadata:
4 | creationTimestamp: 2016-02-18T19:14:38Z
5 | name: zookeeper-standalone-configmap
6 | namespace: default
7 | data:
8 | ZOO_LOG_DIR: /opt/persist/logs
9 | ZOO_DATA_DIR: /opt/persist/data
10 |
--------------------------------------------------------------------------------
/kubernetes/zookeeper-standalone.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: zookeeper-standalone
5 | spec:
6 | replicas: 1
7 | template:
8 | metadata:
9 | labels:
10 | app: zookeeper-standalone
11 | spec:
12 | containers:
13 | - name: zookeeper-standalone
14 | image: zookeeper:3.4.9
15 | ports:
16 | - containerPort: 2181
17 | volumeMounts:
18 | - name: zookeeper-standalone-data
19 | mountPath: /opt/persist
20 | env:
21 | - name: ZOO_DATA_LOG_DIR
22 | valueFrom:
23 | configMapKeyRef:
24 | name: zookeeper-standalone-configmap
25 | key: ZOO_DATA_LOG_DIR
26 | - name: ZOO_LOG_DIR
27 | valueFrom:
28 | configMapKeyRef:
29 | name: zookeeper-standalone-configmap
30 | key: ZOO_LOG_DIR
31 | - name: ZOO_DATA_DIR
32 | valueFrom:
33 | configMapKeyRef:
34 | name: zookeeper-standalone-configmap
35 | key: ZOO_DATA_DIR
36 | - name: ZOO_ID
37 | value: "1"
38 | volumes:
39 | - name: zookeeper-standalone-data
40 | hostPath:
41 | path: /store/zookeeper-standalone
42 |
--------------------------------------------------------------------------------
/sbin/build-images.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mantainer_name=freedev
4 |
5 | if [ "A$SZD_HOME" == "A" ]
6 | then
7 | echo "ERROR: "\$SZD_HOME" environment variable not found!"
8 | exit 1
9 | fi
10 |
11 | . $SZD_HOME/sbin/common.sh
12 |
13 | $DOCKER_BIN build -t ${mantainer_name}/unix-utils ../unix-utils/
14 |
15 | $DOCKER_BIN build -t ${mantainer_name}/tomcat ../tomcat/
16 |
17 | $DOCKER_BIN build -t ${mantainer_name}/solr-tomcat ../solr-tomcat/
18 |
19 | $DOCKER_BIN build -t ${mantainer_name}/solrcloud4-base ../solrcloud4-base/
20 |
21 | $DOCKER_BIN build -t ${mantainer_name}/solrcloud4 ../solrcloud4/
22 |
23 | $DOCKER_BIN build -t ${mantainer_name}/zkcli ../zkcli/
24 |
25 |
--------------------------------------------------------------------------------
/sbin/clean-data-dir.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | if [ "A$SZD_HOME" == "A" ]
6 | then
7 | echo "ERROR: "\$SZD_HOME" environment variable not found!"
8 | exit 1
9 | fi
10 |
11 | . $SZD_HOME/sbin/common.sh
12 |
13 | if [ "A$SZD_COMMON_CONFIG" == "A" ]
14 | then
15 | echo "Error: common.sh not loaded"
16 | exit
17 | fi
18 |
19 | $SZD_HOME/sbin/stop-all.sh
20 |
21 | echo "Warning: this script will remove all data from $SZD_DATA_DIR"
22 | select yn in "Remove_All" "Exit"; do
23 | case $yn in
24 | Remove_All ) break;;
25 | Exit ) exit 1;;
26 | esac
27 | done
28 |
29 | sudo rm -rf $SZD_DATA_DIR/*
30 |
31 |
--------------------------------------------------------------------------------
/sbin/solrcloud-zookeeper-docker:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | ### BEGIN INIT INFO
4 | # Provides: solrcloud-zookeeper-docker
5 | # Required-Start: $local_fs $remote_fs
6 | # Required-Stop:
7 | # X-Start-Before: rmnologin
8 | # Default-Start: 2 3 4 5
9 | # Default-Stop:
10 | # Short-Description: Start and stop solrcloud zookeeper instances
11 | # Description: Start and stop solrcloud zookeeper instances
12 | ### END INIT INFO
13 |
14 | . /lib/lsb/init-functions
15 |
16 | N=/etc/init.d/solrcloud-zookeeper-docker
17 |
18 | SZD_HOME=/home/ubuntu/solrcloud-zookeeper-docker
19 | PATH="$PATH:$SZD_HOME/sbin"
20 | export SZD_HOME
21 | export PATH
22 |
23 | ZK_CLUSTER_SIZE=1
24 | export ZK_CLUSTER_SIZE
25 |
26 | SOLRCLOUD_CLUSTER_SIZE=1
27 | export SOLRCLOUD_CLUSTER_SIZE
28 |
29 | . $SZD_HOME/sbin/common.sh
30 |
31 | set -e
32 |
33 | case "$1" in
34 | start)
35 | echo "Cleanup before start..."
36 |
37 | $DOCKER_BIN ps -a -q | xargs -I{} $DOCKER_BIN rm {}
38 |
39 | echo "Removing zoo.cfg..."
40 | if [ -f $ZK_CFG_FILE ]
41 | then
42 | rm $ZK_CFG_FILE
43 | fi
44 |
45 | if [ -f ZKHOST_CFG_FILE ]
46 | then
47 | rm $ZKHOST_CFG_FILE
48 | fi
49 |
50 | echo Done
51 | $SZD_HOME/sbin/start-zookeeper-standalone.sh
52 | $SZD_HOME/sbin/start-solrcloud5-cluster.sh
53 |
54 | ;;
55 | stop)
56 | echo "..."
57 | echo "Stopping..."
58 | $DOCKER_BIN ps -q | xargs -I{} $DOCKER_BIN stop "{}"
59 | echo "Done"
60 | ;;
61 | reload|restart|force-reload|status)
62 | ;;
63 | *)
64 | echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
65 | exit 1
66 | ;;
67 | esac
68 |
69 | exit 0
70 |
--------------------------------------------------------------------------------
/solrcloud-3-nodes-zookeeper-ensemble/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 | services:
3 | zoo-1:
4 | image: zookeeper
5 | restart: always
6 | ports:
7 | - "2181:2181"
8 | volumes:
9 | - ./data/zoo-1:/opt/persist
10 | environment:
11 | ZOO_MY_ID: 1
12 | ZOO_PORT: 2181
13 | ZOO_SERVERS: server.1=zoo-1:2888:3888 server.2=zoo-2:2888:3888 server.3=zoo-3:2888:3888
14 | ZOO_LOG_DIR: /opt/persist/logs
15 | ZOO_DATA_LOG_DIR: /opt/persist/data
16 | zoo-2:
17 | image: zookeeper
18 | restart: always
19 | ports:
20 | - "2182:2182"
21 | volumes:
22 | - ./data/zoo-2:/opt/persist
23 | environment:
24 | ZOO_MY_ID: 2
25 | ZOO_PORT: 2182
26 | ZOO_SERVERS: server.1=zoo-1:2888:3888 server.2=zoo-2:2888:3888 server.3=zoo-3:2888:3888
27 | ZOO_LOG_DIR: /opt/persist/logs
28 | ZOO_DATA_LOG_DIR: /opt/persist/data
29 | zoo-3:
30 | image: zookeeper
31 | restart: always
32 | ports:
33 | - "2183:2183"
34 | volumes:
35 | - ./data/zoo-3:/opt/persist
36 | environment:
37 | ZOO_MY_ID: 3
38 | ZOO_PORT: 2183
39 | ZOO_SERVERS: server.1=zoo-1:2888:3888 server.2=zoo-2:2888:3888 server.3=zoo-3:2888:3888
40 | ZOO_LOG_DIR: /opt/persist/logs
41 | ZOO_DATA_LOG_DIR: /opt/persist/data
42 | solr-1:
43 | image: solr
44 | restart: always
45 | ports:
46 | - 8081:8081
47 | volumes:
48 | - ./data/solr-1/logs:/opt/logs
49 | - ./data/solr-1/store:/store
50 | - ./data/solr-1/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
51 | environment:
52 | SOLR_PORT: 8081
53 | SOLR_HOME: /store/solr
54 | ZK_HOST: zoo-1:2181,zoo-2:2182,zoo-3:2183
55 | SOLR_LOGS_DIR: /opt/logs
56 | SOLR_HOST: solr-1
57 | SOLR_HEAP:
58 | SOLR_JAVA_MEM:
59 | depends_on:
60 | - zoo-1
61 | - zoo-2
62 | - zoo-3
63 | solr-2:
64 | image: solr
65 | restart: always
66 | ports:
67 | - 8082:8082
68 | volumes:
69 | - ./data/solr-2/logs:/opt/logs
70 | - ./data/solr-2/store:/store
71 | - ./data/solr-2/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
72 | environment:
73 | SOLR_PORT: 8082
74 | SOLR_HOME: /store/solr
75 | ZK_HOST: zoo-1:2181,zoo-2:2182,zoo-3:2183
76 | SOLR_LOGS_DIR: /opt/logs
77 | SOLR_HOST: solr-2
78 | SOLR_HEAP:
79 | SOLR_JAVA_MEM:
80 | depends_on:
81 | - zoo-1
82 | - zoo-2
83 | - zoo-3
84 | solr-3:
85 | image: solr
86 | restart: always
87 | ports:
88 | - 8083:8083
89 | volumes:
90 | - ./data/solr-3/logs:/opt/logs
91 | - ./data/solr-3/store:/store
92 | - ./data/solr-3/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
93 | environment:
94 | SOLR_PORT: 8083
95 | SOLR_HOME: /store/solr
96 | ZK_HOST: zoo-1:2181,zoo-2:2182,zoo-3:2183
97 | SOLR_LOGS_DIR: /opt/logs
98 | SOLR_HOST: solr-3
99 | SOLR_HEAP:
100 | SOLR_JAVA_MEM:
101 | depends_on:
102 | - zoo-1
103 | - zoo-2
104 | - zoo-3
105 |
--------------------------------------------------------------------------------
/solrcloud-3-nodes-zookeeper-ensemble/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # set -x
4 | set -e
5 |
6 | function my_readlink() {
7 | case "$OSTYPE" in
8 | solaris*) echo "SOLARIS" ;;
9 | darwin*)
10 | echo $( cd "$1" ; pwd -P )
11 | ;;
12 | linux*)
13 | echo $(readlink -f $1)
14 | ;;
15 | bsd*) echo "BSD" ;;
16 | *) echo "unknown: $OSTYPE" ;;
17 | esac
18 | }
19 |
20 | PWD=$(pwd)
21 | PWD_PATH=$(my_readlink $PWD)
22 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
23 | APP=$(basename $SCRIPT_PATH)
24 |
25 |
26 | echo $APP
27 |
28 | ZK_CLUSTER_SIZE=3
29 | SOLRCLOUD_CLUSTER_SIZE=3
30 |
31 | [ -z "$SZD_HOME" ] && echo "ERROR: "\$SZD_HOME" environment variable not found!" && exit 1;
32 |
33 | export DOCKER_BIN="sudo docker"
34 | export DOCKER_COMPOSE_BIN="sudo docker-compose"
35 |
36 | # check if zookeeper and solr container images are present
37 |
38 | s_container_name=solr
39 | s_container_version=latest
40 |
41 | IMAGE=$($DOCKER_BIN images | grep "${s_container_name} " | grep "${s_container_version} " | awk '{print $3}')
42 | if [[ -z $IMAGE ]]; then
43 | $DOCKER_BIN pull ${s_container_name}:${s_container_version}
44 | rc=$?
45 | if [[ $rc != 0 ]]
46 | then
47 | echo "${s_container_name}:${s_container_version} image not found..."
48 | exit $rc
49 | fi
50 | fi
51 |
52 | z_container_name=zookeeper
53 | z_container_version=latest
54 |
55 | IMAGE=$($DOCKER_BIN images | grep "${z_container_name}" | grep "${z_container_version} " | awk '{print $3}')
56 | if [[ -z $IMAGE ]]; then
57 | $DOCKER_BIN pull ${z_container_name}:${z_container_version}
58 | rc=$?
59 | if [[ $rc != 0 ]]
60 | then
61 | echo "${z_container_name} image not found... Did you run 'build-images.sh' ?"
62 | exit $rc
63 | fi
64 | fi
65 |
66 | # create data dir for each cluster node
67 |
68 | SZD_DATA_DIR=$SZD_HOME/$APP/data
69 |
70 | export ZKHOST_CFG_FILE=$SZD_DATA_DIR/zkhost.cfg
71 |
72 | # Need a volume to read the config from
73 | conf_prefix=zoo-
74 | conf_container=${conf_prefix}1
75 |
76 | cluster_size=$ZK_CLUSTER_SIZE
77 |
78 | for ((i=1; i <= cluster_size ; i++)); do
79 |
80 | HOST_DATA=$SZD_DATA_DIR"/${conf_prefix}${i}"
81 | if [ ! -d ${HOST_DATA} ] ; then
82 | mkdir -p ${HOST_DATA}/logs
83 | mkdir -p ${HOST_DATA}/data
84 | fi
85 |
86 | if [ ! -d ${HOST_DATA} ] ; then
87 | echo "Error: unable to create "$HOST_DATA
88 | exit
89 | fi
90 |
91 | done
92 |
93 | SOLR_HEAP=""
94 | SOLR_JAVA_MEM=$SOLRCLOUD_JVMFLAGS
95 |
96 | # Start the solrcloud containers
97 | HOST_PREFIX=${s_container_name}-
98 |
99 | for ((i=1; i <= SOLRCLOUD_CLUSTER_SIZE ; i++)); do
100 |
101 | SOLR_HOSTNAME=${HOST_PREFIX}${i}
102 | HOST_DATA_DIR=$SZD_DATA_DIR/${SOLR_HOSTNAME}
103 |
104 | if [ ! -d ${HOST_DATA_DIR} ] ; then
105 | mkdir -p ${HOST_DATA_DIR}/logs
106 | mkdir -p ${HOST_DATA_DIR}/store/solr
107 | mkdir -p ${HOST_DATA_DIR}/store/shared-lib
108 | cp -r $SZD_HOME/templates/solr/docker-entrypoint-initdb.d ${HOST_DATA_DIR}/
109 | chmod -R ugo+rw ${HOST_DATA_DIR}
110 | fi
111 |
112 | if [ ! -d ${HOST_DATA_DIR} ] ; then
113 | echo "Error: unable to create "$HOST_DATA_DIR
114 | exit
115 | fi
116 |
117 | done
118 |
119 | echo
120 | echo -n "Waiting for cluster and ensemble startup... "
121 | echo
122 |
123 | NETWORK_NAME="${APP//-}_default"
124 |
125 | NETWORK=$($DOCKER_BIN network ls | grep "${NETWORK_NAME}" | awk '{print $1}')
126 | if [[ -z $NETWORK ]]; then
127 | $DOCKER_BIN network create ${NETWORK_NAME}
128 | rc=$?
129 | if [[ $rc != 0 ]]
130 | then
131 | echo "unable to create network ${NETWORK_NAME}"
132 | exit $rc
133 | fi
134 | fi
135 |
136 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml create
137 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml start
138 |
139 | echo
140 | echo
141 |
142 | # initial default zoo.cfg
143 | ZKCLIENT_PORT=2181
144 |
145 | zkhost=""
146 | conf_prefix=$APP_zoo-
147 |
148 | # Look up the zookeeper instance IPs
149 | for ((i=1; i <= cluster_size ; i++)); do
150 | if [ "A$zkhost" != "A" ]
151 | then
152 | zkhost="${zkhost},"
153 | fi
154 | zkhost="${zkhost}localhost:$ZKCLIENT_PORT"
155 | ZKCLIENT_PORT=$((ZKCLIENT_PORT+1))
156 | done
157 |
158 | echo "${zkhost}" > $ZKHOST_CFG_FILE
159 |
160 | echo "ZOO_SERVERS: ${zkhost}"
161 |
162 | echo "Ensemble ready."
163 | echo
164 |
165 | SOLR_HEAP=""
166 | SOLR_JAVA_MEM=$SOLRCLOUD_JVMFLAGS
167 |
168 | # Start the solrcloud containers
169 | SOLR_PORT=8080
170 | HOST_PREFIX=${s_container_name}-
171 |
172 | for ((i=1; i <= SOLRCLOUD_CLUSTER_SIZE ; i++)); do
173 |
174 | SOLR_PORT=$((SOLR_PORT+1))
175 | SOLR_HOSTNAME=$APP_${HOST_PREFIX}${i}_1
176 |
177 | line="localhost ${SOLR_HOSTNAME}"
178 |
179 | echo "Starting container: ${SOLR_HOSTNAME} (localhost) on port: ${SOLR_PORT} ..."
180 |
181 | done
182 |
183 | echo
184 |
185 | echo "SolrCloud cluster running!"
186 | echo
187 | echo ${HOSTS_CLUSTER}
188 |
189 | echo try connecting to http://localhost:8081/solr
190 |
191 |
192 |
--------------------------------------------------------------------------------
/solrcloud-3-nodes-zookeeper-ensemble/stop.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | function my_readlink() {
6 | case "$OSTYPE" in
7 | solaris*) echo "SOLARIS" ;;
8 | darwin*)
9 | echo $( cd "$1" ; pwd -P )
10 | ;;
11 | linux*)
12 | echo $(readlink -f $1)
13 | ;;
14 | bsd*) echo "BSD" ;;
15 | *) echo "unknown: $OSTYPE" ;;
16 | esac
17 | }
18 |
19 | PWD=$(pwd)
20 | PWD_PATH=$(my_readlink $PWD)
21 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
22 | APP=$(basename $SCRIPT_PATH)
23 |
24 | export DOCKER_COMPOSE_BIN="sudo docker-compose"
25 |
26 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml down
27 |
28 | echo
29 | echo
30 | echo "SolrCloud cluster down!"
31 | echo
32 | echo
33 |
34 |
35 |
--------------------------------------------------------------------------------
/solrcloud/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 | services:
3 | zoo-1:
4 | image: zookeeper
5 | restart: always
6 | ports:
7 | - "2181:2181"
8 | volumes:
9 | - ./data/zoo-1:/opt/persist
10 | environment:
11 | ZOO_MY_ID: 1
12 | ZOO_PORT: 2181
13 | ZOO_LOG_DIR: /opt/persist/logs
14 | ZOO_DATA_LOG_DIR: /opt/persist/data
15 | solr-1:
16 | image: solr
17 | restart: always
18 | ports:
19 | - 8081:8081
20 | volumes:
21 | - ./data/solr-1/logs:/opt/logs
22 | - ./data/solr-1/store:/store
23 | - ./data/solr-1/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
24 | environment:
25 | SOLR_PORT: 8081
26 | SOLR_HOME: /store/solr
27 | ZK_HOST: zoo-1:2181
28 | SOLR_LOGS_DIR: /opt/logs
29 | SOLR_HOST: solr-1
30 | SOLR_HEAP:
31 | SOLR_JAVA_MEM:
32 | depends_on:
33 | - zoo-1
34 |
--------------------------------------------------------------------------------
/solrcloud/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # set -x
4 | set -e
5 |
6 | function my_readlink() {
7 | case "$OSTYPE" in
8 | solaris*) echo "SOLARIS" ;;
9 | darwin*)
10 | echo $( cd "$1" ; pwd -P )
11 | ;;
12 | linux*)
13 | echo $(readlink -f $1)
14 | ;;
15 | bsd*) echo "BSD" ;;
16 | *) echo "unknown: $OSTYPE" ;;
17 | esac
18 | }
19 |
20 | PWD=$(pwd)
21 | PWD_PATH=$(my_readlink $PWD)
22 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
23 | APP=$(basename $SCRIPT_PATH)
24 |
25 |
26 | echo $APP
27 |
28 | ZK_CLUSTER_SIZE=1
29 | SOLRCLOUD_CLUSTER_SIZE=1
30 |
31 | export DOCKER_BIN="sudo docker"
32 | export DOCKER_COMPOSE_BIN="sudo docker-compose"
33 |
34 | # check if zookeeper and solr container images are present
35 |
36 | s_container_name=solr
37 | s_container_version=latest
38 |
39 | IMAGE=$($DOCKER_BIN images | grep "${s_container_name} " | grep "${s_container_version} " | awk '{print $3}')
40 | if [[ -z $IMAGE ]]; then
41 | $DOCKER_BIN pull ${s_container_name}:${s_container_version}
42 | rc=$?
43 | if [[ $rc != 0 ]]
44 | then
45 | echo "${s_container_name}:${s_container_version} image not found..."
46 | exit $rc
47 | fi
48 | fi
49 |
50 | z_container_name=zookeeper
51 | z_container_version=latest
52 |
53 | IMAGE=$($DOCKER_BIN images | grep "${z_container_name}" | grep "${z_container_version} " | awk '{print $3}')
54 | if [[ -z $IMAGE ]]; then
55 | $DOCKER_BIN pull ${z_container_name}:${z_container_version}
56 | rc=$?
57 | if [[ $rc != 0 ]]
58 | then
59 | echo "${z_container_name} image not found... Did you run 'build-images.sh' ?"
60 | exit $rc
61 | fi
62 | fi
63 |
64 | # create data dir for each cluster node
65 |
66 | SZD_DATA_DIR=$SZD_HOME/$APP/data
67 |
68 | # Need a volume to read the config from
69 | conf_prefix=zoo-
70 | conf_container=${conf_prefix}1
71 | cluster_size=$ZK_CLUSTER_SIZE
72 |
73 | for ((i=1; i <= cluster_size ; i++)); do
74 |
75 | HOST_DATA=$SZD_DATA_DIR"/${conf_prefix}${i}"
76 | if [ ! -d ${HOST_DATA} ] ; then
77 | mkdir -p ${HOST_DATA}/logs
78 | mkdir -p ${HOST_DATA}/data
79 | fi
80 |
81 | if [ ! -d ${HOST_DATA} ] ; then
82 | echo "Error: unable to create "$HOST_DATA
83 | exit
84 | fi
85 |
86 | done
87 |
88 | SOLR_HEAP=""
89 | SOLR_JAVA_MEM=$SOLRCLOUD_JVMFLAGS
90 |
91 | # Start the solrcloud containers
92 | HOST_PREFIX=${s_container_name}-
93 |
94 | for ((i=1; i <= SOLRCLOUD_CLUSTER_SIZE ; i++)); do
95 |
96 | SOLR_HOSTNAME=${HOST_PREFIX}${i}
97 | HOST_DATA_DIR=$SZD_DATA_DIR/${SOLR_HOSTNAME}
98 |
99 | if [ ! -d ${HOST_DATA_DIR} ] ; then
100 | mkdir -p ${HOST_DATA_DIR}/logs
101 | mkdir -p ${HOST_DATA_DIR}/store/solr
102 | mkdir -p ${HOST_DATA_DIR}/store/shared-lib
103 | cp -r $SZD_HOME/templates/solr/docker-entrypoint-initdb.d ${HOST_DATA_DIR}/
104 | chmod -R ugo+rw ${HOST_DATA_DIR}
105 | fi
106 |
107 | if [ ! -d ${HOST_DATA_DIR} ] ; then
108 | echo "Error: unable to create "$HOST_DATA_DIR
109 | exit
110 | fi
111 |
112 | done
113 |
114 | echo
115 | echo -n "Waiting for cluster and ensemble startup... "
116 | echo
117 |
118 | NETWORK_NAME="${APP//-}_default"
119 |
120 | NETWORK=$($DOCKER_BIN network ls | grep "${NETWORK_NAME}" | awk '{print $1}')
121 | if [[ -z $NETWORK ]]; then
122 | $DOCKER_BIN network create ${NETWORK_NAME}
123 | rc=$?
124 | if [[ $rc != 0 ]]
125 | then
126 | echo "unable to create network ${NETWORK_NAME}"
127 | exit $rc
128 | fi
129 | fi
130 |
131 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml up --no-start
132 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml start
133 |
134 | echo
135 | echo
136 |
137 | # initial default zoo.cfg
138 | ZKCLIENT_PORT=2181
139 |
140 | zkhost=""
141 | conf_prefix=$APP_zoo-
142 |
143 | # Look up the zookeeper instance IPs
144 | for ((i=1; i <= cluster_size ; i++)); do
145 | if [ "A$zkhost" != "A" ]
146 | then
147 | zkhost="${zkhost},"
148 | fi
149 | zkhost="${zkhost}localhost:$ZKCLIENT_PORT"
150 | ZKCLIENT_PORT=$((ZKCLIENT_PORT+1))
151 | done
152 |
153 | echo "ZOO_SERVERS: ${zkhost}"
154 |
155 | echo "Ensemble ready."
156 | echo
157 |
158 | SOLR_HEAP=""
159 | SOLR_JAVA_MEM=$SOLRCLOUD_JVMFLAGS
160 |
161 | # Start the solrcloud containers
162 | SOLR_PORT=8080
163 | HOST_PREFIX=${s_container_name}-
164 |
165 | for ((i=1; i <= SOLRCLOUD_CLUSTER_SIZE ; i++)); do
166 |
167 | SOLR_PORT=$((SOLR_PORT+1))
168 | SOLR_HOSTNAME=$APP_${HOST_PREFIX}${i}_1
169 |
170 | line="localhost ${SOLR_HOSTNAME}"
171 |
172 | echo "Starting container: ${SOLR_HOSTNAME} (localhost) on port: ${SOLR_PORT} ..."
173 |
174 | done
175 |
176 | echo
177 |
178 | echo "SolrCloud cluster running!"
179 | echo
180 | echo ${HOSTS_CLUSTER}
181 |
182 | echo try connecting to http://localhost:8081/solr
183 |
184 |
185 |
--------------------------------------------------------------------------------
/solrcloud/stop.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | function my_readlink() {
6 | case "$OSTYPE" in
7 | solaris*) echo "SOLARIS" ;;
8 | darwin*)
9 | echo $( cd "$1" ; pwd -P )
10 | ;;
11 | linux*)
12 | echo $(readlink -f $1)
13 | ;;
14 | bsd*) echo "BSD" ;;
15 | *) echo "unknown: $OSTYPE" ;;
16 | esac
17 | }
18 |
19 | PWD=$(pwd)
20 | PWD_PATH=$(my_readlink $PWD)
21 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
22 | APP=$(basename $SCRIPT_PATH)
23 |
24 | export DOCKER_COMPOSE_BIN="sudo docker-compose"
25 |
26 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml down
27 |
28 | echo
29 | echo
30 | echo "SolrCloud cluster down!"
31 | echo
32 | echo
33 |
34 |
35 |
--------------------------------------------------------------------------------
/start-cluster.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function my_readlink() {
4 | case "$OSTYPE" in
5 | solaris*) echo "SOLARIS" ;;
6 | darwin*)
7 | echo $( cd "$1" ; pwd -P )
8 | ;;
9 | linux*)
10 | echo $(readlink -f $1)
11 | ;;
12 | bsd*) echo "BSD" ;;
13 | *) echo "unknown: $OSTYPE" ;;
14 | esac
15 | }
16 |
17 | PWD=$(pwd)
18 | PWD_PATH=$(my_readlink $PWD)
19 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
20 | SCRIPT_NAME=$(basename "$0")
21 | SCRIPT_DIR=$(dirname $SCRIPT_PATH)
22 |
23 | if [ "$SCRIPT_PATH" == "$PWD" ]
24 | then
25 | export SZD_HOME="$SCRIPT_PATH"
26 | bash $SZD_HOME/solrcloud-3-nodes-zookeeper-ensemble/start.sh
27 | else
28 | echo ""
29 | echo "execute:"
30 | echo ""
31 | echo " cd "$SCRIPT_PATH
32 | echo " ./"$SCRIPT_NAME
33 | echo ""
34 | fi
35 |
36 |
--------------------------------------------------------------------------------
/start-zookeeper-ensemble.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function my_readlink() {
4 | case "$OSTYPE" in
5 | solaris*) echo "SOLARIS" ;;
6 | darwin*)
7 | echo $( cd "$1" ; pwd -P )
8 | ;;
9 | linux*)
10 | echo $(readlink -f $1)
11 | ;;
12 | bsd*) echo "BSD" ;;
13 | *) echo "unknown: $OSTYPE" ;;
14 | esac
15 | }
16 |
17 | PWD=$(pwd)
18 | PWD_PATH=$(my_readlink $PWD)
19 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
20 | SCRIPT_NAME=$(basename "$0")
21 | SCRIPT_DIR=$(dirname $SCRIPT_PATH)
22 |
23 | if [ "$SCRIPT_PATH" == "$PWD" ]
24 | then
25 | export SZD_HOME="$SCRIPT_PATH"
26 | bash $SZD_HOME/zookeeper-ensemble/start.sh
27 | else
28 | echo ""
29 | echo "execute:"
30 | echo ""
31 | echo " cd "$SCRIPT_PATH
32 | echo " ./"$SCRIPT_NAME
33 | echo ""
34 | fi
35 |
36 |
--------------------------------------------------------------------------------
/start-zookeeper-standalone.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function my_readlink() {
4 | case "$OSTYPE" in
5 | solaris*) echo "SOLARIS" ;;
6 | darwin*)
7 | echo $( cd "$1" ; pwd -P )
8 | ;;
9 | linux*)
10 | echo $(readlink -f $1)
11 | ;;
12 | bsd*) echo "BSD" ;;
13 | *) echo "unknown: $OSTYPE" ;;
14 | esac
15 | }
16 |
17 | PWD=$(pwd)
18 | PWD_PATH=$(my_readlink $PWD)
19 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
20 | SCRIPT_NAME=$(basename "$0")
21 | SCRIPT_DIR=$(dirname $SCRIPT_PATH)
22 |
23 | if [ "$SCRIPT_PATH" == "$PWD" ]
24 | then
25 | export SZD_HOME="$SCRIPT_PATH"
26 | bash $SZD_HOME/zookeeper/start.sh
27 | else
28 | echo ""
29 | echo "execute:"
30 | echo ""
31 | echo " cd "$SCRIPT_PATH
32 | echo " ./"$SCRIPT_NAME
33 | echo ""
34 | fi
35 |
36 |
--------------------------------------------------------------------------------
/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function my_readlink() {
4 | case "$OSTYPE" in
5 | solaris*) echo "SOLARIS" ;;
6 | darwin*)
7 | echo $( cd "$1" ; pwd -P )
8 | ;;
9 | linux*)
10 | echo $(readlink -f $1)
11 | ;;
12 | bsd*) echo "BSD" ;;
13 | *) echo "unknown: $OSTYPE" ;;
14 | esac
15 | }
16 |
17 | PWD=$(pwd)
18 | PWD_PATH=$(my_readlink $PWD)
19 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
20 | SCRIPT_NAME=$(basename "$0")
21 | SCRIPT_DIR=$(dirname $SCRIPT_PATH)
22 |
23 | command -v docker >/dev/null 2>&1 || { echo -e >&2 "Error: docker it's not installed. \n\n https://docs.docker.com/engine/installation/ \n\n "; exit 1; }
24 | command -v docker-compose >/dev/null 2>&1 || { echo -e >&2 "Error: docker-compose it's not installed. \n\n https://docs.docker.com/compose/install/ \n\n "; exit 1; }
25 |
26 |
27 | if [ "$SCRIPT_PATH" == "$PWD" ]
28 | then
29 | export SZD_HOME="$SCRIPT_PATH"
30 | bash $SZD_HOME/solrcloud/start.sh
31 | else
32 | echo ""
33 | echo "execute:"
34 | echo ""
35 | echo " cd "$SCRIPT_PATH
36 | echo " ./"$SCRIPT_NAME
37 | echo ""
38 | fi
39 |
40 |
--------------------------------------------------------------------------------
/stop-cluster.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function my_readlink() {
4 | case "$OSTYPE" in
5 | solaris*) echo "SOLARIS" ;;
6 | darwin*)
7 | echo $( cd "$1" ; pwd -P )
8 | ;;
9 | linux*)
10 | echo $(readlink -f $1)
11 | ;;
12 | bsd*) echo "BSD" ;;
13 | *) echo "unknown: $OSTYPE" ;;
14 | esac
15 | }
16 |
17 | PWD=$(pwd)
18 | PWD_PATH=$(my_readlink $PWD)
19 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
20 | SCRIPT_NAME=$(basename "$0")
21 | SCRIPT_DIR=$(dirname $SCRIPT_PATH)
22 |
23 | if [ "$SCRIPT_PATH" == "$PWD" ]
24 | then
25 | export SZD_HOME="$SCRIPT_PATH"
26 | bash $SZD_HOME/solrcloud-3-nodes-zookeeper-ensemble/stop.sh
27 | else
28 | echo ""
29 | echo "execute:"
30 | echo ""
31 | echo " cd "$SCRIPT_PATH
32 | echo " ./"$SCRIPT_NAME
33 | echo ""
34 | fi
35 |
36 |
--------------------------------------------------------------------------------
/stop-zookeeper-ensemble.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function my_readlink() {
4 | case "$OSTYPE" in
5 | solaris*) echo "SOLARIS" ;;
6 | darwin*)
7 | echo $( cd "$1" ; pwd -P )
8 | ;;
9 | linux*)
10 | echo $(readlink -f $1)
11 | ;;
12 | bsd*) echo "BSD" ;;
13 | *) echo "unknown: $OSTYPE" ;;
14 | esac
15 | }
16 |
17 | PWD=$(pwd)
18 | PWD_PATH=$(my_readlink $PWD)
19 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
20 | SCRIPT_NAME=$(basename "$0")
21 | SCRIPT_DIR=$(dirname $SCRIPT_PATH)
22 |
23 | if [ "$SCRIPT_PATH" == "$PWD" ]
24 | then
25 | export SZD_HOME="$SCRIPT_PATH"
26 | bash $SZD_HOME/zookeeper-ensemble/stop.sh
27 | else
28 | echo ""
29 | echo "execute:"
30 | echo ""
31 | echo " cd "$SCRIPT_PATH
32 | echo " ./"$SCRIPT_NAME
33 | echo ""
34 | fi
35 |
36 |
--------------------------------------------------------------------------------
/stop-zookeeper-standalone.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function my_readlink() {
4 | case "$OSTYPE" in
5 | solaris*) echo "SOLARIS" ;;
6 | darwin*)
7 | echo $( cd "$1" ; pwd -P )
8 | ;;
9 | linux*)
10 | echo $(readlink -f $1)
11 | ;;
12 | bsd*) echo "BSD" ;;
13 | *) echo "unknown: $OSTYPE" ;;
14 | esac
15 | }
16 |
17 | PWD=$(pwd)
18 | PWD_PATH=$(my_readlink $PWD)
19 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
20 | SCRIPT_NAME=$(basename "$0")
21 | SCRIPT_DIR=$(dirname $SCRIPT_PATH)
22 |
23 | if [ "$SCRIPT_PATH" == "$PWD" ]
24 | then
25 | export SZD_HOME="$SCRIPT_PATH"
26 | bash $SZD_HOME/zookeeper/stop.sh
27 | else
28 | echo ""
29 | echo "execute:"
30 | echo ""
31 | echo " cd "$SCRIPT_PATH
32 | echo " ./"$SCRIPT_NAME
33 | echo ""
34 | fi
35 |
36 |
--------------------------------------------------------------------------------
/stop.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function my_readlink() {
4 | case "$OSTYPE" in
5 | solaris*) echo "SOLARIS" ;;
6 | darwin*)
7 | echo $( cd "$1" ; pwd -P )
8 | ;;
9 | linux*)
10 | echo $(readlink -f $1)
11 | ;;
12 | bsd*) echo "BSD" ;;
13 | *) echo "unknown: $OSTYPE" ;;
14 | esac
15 | }
16 |
17 | PWD=$(pwd)
18 | PWD_PATH=$(my_readlink $PWD)
19 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
20 | SCRIPT_NAME=$(basename "$0")
21 | SCRIPT_DIR=$(dirname $SCRIPT_PATH)
22 |
23 | if [ "$SCRIPT_PATH" == "$PWD" ]
24 | then
25 | export SZD_HOME="$SCRIPT_PATH"
26 | bash $SZD_HOME/solrcloud/stop.sh
27 | else
28 | echo ""
29 | echo "execute:"
30 | echo ""
31 | echo " cd "$SCRIPT_PATH
32 | echo " ./"$SCRIPT_NAME
33 | echo ""
34 | fi
35 |
36 |
--------------------------------------------------------------------------------
/templates/solr/docker-entrypoint-initdb.d/log-config.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mv /opt/solr/bin/solr.in.sh /opt/solr/bin/solr.in.sh.orig
4 | # sed -e 's/SOLR_PORT=[0-9]\+/SOLR_PORT=${SOLR_PORT}/' /opt/solr/bin/solr.in.sh
5 |
6 | env | grep SOLR > /opt/solr/bin/solr.in.sh
7 |
8 | if [ -f /opt/solr/server/resources/log4j.properties ]
9 | then
10 | cp /opt/solr/server/resources/log4j.properties /opt/solr/server/resources/log4j.properties.orig
11 | cp /docker-entrypoint-initdb.d/log4j.properties /opt/solr/server/resources/
12 | fi
13 |
14 |
--------------------------------------------------------------------------------
/templates/solr/docker-entrypoint-initdb.d/log4j.properties:
--------------------------------------------------------------------------------
1 | # Logging level
2 | solr.log=/opt/logs
3 | log4j.rootLogger=INFO, file, CONSOLE
4 |
5 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
6 |
7 | log4j.appender.CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout
8 | #log4j.appender.CONSOLE.layout.ConversionPattern=%-4r %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
9 | log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
10 |
11 | #- size rotation with log cleanup.
12 | log4j.appender.file=org.apache.log4j.RollingFileAppender
13 | log4j.appender.file.MaxFileSize=100MB
14 | log4j.appender.file.MaxBackupIndex=9
15 |
16 | #- File to log to and log format
17 | log4j.appender.file.File=${solr.log}/solr.log
18 | log4j.appender.file.layout=org.apache.log4j.EnhancedPatternLayout
19 | log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m\n
20 |
21 | log4j.logger.org.apache.zookeeper=WARN
22 | log4j.logger.org.apache.hadoop=WARN
23 |
24 | # set to INFO to enable infostream log messages
25 | log4j.logger.org.apache.solr.update.LoggingInfoStream=OFF
26 |
27 |
--------------------------------------------------------------------------------
/templates/solr/docker-entrypoint-initdb.d/store-solr-config.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [ ! -f /store/solr/solr.xml ]
4 | then
5 | cp /opt/solr/server/solr/solr.xml /store/solr/solr.xml
6 | fi
7 |
8 |
--------------------------------------------------------------------------------
/templates/solr/solr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | /store/shared-lib
4 |
5 |
6 | ${host:}
7 | ${jetty.port:8983}
8 | ${hostContext:solr}
9 |
10 | ${genericCoreNodeNames:true}
11 |
12 | ${zkClientTimeout:30000}
13 | ${distribUpdateSoTimeout:600000}
14 | ${distribUpdateConnTimeout:60000}
15 | ${zkCredentialsProvider:org.apache.solr.common.cloud.DefaultZkCredentialsProvider}
16 | ${zkACLProvider:org.apache.solr.common.cloud.DefaultZkACLProvider}
17 |
18 |
19 |
20 |
22 | ${socketTimeout:600000}
23 | ${connTimeout:60000}
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/zkcli-util.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | export DOCKER_BIN="sudo docker"
6 |
7 | export DOCKER_COMPOSE_BIN="sudo docker-compose"
8 |
9 |
10 | function my_readlink() {
11 | case "$OSTYPE" in
12 | solaris*) echo "SOLARIS" ;;
13 | darwin*)
14 | echo $( cd "$1" ; pwd -P )
15 | ;;
16 | linux*)
17 | echo $(readlink -f $1)
18 | ;;
19 | bsd*) echo "BSD" ;;
20 | *) echo "unknown: $OSTYPE" ;;
21 | esac
22 | }
23 |
24 | PWD=$(pwd)
25 | PWD_PATH=$(my_readlink $PWD)
26 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
27 | SCRIPT_NAME=$(basename "$0")
28 | SCRIPT_DIR=$(dirname $SCRIPT_PATH)
29 |
30 | if [ "$SCRIPT_PATH" == "$PWD" ]
31 | then
32 | export SZD_HOME="$SCRIPT_PATH"
33 | else
34 | echo ""
35 | echo "execute:"
36 | echo ""
37 | echo " cd "$SCRIPT_PATH
38 | echo " ./"$SCRIPT_NAME
39 | echo ""
40 | exit
41 | fi
42 |
43 |
44 | container_name=solr
45 | container_version=6.2.1
46 |
47 | if [ "A$SZD_HOME" == "A" ]
48 | then
49 | echo "ERROR: "\$SZD_HOME" environment variable not found!"
50 | exit 1
51 | fi
52 |
53 | IMAGE=$($DOCKER_BIN images | grep "${container_name}" | grep "${container_version} " | awk '{print $3}')
54 | if [[ -z $IMAGE ]]; then
55 | $DOCKER_BIN pull ${container_name}:${container_version}
56 | rc=$?
57 | if [[ $rc != 0 ]]
58 | then
59 | echo "${container_name} image not found... Did you run 'build-images.sh' ?"
60 | exit $rc
61 | fi
62 | fi
63 |
64 | found_confdir=false
65 | found_cmd=false
66 |
67 | for item in "${@:1}"
68 | do
69 | collect_parameter=true
70 | if [ "$found_confdir" == "true" ]
71 | then
72 | WORK_PATH="$item"
73 | found_confdir=false
74 | item="/opt/conf"
75 | fi
76 |
77 | if [ "$found_cmd" == "true" ]
78 | then
79 | ZKCLI_CMD="$item"
80 | found_cmd=false
81 | fi
82 |
83 | if [ "$item" == "--cmd" ]
84 | then
85 | found_cmd=true
86 | fi
87 |
88 | if [ "$item" == "-confdir" ]
89 | then
90 | found_confdir=true
91 | fi
92 |
93 | if [ "$item" == "-d" ]
94 | then
95 | found_confdir=true
96 | fi
97 |
98 | if [ "$collect_parameter" == "true" ]
99 | then
100 | ZKCLI_PARAMS="$ZKCLI_PARAMS $item"
101 | fi
102 | done
103 |
104 | echo $ZKCLI_PARAMS
105 |
106 | if [ "A$WORK_PATH" != "A" ]
107 | then
108 |
109 | if [ ! -d "$WORK_PATH" ]
110 | then
111 | echo "ERROR: $WORK_PATH is not a directory or cannot be found..."
112 | exit 1
113 | fi
114 |
115 | case "$OSTYPE" in
116 | solaris*) echo "SOLARIS" ;;
117 | darwin*)
118 | echo "OSX"
119 | WORK_PATH=$( cd "$WORK_PATH" ; pwd -P )
120 | echo $WORK_PATH
121 | ;;
122 | linux*)
123 | echo "LINUX"
124 | WORK_PATH=$(readlink -f $WORK_PATH)
125 | ;;
126 | bsd*) echo "BSD" ;;
127 | *) echo "unknown: $OSTYPE" ;;
128 | esac
129 |
130 | WORK_PATH=$WORK_PATH
131 |
132 | if [ ! -d "$WORK_PATH" ]
133 | then
134 | echo "ERROR: $WORK_PATH is not a directory or cannot be found..."
135 | exit 1
136 | fi
137 |
138 | ZKCLI_CONTAINER_ID=$( $DOCKER_BIN run -d \
139 | -v $WORK_PATH:/opt/conf \
140 | ${container_name}:${container_version} /opt/solr/server/scripts/cloud-scripts/zkcli.sh $ZKCLI_PARAMS )
141 |
142 | # Write the config to the config container
143 |
144 | sleep 1
145 |
146 | ZKCLI_HOSTNAME=$($DOCKER_BIN inspect $ZKCLI_CONTAINER_ID | grep \"Hostname\" | sed 's/\"/ /g' | awk '{ print $3 }')
147 |
148 | echo "--- $ZKCLI_HOSTNAME"
149 |
150 | echo "---"
151 |
152 | echo -n "Waiting for execution of cmd: $ZKCLI_CMD .."
153 | while [ "A$( $DOCKER_BIN ps | grep $ZKCLI_HOSTNAME )" != "A" ] ; do echo -n "." ; sleep 1; done
154 | echo " done."
155 |
156 | $DOCKER_BIN logs $ZKCLI_HOSTNAME
157 | $DOCKER_BIN rm $ZKCLI_HOSTNAME
158 |
159 | else
160 | echo "WORK_PATH: $WORK_PATH not found."
161 |
162 | fi
163 |
164 |
--------------------------------------------------------------------------------
/zookeeper-ensemble/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 | services:
3 | zoo-1:
4 | image: zookeeper
5 | restart: always
6 | ports:
7 | - "2181:2181"
8 | volumes:
9 | - ./data/zoo-1:/opt/persist
10 | environment:
11 | ZOO_MY_ID: 1
12 | ZOO_PORT: 2181
13 | ZOO_SERVERS: server.1=zoo-1:2888:3888 server.2=zoo-2:2888:3888 server.3=zoo-3:2888:3888
14 | ZOO_LOG_DIR: /opt/persist/logs
15 | ZOO_DATA_LOG_DIR: /opt/persist/data
16 | zoo-2:
17 | image: zookeeper
18 | restart: always
19 | ports:
20 | - "2182:2182"
21 | volumes:
22 | - ./data/zoo-2:/opt/persist
23 | environment:
24 | ZOO_MY_ID: 2
25 | ZOO_PORT: 2182
26 | ZOO_SERVERS: server.1=zoo-1:2888:3888 server.2=zoo-2:2888:3888 server.3=zoo-3:2888:3888
27 | ZOO_LOG_DIR: /opt/persist/logs
28 | ZOO_DATA_LOG_DIR: /opt/persist/data
29 | zoo-3:
30 | image: zookeeper
31 | restart: always
32 | ports:
33 | - "2183:2183"
34 | volumes:
35 | - ./data/zoo-3:/opt/persist
36 | environment:
37 | ZOO_MY_ID: 3
38 | ZOO_PORT: 2183
39 | ZOO_SERVERS: server.1=zoo-1:2888:3888 server.2=zoo-2:2888:3888 server.3=zoo-3:2888:3888
40 | ZOO_LOG_DIR: /opt/persist/logs
41 | ZOO_DATA_LOG_DIR: /opt/persist/data
42 |
--------------------------------------------------------------------------------
/zookeeper-ensemble/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # set -x
4 | set -e
5 |
6 | function my_readlink() {
7 | case "$OSTYPE" in
8 | solaris*) echo "SOLARIS" ;;
9 | darwin*)
10 | echo $( cd "$1" ; pwd -P )
11 | ;;
12 | linux*)
13 | echo $(readlink -f $1)
14 | ;;
15 | bsd*) echo "BSD" ;;
16 | *) echo "unknown: $OSTYPE" ;;
17 | esac
18 | }
19 |
20 | PWD=$(pwd)
21 | PWD_PATH=$(my_readlink $PWD)
22 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
23 | APP=$(basename $SCRIPT_PATH)
24 |
25 | ZK_CLUSTER_SIZE=3
26 |
27 | [ -z "$SZD_HOME" ] && echo "ERROR: "\$SZD_HOME" environment variable not found!" && exit 1;
28 |
29 | export DOCKER_BIN="sudo docker"
30 | export DOCKER_COMPOSE_BIN="sudo docker-compose"
31 |
32 | # check if zookeeper container images are present
33 |
34 | z_container_name=zookeeper
35 | z_container_version=3.4.9
36 |
37 | IMAGE=$($DOCKER_BIN images | grep "${z_container_name}" | grep "${z_container_version} " | awk '{print $3}')
38 | if [[ -z $IMAGE ]]; then
39 | $DOCKER_BIN pull ${z_container_name}:${z_container_version}
40 | rc=$?
41 | if [[ $rc != 0 ]]
42 | then
43 | echo "${z_container_name} image not found... Did you run 'build-images.sh' ?"
44 | exit $rc
45 | fi
46 | fi
47 |
48 | # create data dir for each cluster node
49 |
50 | SZD_DATA_DIR=$SZD_HOME/$APP/data
51 |
52 | export ZKHOST_CFG_FILE=$SZD_DATA_DIR/zkhost.cfg
53 |
54 | # Need a volume to read the config from
55 | conf_prefix=zoo-
56 | conf_container=${conf_prefix}1
57 |
58 | cluster_size=$ZK_CLUSTER_SIZE
59 |
60 | for ((i=1; i <= cluster_size ; i++)); do
61 |
62 | HOST_DATA=$SZD_DATA_DIR"/${conf_prefix}${i}"
63 | if [ ! -d ${HOST_DATA} ] ; then
64 | mkdir -p ${HOST_DATA}/logs
65 | mkdir -p ${HOST_DATA}/data
66 | fi
67 |
68 | if [ ! -d ${HOST_DATA} ] ; then
69 | echo "Error: unable to create "$HOST_DATA
70 | exit
71 | fi
72 |
73 | done
74 |
75 | echo
76 | echo -n "Waiting for ensemble startup... "
77 | echo
78 |
79 | NETWORK_NAME="${APP//-}_default"
80 |
81 | NETWORK=$($DOCKER_BIN network ls | grep "${NETWORK_NAME}" | awk '{print $1}')
82 | if [[ -z $NETWORK ]]; then
83 | $DOCKER_BIN network create ${NETWORK_NAME}
84 | rc=$?
85 | if [[ $rc != 0 ]]
86 | then
87 | echo "unable to create network ${APP}_default"
88 | exit $rc
89 | fi
90 | fi
91 |
92 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml create
93 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml start
94 |
95 | echo
96 | echo
97 |
98 | # initial default zoo.cfg
99 | ZKCLIENT_PORT=2181
100 |
101 | zkhost=""
102 | conf_prefix=$APP_zoo-
103 |
104 | # Look up the zookeeper instance IPs
105 | for ((i=1; i <= cluster_size ; i++)); do
106 | if [ "A$zkhost" != "A" ]
107 | then
108 | zkhost="${zkhost},"
109 | fi
110 | zkhost="${zkhost}localhost:$ZKCLIENT_PORT"
111 | ZKCLIENT_PORT=$((ZKCLIENT_PORT+1))
112 | done
113 |
114 | echo "${zkhost}" > $ZKHOST_CFG_FILE
115 |
116 | echo "${zkhost}"
117 |
118 | echo "Ensemble ready."
119 | echo
120 |
121 | # Start the solrcloud containers
122 | echo
123 |
124 | echo "Zookeeper enseble running!"
125 | echo
126 |
127 |
--------------------------------------------------------------------------------
/zookeeper-ensemble/stop.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | function my_readlink() {
6 | case "$OSTYPE" in
7 | solaris*) echo "SOLARIS" ;;
8 | darwin*)
9 | echo $( cd "$1" ; pwd -P )
10 | ;;
11 | linux*)
12 | echo $(readlink -f $1)
13 | ;;
14 | bsd*) echo "BSD" ;;
15 | *) echo "unknown: $OSTYPE" ;;
16 | esac
17 | }
18 |
19 | PWD=$(pwd)
20 | PWD_PATH=$(my_readlink $PWD)
21 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
22 | APP=$(basename $SCRIPT_PATH)
23 |
24 | export DOCKER_COMPOSE_BIN="sudo docker-compose"
25 |
26 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml down
27 |
28 | echo
29 | echo
30 | echo "SolrCloud cluster down!"
31 | echo
32 | echo
33 |
34 |
35 |
--------------------------------------------------------------------------------
/zookeeper/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 | services:
3 | zoo-1:
4 | image: zookeeper
5 | restart: always
6 | ports:
7 | - "2181:2181"
8 | volumes:
9 | - ./data/zoo-1:/opt/persist
10 | environment:
11 | ZOO_MY_ID: 1
12 | ZOO_PORT: 2181
13 | ZOO_LOG_DIR: /opt/persist/logs
14 | ZOO_DATA_LOG_DIR: /opt/persist/data
15 |
--------------------------------------------------------------------------------
/zookeeper/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # set -x
4 | set -e
5 |
6 | function my_readlink() {
7 | case "$OSTYPE" in
8 | solaris*) echo "SOLARIS" ;;
9 | darwin*)
10 | echo $( cd "$1" ; pwd -P )
11 | ;;
12 | linux*)
13 | echo $(readlink -f $1)
14 | ;;
15 | bsd*) echo "BSD" ;;
16 | *) echo "unknown: $OSTYPE" ;;
17 | esac
18 | }
19 |
20 | PWD=$(pwd)
21 | PWD_PATH=$(my_readlink $PWD)
22 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
23 | APP=$(basename $SCRIPT_PATH)
24 |
25 | ZK_CLUSTER_SIZE=1
26 |
27 | [ -z "$SZD_HOME" ] && echo "ERROR: "\$SZD_HOME" environment variable not found!" && exit 1;
28 |
29 | export DOCKER_BIN="sudo docker"
30 | export DOCKER_COMPOSE_BIN="sudo docker-compose"
31 |
32 | # check if zookeeper container images are present
33 |
34 | z_container_name=zookeeper
35 | z_container_version=3.4.9
36 |
37 | IMAGE=$($DOCKER_BIN images | grep "${z_container_name}" | grep "${z_container_version} " | awk '{print $3}')
38 | if [[ -z $IMAGE ]]; then
39 | $DOCKER_BIN pull ${z_container_name}:${z_container_version}
40 | rc=$?
41 | if [[ $rc != 0 ]]
42 | then
43 | echo "${z_container_name} image not found... Did you run 'build-images.sh' ?"
44 | exit $rc
45 | fi
46 | fi
47 |
48 | # create data dir for each cluster node
49 |
50 | SZD_DATA_DIR=$SZD_HOME/$APP/data
51 |
52 | export ZKHOST_CFG_FILE=$SZD_DATA_DIR/zkhost.cfg
53 |
54 | # Need a volume to read the config from
55 | conf_prefix=zoo-
56 | conf_container=${conf_prefix}1
57 |
58 | cluster_size=$ZK_CLUSTER_SIZE
59 |
60 | for ((i=1; i <= cluster_size ; i++)); do
61 |
62 | HOST_DATA=$SZD_DATA_DIR"/${conf_prefix}${i}"
63 | if [ ! -d ${HOST_DATA} ] ; then
64 | mkdir -p ${HOST_DATA}/logs
65 | mkdir -p ${HOST_DATA}/data
66 | fi
67 |
68 | if [ ! -d ${HOST_DATA} ] ; then
69 | echo "Error: unable to create "$HOST_DATA
70 | exit
71 | fi
72 |
73 | done
74 |
75 | echo
76 | echo -n "Waiting for ensemble startup... "
77 | echo
78 |
79 | NETWORK_NAME="${APP//-}_default"
80 |
81 | NETWORK=$($DOCKER_BIN network ls | grep "${NETWORK_NAME}" | awk '{print $1}')
82 | if [[ -z $NETWORK ]]; then
83 | $DOCKER_BIN network create ${NETWORK_NAME}
84 | rc=$?
85 | if [[ $rc != 0 ]]
86 | then
87 | echo "unable to create network ${APP}_default"
88 | exit $rc
89 | fi
90 | fi
91 |
92 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml create
93 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml start
94 |
95 | echo
96 | echo
97 |
98 | # initial default zoo.cfg
99 | ZKCLIENT_PORT=2181
100 |
101 | zkhost=""
102 | conf_prefix=$APP_zoo-
103 |
104 | # Look up the zookeeper instance IPs
105 | for ((i=1; i <= cluster_size ; i++)); do
106 | if [ "A$zkhost" != "A" ]
107 | then
108 | zkhost="${zkhost},"
109 | fi
110 | zkhost="${zkhost}localhost:$ZKCLIENT_PORT"
111 | ZKCLIENT_PORT=$((ZKCLIENT_PORT+1))
112 | done
113 |
114 | echo "${zkhost}" > $ZKHOST_CFG_FILE
115 |
116 | echo "${zkhost}"
117 |
118 | echo "Ensemble ready."
119 | echo
120 |
121 | # Start the solrcloud containers
122 | echo
123 |
124 | echo "Zookeeper enseble running!"
125 | echo
126 |
127 |
--------------------------------------------------------------------------------
/zookeeper/stop.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | function my_readlink() {
6 | case "$OSTYPE" in
7 | solaris*) echo "SOLARIS" ;;
8 | darwin*)
9 | echo $( cd "$1" ; pwd -P )
10 | ;;
11 | linux*)
12 | echo $(readlink -f $1)
13 | ;;
14 | bsd*) echo "BSD" ;;
15 | *) echo "unknown: $OSTYPE" ;;
16 | esac
17 | }
18 |
19 | PWD=$(pwd)
20 | PWD_PATH=$(my_readlink $PWD)
21 | SCRIPT_PATH=$(my_readlink $(dirname "$0"))
22 | APP=$(basename $SCRIPT_PATH)
23 |
24 | export DOCKER_COMPOSE_BIN="sudo docker-compose"
25 |
26 | $DOCKER_COMPOSE_BIN -f $SZD_HOME/$APP/docker-compose.yml down
27 |
28 | echo
29 | echo
30 | echo "SolrCloud cluster down!"
31 | echo
32 | echo
33 |
34 |
35 |
--------------------------------------------------------------------------------