在CentOS下安装Solr5.3
前言
Solr现在是一个独立的服务器。
从Solr5.0开始,Solr不再发布为在任何Servlet容器中部署的“war”Web应用程序包(Web Application Archive)。Solr现在部署为一个独立的java服务器应用程序,包含在Unix和Windows平台上可以使用的启动和停止脚本,以及将Solr作为服务安装到类Unix平台的/etc/init.d下的安装脚本。
本质上,Solr仍然以Servlet APIs实现,并在Jetty上运行,但只是作为一个实现。部署为“webapp”到其他的Servlet容器(或其他Jetty实例)上不被支持,可能在未来的Solr 5.x版本不会工作。而可能会带来Solr的其他改变,事实上是利用自定义网络协议栈功能。
安装JRE
需要Java Runtime Environment(JRE) 1.7或更高版本,先验证。
- [p]创建运行solr的用户并赋权# groupadd solr # useradd -g solr solr # chown -R solr.solr /data/solr /usr/local/solr
- 安装solr服务# solr-5.3.0/bin/install_solr_service.sh solr-5.3.0.tgz -d /data/solr -i /usr/local/solr
- 检查服务状态
# service solr status将会看到如下输出:Solr process 29692 running on port 8983 { "solr_home":"/data/solr/data/", "version":"5.3.0 1696229 - noble - 2015-08-17 17:10:43", "startTime":"2015-09-16T01:32:03.919Z", "uptime":"0 days, 0 hours, 3 minutes, 6 seconds", "memory":"89.8 MB (%18.3) of 490.7 MB"}
[/ol]
# ./bin/solr[/li][/ol][code]Usage: solr COMMAND OPTIONS where COMMAND is one of: start, stop, restart, status, healthcheck, create, create_core, create_collection, delete 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 to connect to ZooKeeper, with 1g max heap size and remote Java debug options enabled): ./solr start -c -m 1g -z localhost:2181 -a "-Xdebug -Xrunjdwp:transport=dt_socket,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
# ./bin/solr start -help
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 ZooKeeper 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 The specified port (SOLR_PORT) will also be used to determine the stop port STOP_PORT=($SOLR_PORT-1000) and JMX RMI listen port RMI_PORT=(1$SOLR_PORT). For instance, if you set -p 8985, then the STOP_PORT=7985 and RMI_PORT=18985 -d <dir> Specify the Solr server directory; defaults to server -z <zkHost> ZooKeeper connection string; only used when running in SolrCloud mode using -c To launch an embedded ZooKeeper instance, don't pass this parameter. -m <memory> Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such as: -m 4g results in: -Xms4g -Xmx4g; by default, this script sets the heap size to 512m -s <dir> Sets the solr.solr.home system property; Solr will create core directories 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 parameter. If set, the specified directory should contain a solr.xml file, unless solr.xml exists in ZooKeeper. This parameter is ignored when running examples (-e), as the solr.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 capabilities dih: Data Import Handler schemaless: Schema-less example -a Additional parameters to pass to the JVM when starting Solr, such as to setup Java debug options. For example, to enable a Java debugger to attach 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 double quotes. -noprompt Don't prompt for input; accept all defaults when running examples that accept user input -V Verbose messages from this script< 4000 pre class="brush:bash;toolbar:false"># ./bin/solr create -help
Usage: solr create [-c name] [-d confdir] [-n configName] [-shards #] [-replicationFactor #] [-p port] Create a core or collection depending on whether Solr is running in standalone (core) or SolrCloud mode (collection). In other words, this action detects which mode Solr is running in, and then takes the appropriate action (either create_core or create_collection). For detailed usage instructions, do: bin/solr create_core -help or bin/solr create_collection –help[p]
# su - solr -c "/usr/local/solr/solr/bin/solr create -c gettingstarted -n data_driven_schema_configs"[p]
在这个命令中,gettingstarted是集合的名字,-n指定配置集合。Solr默认提供了3个配置集合。这里我们使用的是schemaless,意思是可以提供任意名字的任意列,类型将会被猜测。
Setup new core instance directory: /data/solr/data/gettingstarted Creating new core 'gettingstarted' using command: http://localhost:8983/solr/admin/cores?action=CREATE&name=gettingstarted&instanceDir=gettingstarted { "responseHeader":{ "status":0, "QTime":3247}, "core":"gettingstarted"}
你现在已经创建了集合,并可以开始添加数据。默认的架构只需要提供一列:id。没有其他默认列,只有动态列。
[p]
- 在CentOS下安装Solr5.3
- CentOS5.3(CD版)安装(rpm)及配置DNS服务器(bind9.3.4)
- 最新Mysql-5.1.35在RHEL5.3(CentOS5.3)编译安装步骤
- CentOS 5.3 Git 安装
- centOS5.3安装oracle 10g
- Centos 5.3 安装配置JIRA,Confluence手记
- centos6.5 安装solr单机版
- 在CentOS 5/RedHat Enterprise 5.3上编译安装GeoIP
- CentOS 5.3 下源码编译安装Ipmsg 笔记
- cx_Oracle安装记录(CentOS5.3+Python2.4)
- centos5.3上安装ntfs-3g实现对NTFS分区的支持
- centos5.3安装最新cacti
- CentOS5.3+Nginx0.7.57+Postfix+Extmail邮件系统安装配置(三))-(注:里边一些内容引自原作者sery)
- CentOS 6.2编译安装CodeLite 5.3
- CentOS 5.3 安装后的基本软件配置
- CentOS下安装solr-6.6.3
- Centos 5.3 安装(Tomcat 6.0.20)
- CentOS 5.3安装过程中的问题