Solr常用命令

1,./solr start -noprompt 单机启动solr

2,集群方式启动:./solr -c -p 8983 -z Master.Hadoop:2181 -s /home/solr-5.3.0/server/solr_navinfo -noprompt
3,对某个目录文件添加索引:/post -c gettingstarted docs/
    -c 把索引放到指定的collection
5,停止所有solr服务:./solr stop -all
6,停止指定端口的solr服务:./solr stop -p 端口号
7,查看启动命令说明:./solr start --help
8,./solr start -e cloud -noprompt 以集群测试模式启动
9,开始各个参数说明:
  -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 illusating 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
10,./solr status 查看集群状态
11,./solr create -c 新建 collection
12,./solr delete -c 删除 collection
13,./solr healthcheck -c gettingstarted查询collection的文档数目
14, solr create [-c name] [-d confdir] [-n configName] [-shards #] [-replicationFactor #] [-p port]
15,./solr create -c poi -d poi_configs -shards 2 -replicationFactor 2

### 解决 'findstr 不是内部或外部命令' 的方法 当遇到 `findstr` 命令无法识别的情况时,这通常意味着当前环境中缺少必要的 Windows 系统工具路径配置。为了在 Solr 环境中解决此问题,可以采取以下措施: #### 1. 验证并设置环境变量 PATH 确保系统的 `%PATH%` 变量包含了 Windows 系统目录的位置,通常是 `C:\Windows\System32` 或者其他安装有 `findstr.exe` 文件的文件夹位置[^1]。 可以通过编辑系统环境变量来添加缺失的路径: - 打开控制面板 -> 系统和安全 -> 系统 -> 高级系统设置。 - 单击“环境变量”,找到 “Path” 并点击编辑按钮。 - 添加包含 `findstr.exe` 的完整路径到列表中。 #### 2. 使用替代方案 如果仍然希望继续使用 Unix 类风格的操作方式,则可以在 Solr 脚本里替换掉 `findstr` 命令为跨平台兼容的选择,比如 Python 脚本或其他可移植性强的语言实现相同功能。 ```bash # 替代 findstr 实现简单的字符串匹配 grep "search_term" file.txt ``` 对于那些依赖于特定 Shell 功能的应用程序来说,考虑部署 Cygwin 或 Git Bash 这样的模拟 Linux shell 工具也是一个不错的方法,它们提供了更丰富的命令集支持。 #### 3. 安装适用于 Windows 的 GNU 工具集合 GNU Win32 Tools 提供了一系列常用的 UNIX/Linux 下的标准工具版本给 Windows 用户使用,其中包括 grep, sed 和 awk 等强大文本处理工具作为 `findstr` 的高级替代品。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值