본문 바로가기
728x90
반응형

MongoDB3

[GCP] ops-agent MongoDB Metrics GCP VM Machine 에 MongoDB를 사용하는 경우 MongoDB Metrics 수집이 필요한 경우 ops-agent에 MongoDB agent를 설치하여 모니터링 한다. 구성방법 VM Machine 접속 $ ssh ops-agent 설정 # Configures Ops Agent to collect telemetry from the app and restart Ops Agent. set -e # Create a back up of the existing file so existing configurations are not lost. sudo cp /etc/google-cloud-ops-agent/config.yaml /etc/google-cloud-ops-agent/config.yaml.bak.. 2023. 3. 22.
[MongoDB] database profiler 설정 (MongoDB slow query 측정) MongoDB에서 사용되는 CPU 가 Peak 를 치며 장애가 발생한적이 있다면 혹은 API가 생각했던것보다 오래걸리고 Tracing이 없는 상태에서 그 원인이 MongoDB로 추정된다면 database profiler를 통해 MongoDB의 slow query를 검사하여 원인을 파악해볼 수 있다. MongoDB의 Profiler 설정 방법은 매우 간단하다. 아래 명령어를 이용하여 Profiling Level을 설정해주면 된다. $ db.setProfilingLevel() 이때 Profiling Level에는 아래와 같이 3가지 단계가 있다. Level Description 0 Profiler를 사용하지 않으며 어떠한 데이터도 수집되지 않는다. Default 설정. 1 slowms에 설정된 시간보다 Qu.. 2023. 2. 3.
MongoDB find query by key mongoDB 스키마의 타입을 mixed로 정의되어 있는 도큐먼트의 key를 find로 조회하고 싶을때 아래와 같은 query를 이용하여 조회할 수 있다. 123456789101112131415161718192021222324{ "_id" : "58b7b17113707388b2d6f8bb", "code" : 1, "info" : { "1" : { "product" : 1 }, "2" : { "product" : 2 } }},{ "_id" : "58b7b17113707388b2d6f8bc", "code" : 2, "info" : { "1" : { "product" : 1 }, "2" : { "product" : 2 } }}Colored by Color Scriptercs 위와 같이 MongoDB에 도큐먼트.. 2017. 3. 2.
728x90
반응형