Solr(5.2.1)安装、启动和建立索引
来源:互联网 发布:王克晶java 编辑:程序博客网 时间:2024/05/18 12:34
总结solr的下载、安装、启动和建立索引的过程。
下载:
官网查找最新版本的下载地址:http://lucene.apache.org/solr/
# wget http://mirror.bit.edu.cn/apache/lucene/solr/5.2.1/solr-5.2.1.tgz
解压:
# tar zxvf solr-5.2.1.tgz
如果是下载zip文件,解压:
# unzip solr-5.2.1.zip
确保系统中已经安装了JRE1.7或以上版本
Cloud模式启动:
查看启动命令的参数:
# bin/solr --help
- -e:example,启动一个自带的实例
- -noprompt:不提示输入参数,所有都是缺省的
启动一个自带例子(solrCloud):
# bin/solr start -e cloud -noprompt
提示摘要:
Waiting to see Solr listening on port 8983 [/]
Started Solr server on port 8983 (pid=10344). Happy searching!
Waiting to see Solr listening on port 7574 [/]
Started Solr server on port 7574 (pid=10502). Happy searching!
Connecting to ZooKeeper at localhost:9983
Uploading /opt/app/solr-5.2.1/server/solr/configsets/data_driven_schema_configs/conf for config gettingstarted to ZooKeeper at localhost:9983
Creating new collection 'gettingstarted' using command:
http://192.168.0.31:8983/solr/admin/collections?action=CREATE&name=gettingstarted&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=gettingstarted
SolrCloud example running, please visit http://localhost:8983/solr
上面链接就是Solr的管理界面(把localhost替换成真实ip),如果打不开,可能是端口被防火墙禁用了:
查看端口开放状态:
> iptables -S
添加端口:
> iptables -I INPUT -p tcp --dport 8983 -j ACCEPT
(SUSE添加防火墙端口):
> vi /etc/sysconfig/SuSEfirewall2
FW_SERVICES_EXT_TCP=”22″中添加端口
> rcSuSEfirewall2 restart这样,就启动了一个下图的实例:
查看该实例的状态:
# bin/solr healthcheck -c gettingstarted
为文档建索引:
# bin/post -c gettingstarted docs/
或:
# bin/post -c gettingstarted example/exampledocs/*.xml
- -c gettingstarted:collection
- 最后那个参数:文档或文档所在的目录
查看具体的索引结果:
http://192.168.0.31:8983/solr/gettingstarted/browse
其他collection的链接:
http://<ip>:8983/solr/<collection_name>/browse
搜索方法例子:
curl "http://localhost:8983/solr/collection1/select?wt=json&indent=true&q=foundation"
curl "http://localhost:8983/solr/collection1/select?wt=json&indent=true&q=name:foundation"
更多参数说明:http://blog.csdn.net/clementad/article/details/47449629
停止solr:
bin/solr stop -all
删除启动时创建的目录:
rm -Rf example/cloud/
启动Cloud参考文档:http://lucene.apache.org/solr/quickstart.html
DIH创建索引的方法:
https://cwiki.apache.org/confluence/display/solr/Uploading+Structured+Data+Store+Data+with+the+Data+Import+Handler
Standalone模式启动:
启动:$ bin/solr start
此时,solr会在后台启动,监听8983端口。启动成功后提示:
Started Solr server on port 8983 (pid=8756). Happy searching!
(注:可能要先修改为可可执行文件:$ chmod +x solr)
查看端口是否已经在监听:$ netstat -lnp
相关命令:
$ bin/solr -help (命令概况)
$ bin/solr start -help (start命令详情)
$ bin/solr start -f (非后台启动)
$ bin/solr start -p 8984 (指定端口启动)
$ bin/solr stop -p 8983 (停止一个后台运行的solr,注:需要指定端口号,停止非后台运行的solr可以用ctrl+c)
$ bin/solr stop -all (停止所有后台运行的solr)
$ bin/solr -e techproducts (启动例子techproducts,可用的例子还有:dih, schemaless, cloud)
访问管理界面:http://<ip>:8983/solr/
注:可能需要先在防火墙中打开8983端口
此时,界面显示“No cores available”,需要创建一个core。
创建一个core:
$ ./solr create -c <name>
创建的core所在路径:./server/solr/<core_name>,solr启动的时候会搜索./server/solr下的子目录,如果其中有core.properties文件,就当做一个core来启动。
加入文件并建立索引:
$ ./post -c <core_name> <file_dir>/<file_name>
(原创文章,转载请注明转自Clement-Xu的博客)
0 0
- Solr(5.2.1)安装、启动和建立索引
- Solr(5.2.1)安装、启动和建立索引
- solr和mysql建立索引
- solr安装,以及建立索引关联数据库
- solr安装和启动
- solr安装部署、solr测试创建core、用solrj 访问solr(索引和搜索)
- Solr索引建立
- solr之建立索引
- solr建立索引
- Solr的安装和启动
- solr对数据库建立索引
- Solr对数据库建立索引
- Solr对数据库建立索引
- Solr学习总结(三)建立第一个索引
- 2.myql数据导入到solr,并建立solr索引(学习笔记)
- 全文检索技术 solr(三)solr安装、启动
- 1、solr的安装启动及运行
- 如何使用solr对文件建立索引
- win7打不开chm格式文件
- Android.SQLite数据库:初始化数据库并插入默认数据记录注意点
- HttpURLConnection和HttpClient的用法
- 杭电 1301 Jungle Roads 【最小生成树&&Kruskal】
- 构造方法,文档编写
- Solr(5.2.1)安装、启动和建立索引
- Debian编译Android源码
- 提升vs2013、vs2015管理员权限win8.1
- hdu 5371 Hotaru's problem (Manacher算法)
- hdu 1181 变形课 DFS
- 如何限制访问一些网站
- fd to filename
- Lua数据库/MySQL操作
- 快速幂。素数筛选。辗转相除。