mongod --shardsvr --replSet shareRepl1 --dbpath C:\mongodb\shard\shard1\shardRep1\data -port 30011
mongod --shardsvr --replSet shareRepl1 --dbpath C:\mongodb\shard\shard1\shardRep2\data -port 30012
mongod --shardsvr --replSet shareRepl1 --dbpath C:\mongodb\shard\shard1\shardRep3\data -port 30013
mongod --shardsvr --replSet shareRepl2 --dbpath C:\mongodb\shard\shard2\shardRep1\data -port 30021
mongod --shardsvr --replSet shareRepl2 --dbpath C:\mongodb\shard\shard2\shardRep2\data -port 30022
mongod --shardsvr --replSet shareRepl2 --dbpath C:\mongodb\shard\shard2\shardRep3\data -port 30023
mongod --shardsvr --replSet shareRepl3 --dbpath C:\mongodb\shard\shard3\shardRep1\data -port 30031
mongod --shardsvr --replSet shareRepl3 --dbpath C:\mongodb\shard\shard3\shardRep2\data -port 30032
mongod --shardsvr --replSet shareRepl3 --dbpath C:\mongodb\shard\shard3\shardRep3\data -port 30033
먼저 이전시간에 만든 파일안으로 포트를 9개 생성하겠습니다.
9개 항목을 모두 실행해주고 서버를 끄지 말고 그대로 둬야 합니다!!!!!!!
원래 shardRepl인데 share로 오타를 냈는데 이미 생성된 포트이기 때문에
그대로 shareRepl이라고 맞춰주었습니다
mongo localhost:30011
var config = {
_id : "shareRepl1", members : [
{_id : 0, host : 'localhost:30011'},
{_id : 1, host : 'localhost:30012'},
{_id : 2, host : 'localhost:30013'}
]
}
rs.initiate(config)
이렇게 세 번을 실행하면 영상처럼 Primary(가장 상태가 좋은 포트)인지 Secondary인지 뜹니다
30021번과 30031번도 동일하게 실행해줍니다
※같은 컴퓨터라서 localhost라고 쓰지만 실제로는 여러대의 컴퓨터를 사용하기 때문에 그 자리에 port번호가 들어갑니다
admin-shutdownServer으로 종료하면 정상적으로 종료되지만 그냥 X(닫기)버튼으로 지웠을 경우
우리가 프로그램을 닫았는데도 작업관리자에서 봤을때 응용프로그램이 돌아가는 것처럼
포트가 지워지지 않고 그대로 돌아간다고 보면된다
따라서 이 경우에는 포트번호를 바꿔야한다
만약 너무 복잡해졌다면 재부팅을 하자
'IT 프로그래밍' 카테고리의 다른 글
[mbti 검사지] 돈버는 mbti 테스트 사이트 만들기 (프로젝트라이언 수강후기) (0) | 2022.02.06 |
---|---|
[웹3.0 플랫폼이 이미있다고?] 포에버랜드 깃허브 연동 (feat. 내가 만든 mbti 테스트) (0) | 2022.01.28 |
[Django] 로그인, 회원가입페이지 만들기 (0) | 2021.05.06 |
☆ Github 깃허브에 파일올리는 가장 간단한 방법 ☆ (0) | 2021.05.04 |
[Django] 이클립스+파이썬+Mysql ★끄적끄적 (0) | 2021.03.29 |