docker-compose.yml:
version: '3'
services:
zookeeper-A:
image: zookeeper:3.4.11
ports:
- "12181:2181"
- "2888"
- "3888"
container_name: zookeeper-A
restart: always
volumes:
- ./zoo1/data:/data
- ./zoo1/datalog:/datalog
environment:
TZ: Asia/Shanghai
ZOO_MY_ID: 1
ZOO_PORT: 2181
ZOO_SERVERS: server.1=zookeeper-A:2888:3888 server.2=zookeeper-B:2888:3888 server.3=zookeeper-C:2888:3888
zookeeper-B:
image: zookeeper:3.4.11
ports:
- "12182:2181"
- "2888"
- "3888"
container_name: zookeeper-B
restart: always
volumes:
- ./zoo2/data:/data
- ./zoo2/datalog:/datalog
environment:
TZ: Asia/Shanghai
ZOO_MY_ID: 2
ZOO_PORT: 2181
ZOO_SERVERS: server.1=zookeeper-A:2888:3888 server.2=zookeeper-B:2888:3888 server.3=zookeeper-C:2888:3888
zookeeper-C:
image: zookeeper:3.4.11
ports:
- "12183:2181"
- "2888"
- "3888"
container_name: zookeeper-C
restart: always
volumes:
- ./zoo3/data:/data
- ./zoo3/datalog:/datalog
environment:
TZ: Asia/Shanghai
ZOO_MY_ID: 3
ZOO_PORT: 2181
ZOO_SERVERS: server.1=zookeeper-A:2888:3888 server.2=zookeeper-B:2888:3888 server.3=zookeeper-C:2888:3888
solr-1:
image: solr:5.3.1
ports:
- "18983:8983"
container_name: solr-1
restart: always
environment:
ZK_HOST: zookeeper-A:2181,zookeeper-A:2181,zookeeper-A:2181
depends_on:
- zookeeper-A
- zookeeper-B
- zookeeper-C
solr-2:
image: solr:5.3.1
ports:
- "18984:8983"
container_name: solr-2
restart: always
environment:
ZK_HOST: zookeeper-A:2181,zookeeper-A:2181,zookeeper-A:2181
depends_on:
- zookeeper-A
- zookeeper-B
- zookeeper-C
solr-3:
image: solr:5.3.1
ports:
- "18985:8983"
container_name: solr-3
restart: always
environment:
ZK_HOST: zookeeper-A:2181,zookeeper-A:2181,zookeeper-A:2181
depends_on:
- zookeeper-A
- zookeeper-B
- zookeeper-C
No config set found to associate with the collection. 刚启动的没有默认的Solr配置
手动执行命令:
docker exec -it solr-1 /opt/solr/bin/solr create_collection -c collection1 -shards 1 -replicationFactor 3 -p 8983 创建一个默认的collection,以后就可以用这个作为基础;
-p 8983:端口号docker容器内运行的solr的端口号无需更改;
http://www.dczou.com/viemall/824.html