我使用来自bitnami/mongodb-sharded文档的docker-compose示例文件创建了一个共享集群。像这样:
curl -sSL https://raw.githubusercontent.com/bitnami/containers/main/bitnami/mongodb-sharded/docker-compose.yml > docker-compose.yml
docker-compose up -d
字符串
我使用Prisma连接到数据库,发生了以下错误:
writeConcern is not allowed within a multi-statement transaction
型
现在我需要知道hot来禁用使用ENV变量的写关注
这是我的docker-compose.yml:
# Copyright VMware, Inc.
# SPDX-License-Identifier: APACHE-2.0
version: '2'
services:
mongodb-sharded:
image: docker.io/bitnami/mongodb-sharded:6.0
environment:
- MONGODB_ADVERTISED_HOSTNAME=mongodb-sharded
- MONGODB_SHARDING_MODE=mongos
- MONGODB_CFG_PRIMARY_HOST=mongodb-cfg
- MONGODB_CFG_REPLICA_SET_NAME=cfgreplicaset
- MONGODB_REPLICA_SET_KEY=replicasetkey123
- MONGODB_ROOT_PASSWORD=password123
ports:
- "27017:27017"
mongodb-shard0:
image: docker.io/bitnami/mongodb-sharded:6.0
environment:
- MONGODB_ADVERTISED_HOSTNAME=mongodb-shard0
- MONGODB_SHARDING_MODE=shardsvr
- MONGODB_MONGOS_HOST=mongodb-sharded
- MONGODB_ROOT_PASSWORD=password123
- MONGODB_REPLICA_SET_MODE=primary
- MONGODB_REPLICA_SET_KEY=replicasetkey123
- MONGODB_REPLICA_SET_NAME=shard0
volumes:
- 'shard0_data:/bitnami'
mongodb-cfg:
image: docker.io/bitnami/mongodb-sharded:6.0
environment:
- MONGODB_ADVERTISED_HOSTNAME=mongodb-cfg
- MONGODB_SHARDING_MODE=configsvr
- MONGODB_ROOT_PASSWORD=password123
- MONGODB_REPLICA_SET_MODE=primary
- MONGODB_REPLICA_SET_KEY=replicasetkey123
- MONGODB_REPLICA_SET_NAME=cfgreplicaset
volumes:
- 'cfg_data:/bitnami'
volumes:
shard0_data:
driver: local
cfg_data:
driver: local
型
1条答案
按热度按时间kcugc4gi1#
尝试设置replicaSet设置和默认RW问题,例如
字符串
我不认为你可以在任何设置中设置它。