Linux学习笔记020---CentOs7.3 搭建 Solr单机服务

  JAVA技术交流QQ群:170933152

1.先搭建centos下的jdk环境,然后搭建ftp,这样方便上传文件

Solr是什么?

Solr是一款优秀的基于Lucene的全文检索服务器,它对Lucene进行了扩展,提供了非常丰富的查询语言,并对查询进行了性能优化。Solr和Lucene都由Apache Software Foundation(www.apache.org)管理。

Apache Solr 参考指南

http://lucene.apache.org/solr/guide/6_6/about-this-guide.html

环境

VMware版本号:12.0.0
CentOS版本:CentOS 7.3.1611
Solr 版本:solr-6.6.0
JDK环境:jdk-8u144-linux-x64.tar.gz 具体参考《CentOs7.3 安装 JDK1.8》 

https://segmentfault.com/a/1190000010716919

注意事项

关闭防火墙

$ systemctl stop firewalld.service 

Solr 安装

下载 Solr

下载最新版本的Solr ,我在北京我就选择,清华镜像比较快 , 文件大概140M

清华镜像:https://mirrors.tuna.tsinghua.edu.cn/apache/lucene/solr/6.6.0/

阿里镜像:https://mirrors.aliyun.com/apache/lucene/solr/6.6.0/

提取tar文件

$ cd /opt/
$ wget https://mirrors.tuna.tsinghua.edu.cn/apache/lucene/solr/6.6.0/solr-6.6.0.tgz
$ tar -zxf solr-6.6.0.tgz 
$ cd solr-6.6.0

Solr 操作

1.启动服务

说明:加 -force 是因为solr不允许使用 root 进行操作的,其他账户可不加

$ /opt/solr-6.6.0/bin/solr start -force

响应

Warning: Available entropy is low. As a result, use of the UUIDField, SSL, or any other features that require
RNG might not work properly. To check for the amount of available entropy, use 'cat /proc/sys/kernel/random/entropy_avail'.

NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983.

Started Solr server on port 8983 (pid=3020). Happy searching!

 

启动Solr与不同的端口,要更改Solr监听端口,可以-p在启动时使用参数

例如:

$ /opt/solr-6.6.0/bin/solr start -p 8984

2.访问管理UI

浏览器输入 ip:port

http://192.168.252.121:8983/solr/

如果Solr没有运行,您的浏览器会抱怨说它无法连接到服务器。检查您的端口号,然后重试。

3.服务状态

如果您不确定Solr是否在本地运行

$ /opt/solr-6.6.0/bin/solr status

响应

Found 1 Solr nodes: 

Solr process 4177 running on port 8983
{
  "solr_home":"/opt/solr-6.6.0/server/solr",
  "version":"6.6.0 5c7a7b65d2aa7ce5ec96458315c661a18b320241 - ishan - 2017-05-30 07:32:53",
  "startTime":"2017-08-23T16:18:24.088Z",
  "uptime":"0 days, 0 hours, 0 minutes, 18 seconds",
  "memory":"32.9 MB (%6.7) of 490.7 MB"}

4.创建Solr库

bin/solr create -c <name>

说明:加 -force 是因为solr不允许使用 root 进行操作的,其他账户可不加

$ /opt/solr-6.6.0/bin/solr create -c ymq -force

响应

Copying configuration to new core instance directory:
/opt/solr-6.6.0/server/solr/ymq

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

{
  "responseHeader":{
    "status":0,
    "QTime":2665},
  "core":"ymq"}

浏览器输入 ip:port

http://192.168.252.121:8983/solr/

5.停止服务

$ /opt/solr-6.6.0/bin/solr stop -p 8983

响应

Sending stop command to Solr running on port 8983 ... waiting up to 180 seconds to allow Jetty process 3554 to stop gracefully.

可以使用该-all参数来停止所有运行的Solr实例

$ /opt/solr-6.6.0/bin/solr stop -all

响应

Sending stop command to Solr running on port 8983 ... waiting up to 180 seconds to allow Jetty process 3249 to stop gracefully.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值