zoukankan      html  css  js  c++  java
  • Linux环境基于Centos7+Docker 搭建 Solr8搭建

    先临时安装部署一个solr-tmp-server:

    拉取Solr镜像

    docker pull solr:latest

    部署镜像临时服务

    docker run -itd -p 8983:8983 --restart=always --privileged=true --name solr-tmp-server solr:latest

    查看运行时的镜像服务

    docker ps --format "table {{.ID}} {{.Names}} {{.Ports}}”
    ##############################################################
    CONTAINER ID NAMES PORTS
    8bc421ef0a70 solr-tmp-server 0.0.0.0:8984->8983/tcp
    1102a987dca7 solr7-server 0.0.0.0:8983->8983/tcp
    59696cbcdc89 rocketmq-console-server 0.0.0.0:8686->8080/tcp
    a585377d27f9 rocketmq-broker-server 0.0.0.0:10909->10909/tcp, 9876/tcp, 0.0.0.0:10911->10911/tcp
    77f002077e21 rocketmq-namesrv-server 10909/tcp, 0.0.0.0:9876->9876/tcp, 10911/tcp
    b32eef9fae32 dubbo-server 0.0.0.0:9200->8080/tcp
    9df44a388458 mysql5-test-server 33060/tcp, 0.0.0.0:3407->3306/tcp
    4504209184f5 mysql5-server 33060/tcp, 0.0.0.0:3409->3306/tcp
    80a3df8e7570 activemq-test-server 1883/tcp, 5672/tcp, 61613-61614/tcp, 0.0.0.0:9092->8161/tcp, 0.0.0.0:61618->61616/tcp
    f9f0788f1118 activemq-develop-server 1883/tcp, 5672/tcp, 61613-61614/tcp, 0.0.0.0:8886->8161/tcp, 0.0.0.0:61617->61616/tcp
    d5beddf650de jenkins-server 0.0.0.0:12345->8080/tcp, 0.0.0.0:32809->50000/tcp
    27dbed560e89 nginx-server 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp
    ee506d85d47d nexus-server 0.0.0.0:8088->8081/tcp
    963dd344d6e2 redis-develop-server 0.0.0.0:30001->6379/tcp
    7779a62d3bd9 redis-test-server 0.0.0.0:30002->6379/tcp
    6a9126755c02 zookeeper-remote-server 2888/tcp, 3888/tcp, 8080/tcp, 0.0.0.0:2182->2181/tcp
    12ff9c292dd4 zookeeper-develop-server 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp, 8080/tcp
    9ffb273b9090 portainer-server 0.0.0.0:9000->9000/tcp
    ##############################################################
    8bc421ef0a70 为solr-tmp-server 服务的容器Id

    docker 部署安装目录:
    /docker/workspace/common/solr

    在/docker/workspace/common/solr目录下创建config目录以及在config目录下创建data 和logs:
    mkdir -p /docker/workspace/common/solr/config/

    mkdir -p /docker/workspace/common/solr/config/{data, logs}

    拷贝/opt/solr/server 到 安装部署目录:
    docker cp 8bc421ef0a70:/opt/solr/server /docker/workspace/common/solr

    拷贝/var/solr/log4j2.xml到安装部署目录config:
    docker cp 8bc421ef0a70:/var/solr/log4j2.xml /docker/workspace/common/solr/config

    拷贝/var/solr/logs/下的数据到安装部署目录logs:
    docker cp 8bc421ef0a70:/var/solr/logs/ /docker/workspace/common/solr/config/logs

    拷贝/var/solr/data/下的数据到安装部署目录data:
    docker cp 8bc421ef0a70:/var/solr/data/ /docker/workspace/common/solr/config/data

    最重要和最关键的一步,对宿主机创建的文件夹进行授权:
    chmod -R 777 /docker/workspace/common/solr
    chmod -R 777 /docker/workspace/common/solr/server
    chmod -R 777 /docker/workspace/common/solr/config/
    chmod -R 777 /docker/workspace/common/solr/config/data/
    chmod -R 777 /docker/workspace/common/solr/config/logs/

    正式部署Solr 服务:

    挂载配置文件对比映射:
    Host/volume
    Path in container
    /docker/workspace/common/solr/config/logs
    /var/solr/logs
    /docker/workspace/common/solr/config/log4j2.xml
    /var/solr/log4j2.xml
    /docker/workspace/common/solr/config
    /var/solr
    /docker/workspace/common/solr/mydata
    /opt/solr/mydata
    /docker/workspace/common/solr/server
    /opt/solr/server
    /docker/workspace/common/solr/config/data
    /var/solr/data
    配置JVM参数:
    TZ
    Asia/Shanghai
    JAVA_OPTS
    -server -verbose:gc -Xms256m -Xmx256m -Xmn128m -Xss128M -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -XX:SurvivorRatio=8 -XX:+AlwaysPreTouch -XX:-UseBiasedLocking -XX:+UseG1GC -XX:G1HeapRegionSize=128m -XX:G1ReservePercent=25 -XX:InitatingHeapOccupancyPercent=80 -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=128m
    核心部署服务命令:

    docker run -itd -p 9991:8983 --restart=always --privileged=true --name solr-server -v /docker/workspace/common/solr/mydata:/opt/solr/mydata -v /docker/workspace/common/solr/server:/opt/solr/server -v /docker/workspace/common/solr/config/data:/var/solr/data -v /docker/workspace/common/solr/config/logs/:/var/solr/logs -v /docker/workspace/common/solr/config/log4j2.xml:/var/solr/log4j2.xml -v /docker/workspace/common/solr/config:/var/solr -e TZ="Asia/Shanghai" -e JAVA_OPTS="-server -verbose:gc -Xms256m -Xmx256m -Xmn128m -Xss128M -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -XX:SurvivorRatio=8 -XX:+AlwaysPreTouch -XX:-UseBiasedLocking -XX:+UseG1GC -XX:G1HeapRegionSize=128m -XX:G1ReservePercent=25 -XX:InitatingHeapOccupancyPercent=80 -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=128m" solr:latest

    创建核心选择器:
    docker exec -it --user=solr solr-server bin/solr create_core -c query-server
    docker exec -it --user=solr solr-server bin/solr create_core -c inquiry-server
    docker exec -it --user=solr solr-server bin/solr create_core -c collection-server

    版权声明:本文为博主原创文章,遵循相关版权协议,如若转载或者分享请附上原文出处链接和链接来源。

  • 相关阅读:
    串学习笔记
    C深度剖析学习笔记
    记英语单词ag
    树学习笔记
    如何做好项目总结
    易学队第二次团队会议
    易学队第四次团队会议
    易学队第五次团队会议
    易学队第一次团队会议
    易学队第三次团队会议
  • 原文地址:https://www.cnblogs.com/mazhilin/p/12096559.html
Copyright © 2011-2022 走看看