-
Notifications
You must be signed in to change notification settings - Fork 611
/
solr
executable file
·1986 lines (1803 loc) · 74.7 KB
/
solr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# CONTROLLING STARTUP:
#
# Use solr -help to see available command-line options. In addition
# to passing command-line options, this script looks for an include
# file named solr.in.sh to set environment variables. Specifically,
# the following locations are searched in this order:
#
# <script location>/.
# $HOME/.solr.in.sh
# /usr/share/solr
# /usr/local/share/solr
# /etc/default
# /var/solr
# /opt/solr
#
# Another option is to specify the full path to the include file in the
# environment. For example:
#
# $ SOLR_INCLUDE=/path/to/solr.in.sh solr start
#
# Note: This is particularly handy for running multiple instances on a
# single installation, or for quick tests.
#
# Finally, developers and enthusiasts who frequently run from an Git
# checkout, and do not want to locally modify bin/solr.in.sh, can put
# a customized include file at ~/.solr.in.sh.
#
# If you would rather configure startup entirely from the environment, you
# can disable the include by exporting an empty SOLR_INCLUDE, or by
# ensuring that no include files exist in the aforementioned search list.
SOLR_SCRIPT="$0"
verbose=false
THIS_OS=$(uname -s)
# What version of Java is required to run this version of Solr.
JAVA_VER_REQ=11
stop_all=false
# for now, we don't support running this script from cygwin due to problems
# like not having lsof, ps auxww, curl, and awkward directory handling
if [ "${THIS_OS:0:6}" == "CYGWIN" ]; then
echo -e "This script does not support cygwin due to severe limitations and lack of adherence\nto BASH standards, such as lack of lsof, curl, and ps options.\n\nPlease use the native solr.cmd script on Windows!"
exit 1
fi
# Alpine Linux BusyBox comes with a stripped down ps, make sure we have a fully featured one
# shellcheck disable=SC2046
if [ $$ -ne $(ps -o pid='' -p $$ || echo 0) ] ; then
echo -e "This script relies on a version of ps that supports the -p flag.\n\nPlease install a POSIX compliant version and try again."
exit 1
fi
# This helps with debugging when running bats tests but not the whole script is compliant yet
# set -u
# set -o pipefail
# Resolve symlinks to this script
while [ -h "$SOLR_SCRIPT" ] ; do
ls=$(ls -ld "$SOLR_SCRIPT")
# Drop everything prior to ->
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '/.*' > /dev/null; then
SOLR_SCRIPT="$link"
else
SOLR_SCRIPT=$(dirname "$SOLR_SCRIPT")/"$link"
fi
done
CDPATH='' # Prevent "file or directory not found" for 'cdpath' users
SOLR_TIP=$(dirname "$SOLR_SCRIPT")/..
# shellcheck disable=SC2164
SOLR_TIP_SYM=$(cd "$SOLR_TIP"; pwd -L)
# shellcheck disable=SC2164
SOLR_TIP=$(cd "$SOLR_TIP"; pwd -P)
DEFAULT_SERVER_DIR="$SOLR_TIP/server"
# If an include wasn't specified in the environment, then search for one...
if [[ -z "${SOLR_INCLUDE:-}" ]]; then
# Locations (in order) to use when searching for an include file.
for include in "$(dirname "$0")/solr.in.sh" \
"$HOME/.solr.in.sh" \
/usr/share/solr/solr.in.sh \
/usr/local/share/solr/solr.in.sh \
/etc/default/solr.in.sh \
/var/solr/solr.in.sh \
/opt/solr/solr.in.sh; do
if [ -r "$include" ]; then
SOLR_INCLUDE="$include"
. "$include"
break
fi
done
elif [ -r "$SOLR_INCLUDE" ]; then
. "$SOLR_INCLUDE"
fi
# Export variables we want to make visible to Solr sub-process
for var in $(compgen -e); do
if [[ "$var" =~ ^(SOLR_.*|DEFAULT_CONFDIR|ZK_.*|GCS_BUCKET|GCS_.*|S3_.*|OTEL_.*|AWS_.*)$ ]]; then
export "${var?}"
fi
done
# if pid dir is unset, default to $solr_tip/bin
: "${SOLR_PID_DIR:=$SOLR_TIP/bin}"
if [ -n "${SOLR_JAVA_HOME:-}" ]; then
JAVA="$SOLR_JAVA_HOME/bin/java"
JSTACK="$SOLR_JAVA_HOME/bin/jstack"
elif [ -n "${JAVA_HOME:-}" ]; then
for java in "$JAVA_HOME"/bin/amd64 "$JAVA_HOME"/bin; do
if [ -x "$java/java" ]; then
JAVA="$java/java"
if [ -x "$java/jstack" ]; then
JSTACK="$java/jstack"
elif [ -x "$(command -v jattach)" ]; then
JATTACH="$(command -v jattach)"
else
echo >&2 "neither jattach nor jstack in $JAVA_HOME could be found, so no thread dumps are possible. Continuing."
fi
break
fi
done
if [ -z "$JAVA" ]; then
echo >&2 "The currently defined JAVA_HOME ($JAVA_HOME) refers"
echo >&2 "to a location where Java could not be found. Aborting."
echo >&2 "Either fix the JAVA_HOME variable or remove it from the"
echo >&2 "environment so that the system PATH will be searched."
exit 1
fi
else
JAVA=java
JSTACK=jstack
fi
: "${SOLR_STOP_WAIT:=180}"
: "${SOLR_START_WAIT:=$SOLR_STOP_WAIT}" # defaulting to $SOLR_STOP_WAIT for backwards compatibility reasons
# Store whether a solr port was explicitly provided, for the "solr stop" command.
PROVIDED_SOLR_PORT="${SOLR_PORT:-}"
: "${SOLR_PORT:=8983}"
export SOLR_PORT
# test that Java exists, is executable and correct version
JAVA_VER=$("$JAVA" -version 2>&1)
# shellcheck disable=SC2181
if [[ $? -ne 0 ]] ; then
echo >&2 "Java not found, or an error was encountered when running java."
echo >&2 "A working Java $JAVA_VER_REQ JRE is required to run Solr!"
echo >&2 "Please install latest version of Java $JAVA_VER_REQ or set JAVA_HOME properly."
echo >&2 "Command that we tried: '${JAVA} -version', with response:"
echo >&2 "${JAVA_VER}"
echo >&2
echo >&2 "Debug information:"
echo >&2 "JAVA_HOME: ${JAVA_HOME:-N/A}"
echo >&2 "Active Path:"
echo >&2 "${PATH}"
exit 1
else
JAVA_VER_NUM=$(echo "$JAVA_VER" | grep -v '_OPTIONS' | head -1 | awk -F '"' '/version/ {print $2}' | sed -e's/^1\.//' | sed -e's/[._-].*$//')
if [[ "$JAVA_VER_NUM" -lt "$JAVA_VER_REQ" ]] ; then
echo >&2 "Your current version of Java is too old to run this version of Solr."
echo >&2 "We found major version $JAVA_VER_NUM, using command '${JAVA} -version', with response:"
echo >&2 "${JAVA_VER}"
echo >&2
echo >&2 "Please install latest version of Java $JAVA_VER_REQ or set JAVA_HOME properly."
echo >&2
echo >&2 "Debug information:"
echo >&2 "JAVA_HOME: ${JAVA_HOME:-N/A}"
echo >&2 "Active Path:"
echo >&2 "${PATH}"
exit 1
fi
JAVA_VENDOR="Oracle"
# OpenJ9 was previously known as IBM J9, this will match both
if [ "$(echo "$JAVA_VER" | grep -i -E "OpenJ9|IBM J9")" != "" ]; then
JAVA_VENDOR="OpenJ9"
fi
fi
# Select HTTP OR HTTPS related configurations
SOLR_URL_SCHEME=http
SOLR_JETTY_CONFIG=()
SOLR_SSL_OPTS=""
if [ -n "${SOLR_HADOOP_CREDENTIAL_PROVIDER_PATH:-}" ]; then
SOLR_SSL_OPTS+=" -Dhadoop.security.credential.provider.path=$SOLR_HADOOP_CREDENTIAL_PROVIDER_PATH"
fi
if [ -z "${SOLR_SSL_ENABLED:-}" ]; then
if [ -n "${SOLR_SSL_KEY_STORE:-}" ]; then
SOLR_SSL_ENABLED="true" # implicitly from earlier behaviour
else
SOLR_SSL_ENABLED="false"
fi
fi
if [ "$SOLR_SSL_ENABLED" == "true" ]; then
SOLR_JETTY_CONFIG+=("--module=https" "--lib=$DEFAULT_SERVER_DIR/solr-webapp/webapp/WEB-INF/lib/*")
if [ "${SOLR_SSL_RELOAD_ENABLED:-true}" == "true" ]; then
SOLR_JETTY_CONFIG+=("--module=ssl-reload")
SOLR_SSL_OPTS+=" -Dsolr.keyStoreReload.enabled=true"
fi
SOLR_URL_SCHEME=https
if [ -n "$SOLR_SSL_KEY_STORE" ]; then
SOLR_SSL_OPTS+=" -Dsolr.jetty.keystore=$SOLR_SSL_KEY_STORE"
if [ "${SOLR_SSL_RELOAD_ENABLED:-true}" == "true" ] && [ "${SOLR_SECURITY_MANAGER_ENABLED:-true}" == "true" ]; then
# In this case we need to allow reads from the parent directory of the keystore
SOLR_SSL_OPTS+=" -Dsolr.jetty.keystoreParentPath=$SOLR_SSL_KEY_STORE/.."
fi
fi
if [ -n "$SOLR_SSL_KEY_STORE_PASSWORD" ]; then
export SOLR_SSL_KEY_STORE_PASSWORD=$SOLR_SSL_KEY_STORE_PASSWORD
fi
if [ -n "$SOLR_SSL_KEY_STORE_TYPE" ]; then
SOLR_SSL_OPTS+=" -Dsolr.jetty.keystore.type=$SOLR_SSL_KEY_STORE_TYPE"
fi
if [ -n "$SOLR_SSL_TRUST_STORE" ]; then
SOLR_SSL_OPTS+=" -Dsolr.jetty.truststore=$SOLR_SSL_TRUST_STORE"
fi
if [ -n "$SOLR_SSL_TRUST_STORE_PASSWORD" ]; then
export SOLR_SSL_TRUST_STORE_PASSWORD=$SOLR_SSL_TRUST_STORE_PASSWORD
fi
if [ -n "$SOLR_SSL_TRUST_STORE_TYPE" ]; then
SOLR_SSL_OPTS+=" -Dsolr.jetty.truststore.type=$SOLR_SSL_TRUST_STORE_TYPE"
fi
if [ "${SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION:true}" == "true" ] ; then
SOLR_SSL_OPTS+=" -Dsolr.jetty.ssl.verifyClientHostName=HTTPS"
fi
if [ -n "$SOLR_SSL_NEED_CLIENT_AUTH" ]; then
SOLR_SSL_OPTS+=" -Dsolr.jetty.ssl.needClientAuth=$SOLR_SSL_NEED_CLIENT_AUTH"
fi
if [ -n "$SOLR_SSL_WANT_CLIENT_AUTH" ]; then
SOLR_SSL_OPTS+=" -Dsolr.jetty.ssl.wantClientAuth=$SOLR_SSL_WANT_CLIENT_AUTH"
fi
if [ -n "$SOLR_SSL_CLIENT_KEY_STORE" ]; then
SOLR_SSL_OPTS+=" -Djavax.net.ssl.keyStore=$SOLR_SSL_CLIENT_KEY_STORE"
if [ -n "$SOLR_SSL_CLIENT_KEY_STORE_PASSWORD" ]; then
export SOLR_SSL_CLIENT_KEY_STORE_PASSWORD=$SOLR_SSL_CLIENT_KEY_STORE_PASSWORD
fi
if [ -n "$SOLR_SSL_CLIENT_KEY_STORE_TYPE" ]; then
SOLR_SSL_OPTS+=" -Djavax.net.ssl.keyStoreType=$SOLR_SSL_CLIENT_KEY_STORE_TYPE"
fi
if [ "${SOLR_SSL_RELOAD_ENABLED:-true}" == "true" ] && [ "${SOLR_SECURITY_MANAGER_ENABLED:-true}" == "true" ]; then
# In this case we need to allow reads from the parent directory of the keystore
SOLR_SSL_OPTS+=" -Djavax.net.ssl.keyStoreParentPath=$SOLR_SSL_CLIENT_KEY_STORE/.."
fi
else
if [ -n "$SOLR_SSL_KEY_STORE" ]; then
SOLR_SSL_OPTS+=" -Djavax.net.ssl.keyStore=$SOLR_SSL_KEY_STORE"
fi
if [ -n "$SOLR_SSL_KEY_STORE_TYPE" ]; then
SOLR_SSL_OPTS+=" -Djavax.net.ssl.keyStoreType=$SOLR_SSL_KEY_STORE_TYPE"
fi
fi
if [ -n "$SOLR_SSL_CHECK_PEER_NAME" ]; then
SOLR_SSL_OPTS+=" -Dsolr.ssl.checkPeerName=$SOLR_SSL_CHECK_PEER_NAME -Dsolr.jetty.ssl.sniHostCheck=$SOLR_SSL_CHECK_PEER_NAME"
fi
if [ -n "$SOLR_SSL_CLIENT_TRUST_STORE" ]; then
SOLR_SSL_OPTS+=" -Djavax.net.ssl.trustStore=$SOLR_SSL_CLIENT_TRUST_STORE"
if [ -n "$SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD" ]; then
export SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD=$SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD
fi
if [ -n "$SOLR_SSL_CLIENT_TRUST_STORE_TYPE" ]; then
SOLR_SSL_OPTS+=" -Djavax.net.ssl.trustStoreType=$SOLR_SSL_CLIENT_TRUST_STORE_TYPE"
fi
else
if [ -n "$SOLR_SSL_TRUST_STORE" ]; then
SOLR_SSL_OPTS+=" -Djavax.net.ssl.trustStore=$SOLR_SSL_TRUST_STORE"
fi
if [ -n "$SOLR_SSL_TRUST_STORE_TYPE" ]; then
SOLR_SSL_OPTS+=" -Djavax.net.ssl.trustStoreType=$SOLR_SSL_TRUST_STORE_TYPE"
fi
fi
else
SOLR_JETTY_CONFIG+=("--module=http")
fi
export SOLR_URL_SCHEME
# Requestlog options
if [ "${SOLR_REQUESTLOG_ENABLED:-true}" == "true" ]; then
SOLR_JETTY_CONFIG+=("--module=requestlog")
fi
# Jetty gzip module enabled by default
if [ "${SOLR_GZIP_ENABLED:-true}" == "true" ]; then
SOLR_JETTY_CONFIG+=("--module=gzip")
fi
# Authentication options
if [ -z "${SOLR_AUTH_TYPE:-}" ] && [ -n "${SOLR_AUTHENTICATION_OPTS:-}" ]; then
echo "WARNING: SOLR_AUTHENTICATION_OPTS environment variable configured without associated SOLR_AUTH_TYPE variable"
echo " Please configure SOLR_AUTH_TYPE environment variable with the authentication type to be used."
echo " Currently supported authentication types are [kerberos, basic]"
fi
if [ -n "${SOLR_AUTH_TYPE:-}" ] && [ -n "${SOLR_AUTHENTICATION_CLIENT_BUILDER:-}" ]; then
echo "WARNING: SOLR_AUTHENTICATION_CLIENT_BUILDER and SOLR_AUTH_TYPE environment variables are configured together."
echo " Use SOLR_AUTH_TYPE environment variable to configure authentication type to be used. "
echo " Currently supported authentication types are [kerberos, basic]"
echo " The value of SOLR_AUTHENTICATION_CLIENT_BUILDER environment variable will be ignored"
fi
if [ -n "${SOLR_AUTH_TYPE:-}" ]; then
case "$(echo "$SOLR_AUTH_TYPE" | awk '{print tolower($0)}')" in
basic)
SOLR_AUTHENTICATION_CLIENT_BUILDER="org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientBuilderFactory"
;;
kerberos)
SOLR_AUTHENTICATION_CLIENT_BUILDER="org.apache.solr.client.solrj.impl.Krb5HttpClientBuilder"
;;
*)
echo "ERROR: Value specified for SOLR_AUTH_TYPE environment variable is invalid."
exit 1
esac
fi
if [ -n "${SOLR_AUTHENTICATION_CLIENT_CONFIGURER:-}" ]; then
echo "WARNING: Found unsupported configuration variable SOLR_AUTHENTICATION_CLIENT_CONFIGURER"
echo " Please start using SOLR_AUTH_TYPE instead"
fi
if [ -n "${SOLR_AUTHENTICATION_CLIENT_BUILDER:-}" ]; then
AUTHC_CLIENT_BUILDER_ARG="-Dsolr.httpclient.builder.factory=$SOLR_AUTHENTICATION_CLIENT_BUILDER"
AUTHC_OPTS="${AUTHC_CLIENT_BUILDER_ARG:-}"
fi
# This looks strange, but it is to avoid extra spaces when we have only one of the values set
AUTHC_OPTS="${AUTHC_OPTS:-}${SOLR_AUTHENTICATION_OPTS:+ $SOLR_AUTHENTICATION_OPTS}"
# Set the SOLR_TOOL_HOST variable for use when connecting to a running Solr instance
SOLR_TOOL_HOST="${SOLR_HOST:-localhost}"
export SOLR_TOOL_HOST
function print_usage() {
CMD="${1:-}"
ERROR_MSG="${2:-}"
if [ -n "${ERROR_MSG:-}" ]; then
echo -e "\nERROR: $ERROR_MSG\n"
fi
if [[ "$CMD" == "start" || "$CMD" == "restart" ]]; then
echo ""
echo "Usage: solr $CMD [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-s solr.solr.home] [-t solr.data.home] [-a \"additional-options\"] [-V]"
echo ""
echo " -f Start Solr in foreground; default starts Solr in the background"
echo " and sends stdout / stderr to solr-PORT-console.log"
echo ""
echo " -c or -cloud Start Solr in SolrCloud mode; if -z not supplied and ZK_HOST not defined in"
echo " solr.in.sh, an embedded ZooKeeper instance is started on Solr port+1000,"
echo " such as 9983 if Solr is bound to 8983"
echo ""
echo " -host <host> Specify the hostname for this Solr instance"
echo ""
echo " -p <port> Specify the port to start the Solr HTTP listener on; default is 8983"
echo " The specified port (SOLR_PORT) will also be used to determine the stop port"
echo " STOP_PORT=(\$SOLR_PORT-1000) and JMX RMI listen port RMI_PORT=(\$SOLR_PORT+10000). "
echo " For instance, if you set -p 8985, then the STOP_PORT=7985 and RMI_PORT=18985"
echo ""
echo " -d <dir> Specify the Solr server directory; defaults to server"
echo ""
echo " -z/-zkHost <zkHost> Zookeeper connection string; only used when running in SolrCloud mode using -c"
echo " If neither ZK_HOST is defined in solr.in.sh nor the -z parameter is specified,"
echo " an embedded ZooKeeper instance will be launched."
echo " Set the ZK_CREATE_CHROOT environment variable to true if your ZK host has a chroot path, and you want to create it automatically."
echo ""
echo " -m <memory> Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such as: -m 4g"
echo " results in: -Xms4g -Xmx4g; by default, this script sets the heap size to 512m"
echo ""
echo " -s <dir> Sets the solr.solr.home system property; Solr will create core directories under"
echo " this directory. This allows you to run multiple Solr instances on the same host"
echo " while reusing the same server directory set using the -d parameter. If set, the"
echo " specified directory should contain a solr.xml file, unless solr.xml exists in Zookeeper."
echo " This parameter is ignored when running examples (-e), as the solr.solr.home depends"
echo " on which example is run. The default value is server/solr. If passed relative dir,"
echo " validation with current dir will be done, before trying default server/<dir>"
echo ""
echo " -t <dir> Sets the solr.data.home system property, where Solr will store index data in <instance_dir>/data subdirectories."
echo " If not set, Solr uses solr.solr.home for config and data."
echo ""
echo " -e <example> Name of the example to run; available examples:"
echo " cloud: SolrCloud example"
echo " techproducts: Comprehensive example illustrating many of Solr's core capabilities"
echo " schemaless: Schema-less example (schema is inferred from data during indexing)"
echo " films: Example of starting with _default configset and adding explicit fields dynamically"
echo ""
echo " -a <jvmParams> Additional parameters to pass to the JVM when starting Solr, such as to setup"
echo " Java debug options. For example, to enable a Java debugger to attach to the Solr JVM"
echo " you could pass: -a \"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=18983\""
echo " In most cases, you should wrap the additional parameters in double quotes."
echo ""
echo " -j <jettyParams> Additional parameters to pass to Jetty when starting Solr."
echo " For example, to add configuration folder that jetty should read"
echo " you could pass: -j \"--include-jetty-dir=/etc/jetty/custom/server/\""
echo " In most cases, you should wrap the additional parameters in double quotes."
echo ""
echo " -noprompt Don't prompt for input; accept all defaults when running examples that accept user input"
echo ""
echo " -force If attempting to start Solr as the root user, the script will exit with a warning that running Solr as "root" can cause problems."
echo " It is possible to override this warning with the `-force` parameter."
echo ""
echo " -v and -q Verbose (-v) or quiet (-q) logging. Sets default log level of Solr to DEBUG or WARN instead of INFO"
echo ""
echo " -V/-verbose Verbose messages from this script"
echo ""
elif [ "$CMD" == "stop" ]; then
echo ""
echo "Usage: solr stop [-k key] [-p port] [-V]"
echo ""
echo " -k <key> Stop key; default is solrrocks"
echo ""
echo " -p <port> Specify the port the Solr HTTP listener is bound to"
echo ""
echo " -all Find and stop all running Solr servers on this host"
echo ""
echo " -V/-verbose Verbose messages from this script"
echo ""
echo " NOTE: To see if any Solr servers are running, do: solr status"
echo ""
elif [ "$CMD" == "zk" ]; then
print_short_zk_usage ""
echo " Can be run on remote (non-Solr) hosts, as long as valid ZK_HOST information is provided"
echo " Be sure to check the Solr logs in case of errors."
echo ""
echo " -z zkHost Optional Zookeeper connection string for all commands. If specified it"
echo " overrides the 'ZK_HOST=...'' defined in solr.in.sh."
echo ""
echo " -V/-verbose Enable more verbose output for this script."
echo ""
echo " upconfig uploads a configset from the local machine to Zookeeper."
echo ""
echo " downconfig downloads a configset from Zookeeper to the local machine."
echo ""
echo " -n <configName> Name of the configset in Zookeeper that will be the destination of"
echo " 'upconfig' and the source for 'downconfig'."
echo ""
echo " -d <confdir> The local directory the configuration will be uploaded from for"
echo " 'upconfig' or downloaded to for 'downconfig'. If 'confdir' is a child of"
echo " ...solr/server/solr/configsets' then the configs will be copied from/to"
echo " that directory. Otherwise it is interpreted as a simple local path."
echo ""
echo " cp copies files or folders to/from Zookeeper or Zookeeper -> Zookeeper"
echo ""
echo " -r Recursively copy <src> to <dst>. Command will fail if <src> has children and "
echo " -r is not specified. Optional"
echo ""
echo " <src>, <dest> : [file:][/]path/to/local/file or zk:/path/to/zk/node"
echo " NOTE: <src> and <dest> may both be Zookeeper resources prefixed by 'zk:'"
echo " When <src> is a zk resource, <dest> may be '.'"
echo " If <dest> ends with '/', then <dest> will be a local folder or parent znode and the last"
echo " element of the <src> path will be appended unless <src> also ends in a slash. "
echo " <dest> may be zk:, which may be useful when using the cp -r form to backup/restore "
echo " the entire zk state."
echo " You must enclose local paths that end in a wildcard in quotes or just"
echo " end the local path in a slash. That is,"
echo " 'bin/solr zk cp -r /some/dir/ zk:/ -z localhost:2181' is equivalent to"
echo " 'bin/solr zk cp -r \"/some/dir/*\" zk:/ -z localhost:2181'"
echo " but 'bin/solr zk cp -r /some/dir/* zk:/ -z localhost:2181' will throw an error"
echo ""
echo " here's an example of backup/restore for a ZK configuration:"
echo " to copy to local: 'bin/solr zk cp -r zk:/ /some/dir -z localhost:2181'"
echo " to restore to ZK: 'bin/solr zk cp -r /some/dir/ zk:/ -z localhost:2181'"
echo ""
echo " The 'file:' prefix is stripped, thus 'file:/wherever' specifies an absolute local path and"
echo " 'file:somewhere' specifies a relative local path. All paths on Zookeeper are absolute."
echo ""
echo " Zookeeper nodes CAN have data, so moving a single file to a parent znode"
echo " will overlay the data on the parent Znode so specifying the trailing slash"
echo " can be important."
echo ""
echo " Wildcards are supported when copying from local, trailing only and must be quoted."
echo ""
echo " rm deletes files or folders on Zookeeper"
echo ""
echo " -r Recursively delete if <path> is a directory. Command will fail if <path>"
echo " has children and -r is not specified. Optional"
echo " <path> : [zk:]/path/to/zk/node. <path> may not be the root ('/')"
echo ""
echo " mv moves (renames) znodes on Zookeeper"
echo ""
echo " <src>, <dest> : Zookeeper nodes, the 'zk:' prefix is optional."
echo " If <dest> ends with '/', then <dest> will be a parent znode"
echo " and the last element of the <src> path will be appended."
echo " Zookeeper nodes CAN have data, so moving a single file to a parent znode"
echo " will overlay the data on the parent Znode so specifying the trailing slash"
echo " is important."
echo ""
echo " ls lists the znodes on Zookeeper"
echo ""
echo " -r Recursively descends the path listing all znodes. Optional"
echo " <path>: The Zookeeper path to use as the root."
echo ""
echo " Only the node names are listed, not data"
echo ""
echo " mkroot makes a znode in Zookeeper with no data. Can be used to make a path of arbitrary"
echo " depth but primarily intended to create a 'chroot'."
echo ""
echo " <path>: The Zookeeper path to create. Leading slash is assumed if not present."
echo " Intermediate nodes are created as needed if not present."
echo ""
elif [ "$CMD" == "auth" ]; then
echo ""
echo "Usage: solr auth enable [-type basicAuth] -credentials user:pass [-blockUnknown <true|false>] [-updateIncludeFileOnly <true|false>] [-V]"
echo " solr auth enable [-type basicAuth] -prompt <true|false> [-blockUnknown <true|false>] [-updateIncludeFileOnly <true|false>] [-V]"
echo " solr auth enable -type kerberos -config \"<kerberos configs>\" [-updateIncludeFileOnly <true|false>] [-V]"
echo " solr auth disable [-updateIncludeFileOnly <true|false>] [-V]"
echo ""
echo " Updates or enables/disables authentication. Must be run on the machine hosting Solr."
echo ""
echo " -type or -t <type> The authentication mechanism (basicAuth or kerberos) to enable. Defaults to 'basicAuth'."
echo ""
echo " -credentials <user:pass> The username and password of the initial user. Applicable for basicAuth only."
echo " Note: only one of -prompt or -credentials must be provided"
echo ""
echo " -config \"<configs>\" Configuration parameters (Solr startup parameters). Required and applicable only for Kerberos"
echo ""
echo " -solrIncludeFile <includeFilePath> Specify the full path to the include file in the environment."
echo " If not specified this script looks for an include file named solr.in.sh to set environment variables. "
echo " Specifically,the following locations are searched in this order:"
echo " <script location>/."
echo " $HOME/.solr.in.sh"
echo " /usr/share/solr"
echo " /usr/local/share/solr"
echo " /etc/default"
echo " /var/solr"
echo " /opt/solr"
echo ""
echo " -prompt <true|false> Prompts the user to provide the credentials. Applicable for basicAuth only."
echo " Note: only one of -prompt or -credentials must be provided"
echo ""
echo " -blockUnknown <true|false> When true, this blocks out access to unauthenticated users. When not provided,"
echo " this defaults to false (i.e. unauthenticated users can access all endpoints, except the"
echo " operations like collection-edit, security-edit, core-admin-edit etc.). Check the reference"
echo " guide for Basic Authentication for more details. Applicable for basicAuth only."
echo ""
echo " -updateIncludeFileOnly <true|false> Only update the solr.in.sh or solr.in.cmd file, and skip actual enabling/disabling"
echo " authentication (i.e. don't update security.json)"
echo ""
echo " -z or -zkHost <zkHost> Zookeeper connection string. Unnecessary if ZK_HOST is defined in solr.in.sh."
echo ""
echo " -d or -dir <dir> Specify the Solr server directory"
echo ""
echo " -s or -solr.home <dir> Specify the Solr home directory. This is where any credentials or authentication"
echo " configuration files (e.g. basicAuth.conf) would be placed."
echo ""
echo " -V/-verbose Enable more verbose output for this script."
echo ""
elif [ "$CMD" == "package" ]; then
echo ""
run_tool package "help"
fi
} # end print_usage
function print_short_zk_usage() {
if [ "$1" != "" ]; then
echo -e "\nERROR: $1\n"
fi
echo " Usage: solr zk upconfig|downconfig -d <confdir> -n <configName> [-z zkHost]"
echo " solr zk cp [-r] <src> <dest> [-z zkHost]"
echo " solr zk rm [-r] <path> [-z zkHost]"
echo " solr zk mv <src> <dest> [-z zkHost]"
echo " solr zk ls [-r] <path> [-z zkHost]"
echo " solr zk mkroot <path> [-z zkHost]"
echo ""
if [ "$1" == "" ]; then
echo "Type bin/solr zk -help for full usage help"
else
exit 1
fi
}
# used to show the script is still alive when waiting on work to complete
function spinner() {
local pid=$1
local delay=0.5
# shellcheck disable=SC1003
local spinstr='|/-\'
while ps -o pid='' -p "$pid" &> /dev/null ; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
}
# given a port, find the pid for a Solr process
function solr_pid_by_port() {
THE_PORT="$1"
if [ -e "$SOLR_PID_DIR/solr-$THE_PORT.pid" ]; then
PID=$(cat "$SOLR_PID_DIR/solr-$THE_PORT.pid")
CHECK_PID=$(ps -o pid='' -p "$PID" | tr -d ' ')
if [ -n "$CHECK_PID" ]; then
echo "$PID"
fi
fi
}
# extract the value of the -Djetty.port parameter from a running Solr process
function jetty_port() {
SOLR_PID="$1"
SOLR_PROC=$(ps -f -p "$SOLR_PID" | grep start\.jar | grep jetty\.port)
IFS=' ' read -a proc_args <<< "$SOLR_PROC"
for arg in "${proc_args[@]}"
do
IFS='=' read -a pair <<< "$arg"
if [ "${pair[0]}" == "-Djetty.port" ]; then
local jetty_port="${pair[1]}"
break
fi
done
echo "$jetty_port"
} # end jetty_port func
# run a Solr command-line tool using the SolrCLI class;
# useful for doing cross-platform work from the command-line using Java
function run_tool() {
# shellcheck disable=SC2086
"$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_ZK_CREDS_AND_ACLS:-} ${SOLR_TOOL_OPTS:-} -Dsolr.install.dir="$SOLR_TIP" \
-Dlog4j.configurationFile="$DEFAULT_SERVER_DIR/resources/log4j2-console.xml" \
-classpath "$DEFAULT_SERVER_DIR/solr-webapp/webapp/WEB-INF/lib/*:$DEFAULT_SERVER_DIR/lib/ext/*:$DEFAULT_SERVER_DIR/lib/*" \
org.apache.solr.cli.SolrCLI "$@"
return $?
} # end run_tool function
# get status about any Solr nodes running on this host
function get_status() {
# first, see if Solr is running
numSolrs=$(find "$SOLR_PID_DIR" -name "solr-*.pid" -type f | wc -l | tr -d ' ')
if [ "$numSolrs" != "0" ]; then
echo -e "\nFound $numSolrs Solr nodes: "
while read PIDF
do
ID=$(cat "$PIDF")
port=$(jetty_port "$ID")
if [ "$port" != "" ]; then
echo -e "\nSolr process $ID running on port $port"
run_tool status -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr" "$@"
echo ""
else
echo -e "\nSolr process $ID from $PIDF not found."
fi
done < <(find "$SOLR_PID_DIR" -name "solr-*.pid" -type f)
else
# no pid files but check using ps just to be sure
numSolrs=$(ps auxww | grep start\.jar | grep solr\.solr\.home | grep -v grep | wc -l | sed -e 's/^[ \t]*//')
if [ "$numSolrs" != "0" ]; then
echo -e "\nFound $numSolrs Solr nodes: "
PROCESSES=$(ps auxww | grep start\.jar | grep solr\.solr\.home | grep -v grep | awk '{print $2}' | sort -r)
for ID in $PROCESSES
do
port=$(jetty_port "$ID")
if [ "$port" != "" ]; then
echo ""
echo "Solr process $ID running on port $port"
run_tool status -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr" "$@"
echo ""
fi
done
else
echo -e "\nNo Solr nodes are running.\n"
run_tool status "$@"
fi
fi
} # end get_status
function run_package() {
runningSolrUrl=""
numSolrs=$(find "$SOLR_PID_DIR" -name "solr-*.pid" -type f | wc -l | tr -d ' ')
if [ "$numSolrs" != "0" ]; then
#echo -e "\nFound $numSolrs Solr nodes: "
while read PIDF
do
ID=$(cat "$PIDF")
port=$(jetty_port "$ID")
if [ "$port" != "" ]; then
#echo -e "\nSolr process $ID running on port $port"
runningSolrUrl="$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr"
break
CODE=$?
echo ""
else
echo -e "\nSolr process $ID from $PIDF not found."
CODE=1
fi
done < <(find "$SOLR_PID_DIR" -name "solr-*.pid" -type f)
else
# no pid files but check using ps just to be sure
numSolrs=$(ps auxww | grep start\.jar | grep solr\.solr\.home | grep -v grep | wc -l | sed -e 's/^[ \t]*//')
if [ "$numSolrs" != "0" ]; then
echo -e "\nFound $numSolrs Solr nodes: "
PROCESSES=$(ps auxww | grep start\.jar | grep solr\.solr\.home | grep -v grep | awk '{print $2}' | sort -r)
for ID in $PROCESSES
do
port=$(jetty_port "$ID")
if [ "$port" != "" ]; then
echo ""
echo "Solr process $ID running on port $port"
runningSolrUrl="$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr"
break
CODE=$?
echo ""
fi
done
else
echo -e "\nNo Solr nodes are running.\n"
exit 1
CODE=3
fi
fi
run_tool package -solrUrl "$runningSolrUrl" "$@"
#exit $?
}
# tries to gracefully stop Solr using the Jetty
# stop command and if that fails, then uses kill -9
# (will attempt to thread dump before killing)
function stop_solr() {
DIR="$1"
SOLR_PORT="$2"
THIS_STOP_PORT="${STOP_PORT:-$((SOLR_PORT - 1000))}"
STOP_KEY="$3"
SOLR_PID="$4"
if [ -n "$SOLR_PID" ]; then
echo -e "Sending stop command to Solr running on port $SOLR_PORT ... waiting up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop gracefully."
# shellcheck disable=SC2086
"$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_TOOL_OPTS:-} -jar "$DIR/start.jar" "STOP.PORT=$THIS_STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true
(loops=0
while true
do
# Check if a process is running with the specified PID.
# -o stat will output the STAT, where Z indicates a zombie
# stat='' removes the header (--no-headers isn't supported on all platforms)
# Note the space after '$('. It is needed to avoid confusion with special bash eval syntax
STAT=$( (ps -o stat='' -p "$SOLR_PID" || :) | tr -d ' ')
if [[ "${STAT:-Z}" != "Z" ]]; then
slept=$((loops * 2))
if [ $slept -lt $SOLR_STOP_WAIT ]; then
sleep 2
loops=$((loops+1))
else
exit # subshell!
fi
else
exit # subshell!
fi
done) &
spinner $!
rm -f "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
else
echo -e "No Solr nodes found to stop."
exit 0
fi
# Note the space after '$('. It is needed to avoid confusion with special bash eval syntax
STAT=$( (ps -o stat='' -p "$SOLR_PID" || :) | tr -d ' ')
if [[ "${STAT:-Z}" != "Z" ]]; then
if [ -n "${JSTACK:-}" ]; then
echo -e "Solr process $SOLR_PID is still running; jstacking it now."
$JSTACK "$SOLR_PID"
elif [ "$JATTACH" != "" ]; then
echo -e "Solr process $SOLR_PID is still running; jattach threaddumping it now."
$JATTACH "$SOLR_PID" threaddump
fi
echo -e "Solr process $SOLR_PID is still running; forcefully killing it now."
kill -9 "$SOLR_PID"
echo "Killed process $SOLR_PID"
rm -f "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
sleep 10
fi
# Note the space after '$('. It is needed to avoid confusion with special bash eval syntax
STAT=$( (ps -o stat='' -p "$SOLR_PID" || :) | tr -d ' ')
if [ "${STAT:-}" == "Z" ]; then
# This can happen if, for example, you are running Solr inside a docker container with multiple processes
# rather than running it is as the only service. The --init flag on docker avoids that particular problem.
echo -e "Solr process $SOLR_PID has terminated abnormally. Solr has exited but a zombie process entry remains."
exit 1
elif [ -n "${STAT:-}" ]; then
echo "ERROR: Failed to kill previous Solr Java process $SOLR_PID ... script fails."
exit 1
fi
} # end stop_solr
if [ $# -eq 1 ]; then
case $1 in
-help|-h)
run_tool ""
exit
;;
esac
fi
if [ $# -gt 0 ]; then
SCRIPT_CMD="$1"
shift
else
# no args - just show usage and exit
run_tool "$@"
exit
fi
# status tool
if [ "$SCRIPT_CMD" == "status" ]; then
get_status
exit $?
fi
# assert tool
if [ "$SCRIPT_CMD" == "assert" ]; then
run_tool assert "$@"
exit $?
fi
# healthcheck tool
if [ "$SCRIPT_CMD" == "healthcheck" ]; then
run_tool healthcheck "$@"
exit $?
fi
# config tool
if [ "$SCRIPT_CMD" == "config" ]; then
run_tool config "$@"
exit $?
fi
# create a core or collection
if [[ "$SCRIPT_CMD" == "create" ]]; then
run_tool $SCRIPT_CMD $@
exit $?
fi
# delete a core or collection
if [[ "$SCRIPT_CMD" == "delete" ]]; then
run_tool $SCRIPT_CMD $@
exit $?
fi
ZK_RECURSE=false
# Zookeeper file maintenance (upconfig, downconfig, files up/down etc.)
# It's a little clumsy to have the parsing go round and round for upconfig and downconfig, but that's
# necessary for back-compat
if [[ "$SCRIPT_CMD" == "zk" ]]; then
VERBOSE=""
if [ $# -gt 0 ]; then
while true; do
case "${1:-}" in
upconfig|downconfig|cp|rm|mv|ls|mkroot)
ZK_OP=$1
shift 1
;;
-z|-zkhost|-zkHost)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_short_zk_usage "$SCRIPT_CMD" "ZooKeeper connection string is required when using the $1 option!"
fi
ZK_HOST="$2"
shift 2
;;
-n|-confname)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_short_zk_usage "$SCRIPT_CMD" "Configuration name is required when using the $1 option!"
fi
CONFIGSET_CONFNAME="$2"
shift 2
;;
-d|-confdir)
if [[ -z "$2" || "${2:0:1}" == "-" ]]; then
print_short_zk_usage "$SCRIPT_CMD" "Configuration directory is required when using the $1 option!"
fi
CONFIGSET_CONFDIR="$2"
shift 2
;;
-r)
ZK_RECURSE="true"
shift
;;
-V|-verbose)
VERBOSE="-verbose"
shift
;;
-help|-h)
print_usage "$SCRIPT_CMD"
exit 0
;;
--)
shift
break
;;
*) # Pick up <src> <dst> or <path> params for rm, ls, cp, mv, mkroot.
if [ -z "${1:-}" ]; then
break # out-of-args, stop looping
fi
if [ -z "${ZK_SRC:-}" ]; then
ZK_SRC=$1
else
if [ -z "${ZK_DST:-}" ]; then
ZK_DST=$1
else
print_short_zk_usage "Unrecognized or misplaced command $1. 'cp' with trailing asterisk requires quoting, see help text."
fi
fi
shift
;;
esac
done
fi
if [ -z "$ZK_OP" ]; then
print_short_zk_usage "Zookeeper operation (one of 'upconfig', 'downconfig', 'rm', 'mv', 'cp', 'ls', 'mkroot') is required!"
fi
if [ -z "$ZK_HOST" ]; then
print_short_zk_usage "Zookeeper address (-z) argument is required or ZK_HOST must be specified in the solr.in.sh file."
fi
if [[ "$ZK_OP" == "upconfig" || "$ZK_OP" == "downconfig" ]]; then
if [ -z "$CONFIGSET_CONFDIR" ]; then
print_short_zk_usage "Local directory of the configset (-d) argument is required!"
fi
if [ -z "$CONFIGSET_CONFNAME" ]; then
print_short_zk_usage "Configset name on Zookeeper (-n) argument is required!"
fi
fi
if [[ "$ZK_OP" == "cp" || "$ZK_OP" == "mv" ]]; then
if [[ -z "$ZK_SRC" || -z "$ZK_DST" ]]; then
print_short_zk_usage "<source> and <destination> must be specified when using either the 'mv' or 'cp' commands."
fi
if [[ "$ZK_OP" == "cp" && "${ZK_SRC:0:3}" != "zk:" && "${ZK_DST:0:3}" != "zk:" ]]; then
print_short_zk_usage "One of the source or destination paths must be prefixed by 'zk:' for the 'cp' command."
fi
fi
if [[ "$ZK_OP" == "mkroot" ]]; then
if [[ -z "$ZK_SRC" ]]; then
print_short_zk_usage "<path> must be specified when using the 'mkroot' command."
fi
fi
case "$ZK_OP" in
upconfig)
run_tool "$ZK_OP" -confname "$CONFIGSET_CONFNAME" -confdir "$CONFIGSET_CONFDIR" -zkHost "$ZK_HOST" -configsetsDir "$SOLR_TIP/server/solr/configsets" $VERBOSE
;;
downconfig)
run_tool "$ZK_OP" -confname "$CONFIGSET_CONFNAME" -confdir "$CONFIGSET_CONFDIR" -zkHost "$ZK_HOST" $VERBOSE
;;
rm)
if [ -z "$ZK_SRC" ]; then
print_short_zk_usage "Zookeeper path to remove must be specified when using the 'rm' command"
fi
run_tool "$ZK_OP" -path "$ZK_SRC" -zkHost "$ZK_HOST" -recurse "$ZK_RECURSE" $VERBOSE
;;
mv)
run_tool "$ZK_OP" -src "$ZK_SRC" -dst "$ZK_DST" -zkHost "$ZK_HOST" $VERBOSE
;;
cp)
run_tool "$ZK_OP" -src "$ZK_SRC" -dst "$ZK_DST" -zkHost "$ZK_HOST" -recurse "$ZK_RECURSE" $VERBOSE
;;
ls)