Solr-5.3.1安装配置
官方网站:
http://lucene.apache.org/solr/
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
http://lucene.apache.org/solr/quickstart.html
环境:
CentOS6 x64
Solr-5.3.1
从Solr5.0开始,Solr不再发布为在任何Servlet容器中部署的“war”Web应用程序包(Web Application Archive)。Solr内嵌了Jetty
一.安装jdk
tar -xvf /mnt/jdk-8u45-linux-x64.tar.gz -C /opt/
ln -s /opt/jdk-8u45-linux-x64 /opt/jdk
cat >>/etc/profile <<'HERE'
export JAVA_HOME=/opt/jdk
export PATH=$PATH:$JAVA_HOME/bin
HERE
source /etc/profile
二.新建solr用户
useradd solr
三.安装Solr
wget http://apache.fayea.com/lucene/solr/5.3.1/solr-5.3.1.tgz
tar -xvf solr-5.3.1.tgz $(tar -tvf solr-5.3.1.tgz |grep install_solr|awk '{print $6}')
sh solr-5.3.1/bin/install_solr_service.sh solr-5.3.1.tgz -i /opt -d /var/solr
root@config-p:~#sh solr-5.3.1/bin/install_solr_service.sh solr-5.3.1.tgz -i /opt -d /var/solr
Extracting solr-5.3.1.tgz to /opt
Creating /etc/init.d/solr script ...
Waiting up to 30 seconds to see Solr running on port 8983 [/]
Started Solr server on port 8983 (pid=9970). Happy searching!
Found 1 Solr nodes:
Solr process 9970 running on port 8983
{
"solr_home":"/var/solr/data/",
"version":"5.3.1 1703449 - noble - 2015-09-17 01:48:15",
"startTime":"2016-05-04T02:04:26.304Z",
"uptime":"0 days, 0 hours, 0 minutes, 11 seconds",
"memory":"88.9 MB (.1) of 490.7 MB"}
Service solr installed.
root@config-p:~#chkconfig --list solr
solr 0:off 1:off 2:on 3:on 4:on 5:on 6:off
-d Directory for live / writable Solr files, such as logs, pid files, and index data; defaults to /var/solr
-i Directory to extract the Solr installation archive; defaults to /opt/ The specified path must exist prior to using this script.
-p Port Solr should bind to; default is 8983
-s Service name; defaults to solr
-u User to own the Solr files and run the Solr process as; defaults to solr
solr团队太贴心,一个安装脚本全搞定,并自动加入开机启动四.管理
管理控制台
默认情况下,solr监听在8983端口
http://localhost:8983/solr/
web界面提供了除命令行以外友好的操作方式
创建core
1.命令行
su - solr -c "/opt/solr/bin/solr create -c gettingstarted -n data_driver"
su - solr -c "/opt/solr/bin/solr create -c gettingstarted -n data_driver"
2.POST调用
http://lucene.apache.org/solr/4_10_4/solr-core/org/apache/solr/core/SolrCore.html?is-external=true
mkdir -p /var/solr/data/post_test/data
chown -R solr: /var/solr/data/post_test
cp -a /opt/solr/server/solr/configsets/sample_techproducts_configs/conf/ /var/solr/data/post_test/
curl -XPOST http://192.168.192.10:8983/solr/admin/cores?action=CREATE&name=post_test&instanceDir=/var/solr/data/post_test&config=solrconfig.xml&schema=schema.xml&dataDir=data
3.图形界面
mkdir -p /var/solr/data/test/data
chown -R solr: /var/solr/data/test