我无法在gitlab ci中为mongodb设置副本集,而本地副本集成功运行了。如何修改.gitlab-ci.yml文件以使其在我的gitlab管道中正常工作?
在本地,我在official instructions之后为副本集运行3个mongodb。我在gitlab ci中复制相同的步骤。我为每个mongodb创建了3个配置文件,并使它们成为服务的别名。如何安装mongo并按照说明中的步骤2和3执行mongo
,rs.initiate
?
services:
- name: mongo:latest
alias: mongo_1
command: ["mongod","--config", "./mongodb_replica_sets/configs/mongod_1.conf"]
- name: mongo:latest
alias: mongo_2
command: ["mongod","--config", "./mongodb_replica_sets/configs/mongod_2.conf"]
- name: mongo:latest
alias: mongo_3
command: ["mongod","--config", "./mongodb_replica_sets/configs/mongod_3.conf"]