Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 확인
- was
- 몽고DB
- 진행
- NoSQL
- 톰캣
- troubleshooting
- maven
- slowQuery
- restart
- 무중단
- LocalRepository
- GRACEFUL
- apache
- 상태
- aggregation
- web
- 배포
- projection
- httpd
- 성능
- tomcat
- 인덱스
- kill
- deploy
- 테크블로그
- no space left
- MongoDB
- Pipeline
- longQuery
Archives
- Today
- Total
boogie의 가벼운 개발 일기
[mongoDB] mongoDB 인덱스 생성 진행상태 확인하기 본문
mongoDB는 background로 index를 생성할수 있어서 아주 유용하게 사용하곤 한다.
index 생성시 option으로 background:true를 지정하면 백그라운드로 컬렉션에서 진행중인 작업들에 영향을 주지 않고 인덱스 생성이 진행된다.
db.collection_name.createIndex({index description}, {options})
ex) db.my_collection.createIndex({field1:1, field2:-1}, {background:true, partialFilterExpression : {field3:{$exists:true}}})
하지만 진행상태를 콘솔로 찍어주진 않기때문에 진행상태 확인은 아래와 같이 해야한다.
db.currentOp(true).inprog.forEach(function(op){ if(op.msg!==undefined) print(op.msg) })
인덱스 3개를 생성중일때의 출력 내용
자세하게 보고싶다면
db.currentOp(true).inprog.forEach(function(op){ if(op.msg!==undefined) printjson(op) })
여기서 opid를 확인하여 db.killOp()로 kill할 수도 있다.
'MongoDB' 카테고리의 다른 글
[mongoDB] AggregationPipeline에 $project 사용 시 주의사항 (0) | 2021.06.30 |
---|---|
[mongoDB] long query 확인 및 kill 하기 (0) | 2021.06.30 |
[mongoDB] mongoDB 생성중인 index 취소하기 (0) | 2021.06.30 |