`
arpenker
  • 浏览: 358167 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

solr8 启动集群官方流程

阅读更多
Exercise 1: Index Techproducts Example Data
This exercise will walk you through how to start Solr as a two-node cluster (both nodes on the same machine) and create a collection during startup. Then you will index some sample data that ships with Solr and do some basic searches.

Launch Solr in SolrCloud Mode
To launch Solr, run: bin/solr start -e cloud on Unix or MacOS; bin\solr.cmd start -e cloud on Windows.

This will start an interactive session that will start two Solr "servers" on your machine. This command has an option to run without prompting you for input (-noprompt), but we want to modify two of the defaults so we won’t use that option now.

solr-8.1.0:$ ./bin/solr start -e cloud

Welcome to the SolrCloud example!

This interactive session will help you launch a SolrCloud cluster on your local workstation.
To begin, how many Solr nodes would you like to run in your local cluster? (specify 1-4 nodes) [2]:
The first prompt asks how many nodes we want to run. Note the [2] at the end of the last line; that is the default number of nodes. Two is what we want for this example, so you can simply press enter.

Ok, let's start up 2 Solr nodes for your example SolrCloud cluster.
Please enter the port for node1 [8983]:
This will be the port that the first node runs on. Unless you know you have something else running on port 8983 on your machine, accept this default option also by pressing enter. If something is already using that port, you will be asked to choose another port.

Please enter the port for node2 [7574]:
This is the port the second node will run on. Again, unless you know you have something else running on port 8983 on your machine, accept this default option also by pressing enter. If something is already using that port, you will be asked to choose another port.

Solr will now initialize itself and start running on those two nodes. The script will print the commands it uses for your reference.

Starting up 2 Solr nodes for your example SolrCloud cluster.

Creating Solr home directory /solr-8.1.0/example/cloud/node1/solr
Cloning /solr-8.1.0/example/cloud/node1 into
   /solr-8.1.0/example/cloud/node2

Starting up Solr on port 8983 using command:
"bin/solr" start -cloud -p 8983 -s "example/cloud/node1/solr"

Waiting up to 180 seconds to see Solr running on port 8983 [\]
Started Solr server on port 8983 (pid=34942). Happy searching!


Starting up Solr on port 7574 using command:
"bin/solr" start -cloud -p 7574 -s "example/cloud/node2/solr" -z localhost:9983

Waiting up to 180 seconds to see Solr running on port 7574 [\]
Started Solr server on port 7574 (pid=35036). Happy searching!

INFO  - 2017-07-27 12:28:02.835; org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider; Cluster at localhost:9983 ready
Notice that two instances of Solr have started on two nodes. Because we are starting in SolrCloud mode, and did not define any details about an external ZooKeeper cluster, Solr launches its own ZooKeeper and connects both nodes to it.

After startup is complete, you’ll be prompted to create a collection to use for indexing data.

Now let's create a new collection for indexing documents in your 2-node cluster.
Please provide a name for your new collection: [gettingstarted]
Here’s the first place where we’ll deviate from the default options. This tutorial will ask you to index some sample data included with Solr, called the "techproducts" data. Let’s name our collection "techproducts" so it’s easy to differentiate from other collections we’ll create later. Enter techproducts at the prompt and hit enter.

How many shards would you like to split techproducts into? [2]
This is asking how many shards you want to split your index into across the two nodes. Choosing "2" (the default) means we will split the index relatively evenly across both nodes, which is a good way to start. Accept the default by hitting enter.

How many replicas per shard would you like to create? [2]
A replica is a copy of the index that’s used for failover (see also the Solr Glossary definition). Again, the default of "2" is fine to start with here also, so accept the default by hitting enter.

Please choose a configuration for the techproducts collection, available options are:
_default or sample_techproducts_configs [_default]
We’ve reached another point where we will deviate from the default option. Solr has two sample sets of configuration files (called a configset) available out-of-the-box.

A collection must have a configset, which at a minimum includes the two main configuration files for Solr: the schema file (named either managed-schema or schema.xml), and solrconfig.xml. The question here is which configset you would like to start with. The _default is a bare-bones option, but note there’s one whose name includes "techproducts", the same as we named our collection. This configset is specifically designed to support the sample data we want to use, so enter sample_techproducts_configs at the prompt and hit enter.

At this point, Solr will create the collection and again output to the screen the commands it issues.

Uploading /solr-8.1.0/server/solr/configsets/_default/conf for config techproducts to ZooKeeper at localhost:9983

Connecting to ZooKeeper at localhost:9983 ...
INFO  - 2017-07-27 12:48:59.289; org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider; Cluster at localhost:9983 ready
Uploading /solr-8.1.0/server/solr/configsets/sample_techproducts_configs/conf for config techproducts to ZooKeeper at localhost:9983

Creating new collection 'techproducts' using command:
http://localhost:8983/solr/admin/collections?action=CREATE&name=techproducts&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=techproducts

{
  "responseHeader":{
    "status":0,
    "QTime":5460},
  "success":{
    "192.168.0.110:7574_solr":{
      "responseHeader":{
        "status":0,
        "QTime":4056},
      "core":"techproducts_shard1_replica_n1"},
    "192.168.0.110:8983_solr":{
      "responseHeader":{
        "status":0,
        "QTime":4056},
      "core":"techproducts_shard2_replica_n2"}}}

Enabling auto soft-commits with maxTime 3 secs using the Config API

POSTing request to Config API: http://localhost:8983/solr/techproducts/config
{"set-property":{"updateHandler.autoSoftCommit.maxTime":"3000"}}
Successfully set-property updateHandler.autoSoftCommit.maxTime to 3000

SolrCloud example running, please visit: http://localhost:8983/solr
Congratulations! Solr is ready for data!

You can see that Solr is running by launching the Solr Admin UI in your web browser: http://localhost:8983/solr/. This is the main starting point for administering Solr.

Solr will now be running two "nodes", one on port 7574 and one on port 8983. There is one collection created automatically, techproducts, a two shard collection, each with two replicas.

The Cloud tab in the Admin UI diagrams the collection nicely:

tutorial solrcloud
Figure 1. SolrCloud Diagram
Index the Techproducts Data
Your Solr server is up and running, but it doesn’t contain any data yet, so we can’t do any queries.

Solr includes the bin/post tool in order to facilitate indexing various types of documents easily. We’ll use this tool for the indexing examples below.

You’ll need a command shell to run some of the following examples, rooted in the Solr install directory; the shell from where you launched Solr works just fine.

Currently the bin/post tool does not have a comparable Windows script, but the underlying Java program invoked is available. We’ll show examples below for Windows, but you can also see the Windows section of the Post Tool documentation for more details.
The data we will index is in the example/exampledocs directory. The documents are in a mix of document formats (JSON, CSV, etc.), and fortunately we can index them all at once:




简单粗暴启动solr:

E:\source\solr-8.1.1\bin>dir
驱动器 E 中的卷是 文档
卷的序列号是 000F-FF12

E:\source\solr-8.1.1\bin 的目录

2019/07/16  17:24    <DIR>          .
2019/07/16  17:24    <DIR>          ..
2019/07/16  16:44    <DIR>          init.d
2019/01/24  10:31            12,694 install_solr_service.sh
2018/03/15  10:51             1,255 oom_solr.sh
2018/10/24  14:44             8,209 post
2019/05/17  17:46            80,630 solr
2019/07/16  17:24                 6 solr-8983.port
2019/05/17  17:46            73,679 solr.cmd
2019/05/17  17:46             9,331 solr.in.cmd
2019/05/17  17:46             9,851 solr.in.sh
               8 个文件        195,655 字节
               3 个目录 53,950,095,360 可用字节

E:\source\solr-8.1.1\bin>solr start
Java HotSpot(TM) 64-Bit Server VM warning: JVM cannot use large page memory beca
use it does not have enough privilege to lock pages in memory.
Waiting up to 30 to see Solr running on port 8983
Started Solr server on port 8983. Happy searching!

分享到:
评论

相关推荐

    windows-solr集群.docx

    本文详细介绍了Solr的基础知识、单机安装配置流程、数据导入与同步方法,以及简要概述了Solr在Windows和Linux环境下的集群部署策略。通过本文的学习,读者能够掌握Solr的基本使用方法,并能在实际工作中应用这些技术...

    solr7.5官方文档

    **Solr 控制脚本参考**:介绍了 Solr 提供的一系列控制脚本,包括启动、停止服务等常用命令,方便管理员进行日常管理。 **Solr 配置文件**:详细解释了 Solr 的各种配置文件及其作用,例如 `solrconfig.xml` 和 `...

    ZooKeeper实例 + Solr(tomcat)集群部署

    ### ZooKeeper实例与Solr(tomcat)集群部署详解 #### 一、部署背景与目的 在大数据处理和搜索引擎技术领域,ZooKeeper与Solr是两个不可或缺的技术组件。ZooKeeper作为分布式协调服务,提供了高可用性以及一致性保证...

    solrCloud的集群部署

    - 使用以下命令在各节点上启动Solr实例,并连接到预先设置好的Zookeeper集群: ``` [root@node1 solr]# ./bin/solr start -cloud -z node1:2181,node2:2181,node3:2181 [root@node2 solr]# ./bin/solr start -...

    solr7.2.0 jdk1.8 tomcat8 部署

    在这个场景中,我们将讨论如何在Java Development Kit (JDK) 1.8环境下,使用Apache Tomcat 8来部署Solr 7.2.0。 首先,确保你的系统已经安装了JDK 1.8。JDK是Java开发和运行的基础,包含了编译器、JRE(Java ...

    solr安装与配置

    ### Solr安装与配置知识点详解 #### 一、Solr简介 Solr是一款开源的、高性能的全文搜索引擎,广泛...通过本文介绍的知识点,读者可以更好地理解和掌握Solr的安装与配置流程,为进一步学习和使用Solr打下坚实的基础。

    搭建Solr集群

    #### 四、Solr集群的构建流程 - **Zookeeper集群搭建**: 1. **JDK环境安装**:确保每台服务器上都安装了 JDK。 2. **上传并解压 ZooKeeper**:将 ZooKeeper 压缩包上传至服务器,并进行解压。 3. **复制 ...

    solr搜索插件

    3. **启动Solr服务器**:在解压后的目录中,有一个`bin/solr`脚本,可以用来启动Solr服务器。执行这个脚本并指定要运行的核心,Solr就会开始监听指定的端口,等待接收搜索请求。 4. **索引数据**:使用Solr提供的...

    solr6.6.2的完整的包

    3. **启动Solr**: 使用`bin/solr start`命令启动Solr服务器,或者在SolrCloud模式下,执行`bin/solr start -cloud`创建和启动集群。 4. **创建核心(Core)**: 通过Solr的管理界面或命令行工具创建一个或多个索引...

    solr-8.0.0.tgz

    4. **example目录**:提供了一个简单的Solr实例,用户可以快速上手,了解Solr的基本工作流程。 为了开始使用Solr 8.0.0,你需要按照官方文档或教程进行以下步骤: 1. 解压下载的tgz文件。 2. 进入bin目录,运行...

    apache-solr7.7

    2. **安装与配置**:在Windows上,用户只需下载并解压solr-7.7.0.zip文件,然后运行start.jar启动Solr服务器。默认情况下,它会创建一个名为“collection1”的示例集合。通过浏览器访问`...

    solr-4.5源码包

    通过分析这个源码包,开发者可以学习到如何配置和扩展Solr,理解Solr内部的工作流程,例如请求处理、查询解析、索引构建和优化、以及集群管理等。此外,对于想要为Solr贡献代码的开发者,源码包也是一个宝贵的资源,...

    solr-4.10.3

    8. **配置和集群管理**:SolrCloud是Solr-4.x引入的一项重要特性,允许用户在分布式环境中管理和配置Solr集群,提供自动故障恢复和数据分布策略。 9. **突出显示**:Solr可以自动高亮搜索关键词在文档中的出现位置...

    solr-5.4.0.tgz安装包

    8. **集群部署**:对于Cloud Solr,需要配置ZooKeeper并创建Cloud实例。多个Solr节点连接到同一ZooKeeper集群,实现数据的分布和复制。 Solr的应用场景非常广泛,包括电子商务、内容管理系统、知识库搜索、日志分析...

    solr-7.6.0.zip

    5. **Schemaless模式**:为了简化设置过程,Solr 7.6.0引入了Schemaless模式,允许用户在不定义严格Schema的情况下快速启动和测试搜索服务。系统会自动推断字段类型,但生产环境中仍推荐使用预定义的Schema以确保...

    solr6.1-scheduler1.2.jar

    此外,对于分布式Solr集群,这个定时工具可能还支持跨节点的协调,确保任务在整个集群中的同步执行。这在多节点环境下是非常必要的,因为它可以保证所有节点的索引状态保持一致,避免数据不一致的问题。 总的来说,...

    最新版linux solr-8.5.2.tgz

    3. 启动 Solr:进入解压后的目录,运行 `bin/solr start -e cloud` 初始化并启动一个带有分布式配置的 Solr。 4. 创建核心(Core):通过 Solr 的管理界面或命令行工具创建一个用于存储和处理数据的核心。 5. 配置...

    最新版linux solr-8.6.1.tgz

    - 使用Java启动Solr服务器,通常通过执行 `bin/solr start` 命令。 - 创建并配置索引库,这可以通过Solr的管理界面(称为SolrCloud或Classic UI)完成。 4. **SolrCloud和经典模式**:Solr 8.6.1支持两种运行模式...

    solr-7.0.0

    此外,Solr提供了丰富的字段类型和字段分析器,可以根据具体需求定制文本处理流程,比如去除停用词、词干化等。 搭建Solr集群是其一大亮点,通过复制和负载均衡,可以实现高可用性和水平扩展。在SolrCloud模式下,...

Global site tag (gtag.js) - Google Analytics