在CentOS下安装Solr5.3(2)

-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

# ./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

安装solr服务脚本用法

1.运行安装脚本

# /tmp/solr-5.3.0/bin/install_solr_service.sh

ERROR: Must specify the path to the Solr installation archive, such as solr-5.0.0.tgz

Usage: install_solr_service.sh path_to_solr_distribution_archive OPTIONS

The first argument to the script must be a path to a Solr distribution archive, such as solr-5.0.0.tgz      (only .tgz or .zip are supported formats for the archive)

Supported OPTIONS include:

-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                This script will create the specified user account if it does not exist.

NOTE: Must be run as the root user

创建集合

在这个部分,我们创建一个简单的Solr集合。

Solr可以有多个集合,但在这个示例,我们只使用一个。使用如下命令,创建一个新的集合。我们以solr用户运行以避免任何权限错误。

# su - solr -c "/usr/local/solr/solr/bin/solr create -c gettingstarted -n data_driven_schema_configs"

在这个命令中,gettingstarted是集合的名字,-n指定配置集合。Solr默认提供了3个配置集合。这里我们使用的是schemaless,意思是可以提供任意名字的任意列,类型将会被猜测。

Setup new core instance directory:  /data/solr/data/gettingstarted

Creating new core 'gettingstarted' using command:  :8983/solr/admin/cores?action=CREATE&name=gettingstarted&instanceDir=gettingstarted

{    "responseHeader":{        "status":0,        "QTime":3247},      "core":"gettingstarted"}

你现在已经创建了集合,并可以开始添加数据。默认的架构只需要提供一列:id。没有其他默认列,只有动态列。

添加和查询文档

在这个部分,我们将浏览Solr Web界面,添加一些文档到集合中。

问你使用Web浏览器访问:8983/solr,Solr Web界面将会显示为:

image

这个Web界面包含大量的有用信息,可以被用于调试在使用中产生的任何问题。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/55b8a542b8be86845d8a9b5951006eab.html