执行 solr -help 出现很多提示, 如下
Usage: solr COMMAND OPTIONS
where COMMAND is one of: start, stop, restart, healthcheck, create, creat
e_core, create_collection, delete, version, upconfig, downconfig
Standalone server example (start Solr running in the background on port 8984):
solr start -p 8984
SolrCloud example (start Solr running in SolrCloud mode using localhost:2181 t
o connect to Zookeeper, with 1g max heap size and remote Java debug options enab
led):
solr start -c -m 1g -z localhost:2181 -a "-Xdebug -Xrunjdwp:transport=dt_soc
ket,server=y,suspend=n,address=1044"
Pass -help after any COMMAND to see command-specific usage information,
such as: solr start -help or solr stop -help
start
Usage: solr start [-f] [-c] [-h hostname] [-p port] [-d directory] [-z zkHost] [
-m memory] [-e example] [-s solr.solr.home] [-a "additional-options"] [-V]
-f Start Solr in foreground; default starts Solr in the background
and sends stdout / stderr to solr-PORT-console.log
-c or -cloud Start Solr in SolrCloud mode; if -z not supplied, an embedded Zo
okeeper
instance is started on Solr port+1000, such as 9983 if Solr is
bound to 8983
-h host Specify the hostname for this Solr instance
-p port Specify the port to start the Solr HTTP listener on; default is
8983
-d dir Specify the Solr server directory; defaults to example
-z zkHost Zookeeper connection string; only used when running in SolrCloud
mode using -c
To launch an embedded Zookeeper instance, don't pass this para
meter.
-m memory Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such a
s: -m 4g
results in: -Xms4g -Xmx4g; by default, this script sets the he
ap size to 512m
-s dir Sets the solr.solr.home system property; Solr will create core d
irectories under
this directory. This allows you to run multiple Solr instances
on the same host
while reusing the same server directory set using the -d param
eter. If set, the
specified directory should contain a solr.xml file, unless sol
r.xml exists in Zookeeper.
This parameter is ignored when running examples (-e), as the s
olr.solr.home depends
on which example is run. The default value is server/solr.
-e example Name of the example to run; available examples:
cloud: SolrCloud example
techproducts: Comprehensive example illustrating many of Solr's core cap
abilities
dih: Data Import Handler
schemaless: Schema-less example
-a opts Additional parameters to pass to the JVM when starting Solr, suc
h as to setup
Java debug options. For example, to enable a Java debugger to at
tach to the Solr JVM
you could pass: -a "-agentlib:jdwp=transport=dt_socket,server=y,
suspend=n,address=18983"
In most cases, you should wrap the additional parameters in doub
le quotes.
-noprompt Don't prompt for input; accept all defaults when running example
s that accept user input
-V Verbose messages from this script
stop
restart
healthcheck
create
Usage: solr create [-c name] [-d confdir] [-n confname] [-shards #] [-replicatio
nFactor #] [-p port]
根据Solr 是standalone模式运行还是SolrCloud模式运行, 分别去创建一个core 或是一个collection. 换句话说, 这个动作检测Solr的运行模式, 然后采取相应的动作(appropriate action): create_core 或 create_collection
更多详情: 使用说明,可以这样做(usage instructions, do:)
bin\solr create_core -help
或
bin\solr create_collection -help
create_core
在D:\JavaProgram\solr-6.0.0\bin>下运行命令:
solr create_core -help
结果:
Usage: solr create_core [-c name] [-d confdir] [-p port]
-c name
需要创建的core的名字
-d confdir
创建一个新的core时,需要拷贝的配置目录, 内置选项有(built-in options):
//最低的Minimal Solr配置
basic_configs:
//用可启用的字段猜测支持,去管理schema
data_driven_schema_configs:
//简单的配置, 它可以启用很多可选的feat ures 去demonstrate Solr的所有的功能
sample_techproducts_configs
如果没有指定, 默认的就是: data_driven_schema_configs
可选择地(Alternatively), 你可以传递路径到你自己的配置目录下, 这样可替换使用的内置的配置 例如:
bin\solr create_core -c mycore -d c:/tmp/myconfig
-p port
指的是实例的本地端口, 你想创建的新的核心就在这个实例上.
如果没有指定(specified), 这个脚本会搜索本地系统的一个运行中的Solr实例. 它会用找到的第一个服务器的端口