본문 바로가기

728x90

mongo

[리눅스] mongodb, mongo-express 도커 컨테이너 올리기 mongodb, mongo-express 도커 컨테이너 올리기 docker-compose.yml 편집 version: '3.9' services: ### Mongodb Servers mongo1: image: anti1346/mongo:5.0.8 container_name: mongo1 restart: unless-stopped env_file: - .env environment: - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME} - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD} - TZ=Asia/Seoul command: mongod --auth --replSet rs1 --keyFile /d.. 더보기
[리눅스] mongodb(router) - 3 mongodb(router) - 3 mongodb PRIMARY docker run -it --rm --add-host=mongodb-201:1.1.1.201 --add-host=mongodb-202:1.1.1.202 --add-host=mongodb-203:1.1.1.203 anti1346/mongo:5.0.8 bash mongo mongodb-201:27017 # mongo mongodb-201:27017 MongoDB shell version v5.0.8 connecting to: mongodb://mongodb-201:27017/test?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("52.. 더보기
[리눅스] mongodb(shard) - 2 mongodb(shard) - 2 mongodb PRIMARY docker-compose exec mongo1 bash mongo --port 27011 rs.initiate( { _id: "rs0", members: [ { _id: 0, host : "mongodb-201:27011" }, { _id: 1, host : "mongodb-202:27011" }, { _id: 2, host : "mongodb-203:27011" }, { _id: 3, host : "mongodb-201:27012" }, { _id: 4, host : "mongodb-202:27012" }, { _id: 5, host : "mongodb-203:27012" }, { _id: 6, host : "mongodb-203:2701.. 더보기
[리눅스] mongodb(config) - 1 mongodb(config) - 1 mongodb PRIMARY docker-compose exec config bash mongo --port 27018 ReplicaSet 초기화 rs.initiate( { _id: "configserver", members: [ { _id: 0, host : "mongodb-201:27018" }, { _id: 1, host : "mongodb-202:27018" }, { _id: 2, host : "mongodb-203:27018" } ] } ) use admin configserver:PRIMARY> use admin switched to db admin db.createUser({user:"root",pwd:"changeme",roles:[{role:"root".. 더보기