Linux环境基于Centos7+Docker 搭建 Solr8搭建
2020/3/24 8:01:31
本文主要是介绍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}}\t{{.Names}}\t{{.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
版权声明:本文为博主原创文章,遵循相关版权协议,如若转载或者分享请附上原文出处链接和链接来源。
这篇关于Linux环境基于Centos7+Docker 搭建 Solr8搭建的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-19Docker-Compose容器集群化项目实战:新手入门指南
- 2024-11-19Docker镜像仓库项目实战:新手入门教程
- 2024-11-19Docker容器化部署项目实战:新手入门教程
- 2024-11-19Docker-Compose容器集群化资料入门教程
- 2024-11-19Docker镜像仓库资料详解:新手入门教程
- 2024-11-19Docker容器化部署资料:新手入门指南
- 2024-11-19Docker-Compose容器集群化教程:从入门到实践
- 2024-11-19Docker镜像仓库教程:新手入门指南
- 2024-11-19Docker容器化部署教程:初学者指南
- 2024-11-18Docker-Compose容器集群化入门教程