solr-5.5
centos-6.5
= 安装solr:
[ solr-5.5.0]# tar zxf solr-5.5.0.tgz
= 运行solr:
[ solr-5.5.0]# bin/solr start #后台运行
[ solr-5.5.0]# bin/solr stop
= Solr脚本选项:
$ bin/solr start -help
运行
$ bin/solr start -f #前台运行
$ bin/solr start -p 8984 #指定端口运行
停止
$ bin/solr stop #停止solr
$ bin/solr stop -p 8984
$ bin/solr stop -all
实例
$ bin/solr -e techproducts #运行solr实例: techproducts, dih, schemaless, cloud(SolrCloud模式)
状态
$ bin/solr status #查看solr运行状态
创建core
$ bin/solr create -c <name>
添加文档索引
$ bin/post #用于索引文档的命令行工具
查询示例
http://localhost:8983/solr/gettingstarted/select?q=video
http://localhost:8983/solr/gettingstarted/select?q=video&fl=id,name,price
http://localhost:8983/solr/gettingstarted/select?q=name:black
http://localhost:8983/solr/gettingstarted/select?q=price:[0%20TO%20400]&fl=id,name
http://localhost:8983/solr/gettingstarted/select?q=price:[0%20TO%20400]&fl=id,name
,price&facet=true&facet.field=cat
= Solr启动脚本参考
- 启动和停止
bin/solr start # -h localhost -p 8983 -d server -s solr -m 512m
bin/solr restart
bin/solr start -a "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044" #JVM参数
bin/solr start -d newServerDir # server目录:默认是server($SOLR_HOME/server)
bin/solr start -s newHome # solr.solr.home目录:默认是server/solr
bin/solr start -h search.mysolr.com # 指定主机名启动,默认localhost
bin/solr start -m 1g # JVM参数: min (-Xms) and max (-Xmx)
bin/solr start -V # 输出详细信息
bin/solr start -c # -cloud: SolrCloud模式
bin/solr start -c -zserver1:2181,server2:2181 # 使用指定的ZooKeeper服务,默认启动内置ZooKeeper, solr端口+1000
bin/solr start -Dsolr.autoSoftCommit.maxTime=3000 # -D设置java系统属性
# 如果ZooKeeper连接包含chroot,在启动SolrCloud之前,需要运行下列脚本:
server/scripts/cloud-scripts/zkcli.sh -zkhost localhost:2181/solr -cmd bootstrap -solrhome server/solr
bin/solr stop
bin/solr stop -p 8983
bin/solr stop -all
bin/solr stop -k solrrocks # 防止误杀,默认是solrrocks (-DSTOP.KEY=solrrocks)
- 信息
bin/solr version
bin/solr status
bin/solr healthcheck
- Collection和Core
bin/solr create -c mycollection # 创建Collection或Core
bin/solr create -d basic_configs # 拷贝哪个配置目录,默认data_driven_schema_configs (在${installDir}/server/solr/configsets/路径下)
bin/solr create -n basic # for Zookeeper
bin/solr create -p 8983
bin/solr create -s 2 # shards,1
bin/solr create -rf 2 # replicationFactor
bin/solr delete -c mycoll
bin/solr delete -p 8983
bin/solr delete -deleteConfig false
- ZooKeeper操作 (SolrCloud)
上传ConfigSet:
bin/solr zk
-upconfig
-n myconfig
-d /absolute/path/to/configset/source # -d directory_under_configsets($SOLR_HOME/server/solr/configsets)
-z 123.321.23.43:2181
下载一个ConfigSet:
bin/solr zk
-downconfig
-z 111.222.333.444:2181
-n mynewconfig
centos-6.5
= 安装solr:
[ solr-5.5.0]# tar zxf solr-5.5.0.tgz
= 运行solr:
[ solr-5.5.0]# bin/solr start #后台运行
[ solr-5.5.0]# bin/solr stop
= Solr脚本选项:
帮助
$ bin/solr -help #查看帮助$ bin/solr start -help
运行
$ bin/solr start -f #前台运行
$ bin/solr start -p 8984 #指定端口运行
停止
$ bin/solr stop #停止solr
$ bin/solr stop -p 8984
$ bin/solr stop -all
实例
$ bin/solr -e techproducts #运行solr实例: techproducts, dih, schemaless, cloud(SolrCloud模式)
状态
$ bin/solr status #查看solr运行状态
创建core
$ bin/solr create -c <name>
添加文档索引
$ bin/post #用于索引文档的命令行工具
查询示例
http://localhost:8983/solr/gettingstarted/select?q=video
http://localhost:8983/solr/gettingstarted/select?q=video&fl=id,name,price
http://localhost:8983/solr/gettingstarted/select?q=name:black
http://localhost:8983/solr/gettingstarted/select?q=price:[0%20TO%20400]&fl=id,name
http://localhost:8983/solr/gettingstarted/select?q=price:[0%20TO%20400]&fl=id,name
,price&facet=true&facet.field=cat
= Solr启动脚本参考
- 启动和停止
bin/solr start # -h localhost -p 8983 -d server -s solr -m 512m
bin/solr restart
bin/solr start -a "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044" #JVM参数
bin/solr start -d newServerDir # server目录:默认是server($SOLR_HOME/server)
bin/solr start -s newHome # solr.solr.home目录:默认是server/solr
bin/solr start -h search.mysolr.com # 指定主机名启动,默认localhost
bin/solr start -m 1g # JVM参数: min (-Xms) and max (-Xmx)
bin/solr start -V # 输出详细信息
bin/solr start -c # -cloud: SolrCloud模式
bin/solr start -c -zserver1:2181,server2:2181 # 使用指定的ZooKeeper服务,默认启动内置ZooKeeper, solr端口+1000
bin/solr start -Dsolr.autoSoftCommit.maxTime=3000 # -D设置java系统属性
# 如果ZooKeeper连接包含chroot,在启动SolrCloud之前,需要运行下列脚本:
server/scripts/cloud-scripts/zkcli.sh -zkhost localhost:2181/solr -cmd bootstrap -solrhome server/solr
bin/solr stop
bin/solr stop -p 8983
bin/solr stop -all
bin/solr stop -k solrrocks # 防止误杀,默认是solrrocks (-DSTOP.KEY=solrrocks)
- 信息
bin/solr version
bin/solr status
bin/solr healthcheck
- Collection和Core
bin/solr create -c mycollection # 创建Collection或Core
bin/solr create -d basic_configs # 拷贝哪个配置目录,默认data_driven_schema_configs (在${installDir}/server/solr/configsets/路径下)
bin/solr create -n basic # for Zookeeper
bin/solr create -p 8983
bin/solr create -s 2 # shards,1
bin/solr create -rf 2 # replicationFactor
bin/solr delete -c mycoll
bin/solr delete -p 8983
bin/solr delete -deleteConfig false
- ZooKeeper操作 (SolrCloud)
上传ConfigSet:
bin/solr zk
-upconfig
-n myconfig
-d /absolute/path/to/configset/source # -d directory_under_configsets($SOLR_HOME/server/solr/configsets)
-z 123.321.23.43:2181
下载一个ConfigSet:
bin/solr zk
-downconfig
-z 111.222.333.444:2181
-n mynewconfig
-d directory_under_configsets # -d /absolute/path/to/configset/destination