zoukankan      html  css  js  c++  java
  • Solr7.1--- 生产环境搭建

    准备三台虚拟机,把Solr-7.1.0.tgz上传到三个节点上。我上传到了自定义的目录/mysoft。

    我的环境是CentOS7+Solr7.1.0

     如果发现图文不符,因为我之前操作截图后,关闭出去吃饭了,想完成整个过程要重新搞一遍

    进入solr所在目录,解压出服务安装脚本文件。

     

    [root@localhost local]# cd /mysoft/
    [root@localhost mysoft]# tar zxf solr-7.1.0.tgz solr-7.1.0/bin/install_solr_service.sh --strip-components=2
    [root@localhost mysoft]# ll
    total 480940
    -rw-r--r--. 1 root root  58075730 Jul 22 09:02 apache-activemq-5.15.0-bin.tar.gz
    -rw-r--r--. 1 root root   8779355 Jul 26 09:23 apache-rocketmq.tar.gz
    -rw-r--r--. 1 root root   9334254 Aug 10 08:33 apache-tomcat-8.0.44.tar.gz
    -rw-r--r--. 1 root root    336939 Oct 29 09:32 fastdfs-5.11.tar.gz
    -rw-r--r--. 1 root root     22192 Oct 29 11:24 fastdfs-nginx-module-master.zip
    -rwxr-xr-x. 1 root root     12694 Oct 13 22:59 install_solr_service.sh
    -rw-r--r--. 1 root root 185540433 Jul 22 09:30 jdk-8u131-linux-x64.gz
    -rw-r--r--. 1 root root  41414555 Aug 11 18:25 kafka_2.11-0.11.0.0.tgz
    -rw-r--r--. 1 root root    434873 Oct 29 09:32 libfastcommon-1.0.36.tar.gz
    drwxr-xr-x. 9 1001 1001      4096 Oct 29 11:26 nginx-1.12.1
    -rw-r--r--. 1 root root    981093 Oct 29 11:18 nginx-1.12.1.tar.gz
    -rw-r--r--. 1 root root 152481397 Nov 23 16:30 solr-7.1.0.tgz
    -rw-r--r--. 1 root root  35042811 Jul 22 09:02 zookeeper-3.4.10.tar.gz

    下面开始安装服务

    先来解释几个注意点。

    • Solr主目录 -d 【/var/solr】
    • Solr安装目录 -i【/opt】
    • 启动服务默认名 -s【solr】
    • 系统运行身份 -u 【你的非root系统身份,我的普通用户是admin,所以我就用的这个】
    The Solr home directory (not to be confused with the Solr installation directory) is where Solr manages core directories with index files.
    
    Solr主目录(不是安装目录),是管理索引文件的核心目录。

    如果你想要安装完服务就直接启动,那么就是这样的。

    [root@localhost mysoft]# ./install_solr_service.sh solr-7.1.0.tgz -i /opt -d /var/solr -u admin -s solr -p 8983
    
    Extracting solr-7.1.0.tgz to /opt
    
    
    Installing symlink /opt/solr -> /opt/solr-7.1.0 ...
    
    
    Installing /etc/init.d/solr script ...
    
    
    Installing /etc/default/solr.in.sh ...
    
    Service solr installed.
    Customize Solr startup configuration in /etc/default/solr.in.sh
    Waiting up to 180 seconds to see Solr running on port 8983 [/]  
    Started Solr server on port 8983 (pid=5180). Happy searching!
    
        
    Found 1 Solr nodes: 
    
    Solr process 5180 running on port 8983
    {
      "solr_home":"/var/solr/data",
      "version":"7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:15:59",
      "startTime":"2017-11-23T13:46:22.578Z",
      "uptime":"0 days, 0 hours, 0 minutes, 18 seconds",
      "memory":"23.7 MB (%4.8) of 490.7 MB"}

    如果你想安装完不自动启动,而想手动启动,那么加上-n参数即可。

    [root@localhost mysoft]# ./install_solr_service.sh solr-7.1.0.tgz -i /opt -d /var/solr -u admin -s solr -p 8983 -n
    
    Extracting solr-7.1.0.tgz to /opt
    
    
    Installing symlink /opt/solr -> /opt/solr-7.1.0 ...
    
    
    Installing /etc/init.d/solr script ...
    
    
    Installing /etc/default/solr.in.sh ...
    
    Service solr installed.
    Customize Solr startup configuration in /etc/default/solr.in.sh
    Not starting Solr service (option -n given). Start manually with 'service solr start'

    安装完成后,我们来看一下都创建了那些新东西。

    安装目录--

    cd /opt

    主目录--

    cd /var/solr

     

    进入data目录,修改solr.xml文件(三台机器不一样)

    cd data
    
    vim solr.xml

    再来看vim /etc/init.d/solr 

    vim /etc/init.d/solr 

     

     最重要的是这个RUNAS,它是以普通用户身份运行的,而不是root,这是为了安全,官方推荐的。

     再来看vim /etc/default/solr.in.sh 

    vim /etc/default/solr.in.sh 

     

     这里需要大家修改一下,取消注释并设置成我们的Zookeeper地址(solr路径需要提前建立),以及SOLR_HOST(三台SOLR_HOST不一样)

    最后,开启8983端口。

    firewall-cmd --zone=public --add-port=8983/tcp --permanent
    
    systemctl restart firewalld

    启动每一个solr节点。

    [root@localhost mysoft]# service solr start
    Waiting up to 180 seconds to see Solr running on port 8983 [/]  
    Started Solr server on port 8983 (pid=6675). Happy searching!
    
    [root@localhost mysoft]# service solr status
    
    Found 1 Solr nodes: 
    
    Solr process 6675 running on port 8983
    {
      "solr_home":"/var/solr/data",
      "version":"7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 - ubuntu - 2017-10-13 16:15:59",
      "startTime":"2017-11-23T13:58:08.059Z",
      "uptime":"0 days, 0 hours, 3 minutes, 21 seconds",
      "memory":"30.4 MB (%6.2) of 490.7 MB",
      "cloud":{
        "ZooKeeper":"192.168.127.129:2181,192.168.127.130:2181,192.168.127.131:2181/solr",
        "liveNodes":"3",
        "collections":"0"}}

    可以看出,以云模式启动,活跃节点为三个。

     打开浏览器,访问任意一台机器。

     http://192.168.127.129:8983/solr/#/~collections

    创建集合。

    点击Cloud

    numShares这里只能输入1,否则会报错:. Value of numShards is 1,​ value of nrtReplicas is 3,​ value of tlogReplicas is 0 and value of pullReplicas is 0. This requires 3 shards to be created (higher than the allowed number)

    应该在配置文件里面可以设置最大share数量

    现在再看集群状态,Collections变成了1

  • 相关阅读:
    手机领域的各种角色介绍
    windows配置教程
    windows7安装教程(vmware)
    /etc/profile、~/.bash_profile、~/.bashrc和/etc/bashrc
    vmware自定义网段
    wps去除首字母自动大写
    Windows和Linux创建软链接和硬链接
    计算机的组成部件及其厂商
    windows开机锁定小键盘
    PL/SQL Developer安装教程
  • 原文地址:https://www.cnblogs.com/LUA123/p/7887723.html
Copyright © 2011-2022 走看看