NoSQL (2)


MongoDB Package Components


🐤 MongoDBの3つのコアプロセス🐤

  • mongod:コアデータベースプロセス
  • mongos:クラスタをブロックするためのコントローラとクエリールータ
  • mongosh: interactive shell
  • 1) mongod


    mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.
    This document provides a complete overview of all command line options for mongod. These command line options are primarily useful for testing: In common operation, use the configuration file options to control the behavior of your database.
    mongodはMongoDBシステムのデフォルトのデーモンプロセスです.
    データ要求を処理し、データアクセスを管理し、バックグラウンド管理タスクを実行します.
    configファイルを使用してデータベースの動作を制御します.

    2) mongos


    For a sharded cluster, the mongos instances provide the interface between the client applications and the sharded cluster. The mongos instances route queries and write operations to the shards. From the perspective of the application, a mongos instance behaves identically to any other MongoDB instance.
    Documentはmongos instanceと解釈しますが、それをShaddingノード(マシン)と見なせば簡単です.
    シールドされたクラスタの場合、mongosインスタンスはクライアントアプリケーションとシールドされたクラスタとの間のインタフェースを提供します.
    mongosインスタンスは、クエリーと書き込み操作をグリッドにルーティングします.
    アプリケーションの観点からmongosインスタンスは他のMongoDBインスタンスと同じ働き方です!
  • でもここの記録샤딩なに?샤딩表示데이터를 여러 서버에 분산해서 저장하고 처리할 수 있는 기술レプリケーションとは異なり、レプリケーションは高可用性ソリューション、샤딩은 분산처리를 위한 솔루션!( 몽고디비에서는 고가용성과 대용량 분산 처리를 위해 복제+샤딩 모두 사용! )
  • 分散処理の方法は、垂直拡張(垂直拡張)、水平拡張(水平拡張)の2つ!몽고디비에서는 샤딩을 통해 수평확장을 지원
  • 3) mongosh


    The MongoDB Shell, mongosh, is a fully functional JavaScript and Node.js 14.x REPL environment for interacting with MongoDB deployments. You can use the MongoDB Shell to test queries and operations directly with your database.
    MongoshはMongoDB Shellであり、MongoDBデプロイメントとインタラクティブなすべての機能を備えています.js 14.x REPL環境.
    MongoDB Shellを使用して、データベース内で直接クエリーおよび操作を行います.

    🐤 SQL vs MongoDB 🐤


    SQLで使われている概念と用語、MongoDBで使われている用語と概念は似ていて非常に違います!片付けましょうか...?🥝
  • まず、MongoDBはtableをcollectionと呼ぶ.列名と行名も違います.これらのものはすぐに適応するようです!
  • MySQLサーバをmysqld、データベースクライアントをmysql、MongoDBサーバをmongod、データベースクライアントをmongoshと呼ぶ!
  • 1) insert
    db.collection.insertOne()
    db.collection.insertMany()
    
    # 여기서 collection은 테이블을 뜻하고, 기존에 있는 table이라면 거기에 값이 들어가고 없는 table이라면 새로 생성되어서 들어감!
    # 신기한게 하나만 넣는 명령어가 따로, 여러개 넣는 명령어가 따로임!
    2) read
    ->findという名前の関数による操作
    db.collection.find()
    
    ex)
    db.mango.insertOne({x:'starbucks'})
    db.mango.find({x:'starbucks'}) # 이건 특정 값 조회
    
    db.mango.find({}) # 이건 전체 조회
    
    # 해당 값이 없으면 아무것도 리턴 안함
    select
    update
    delete
    注1:https://docs.mongodb.com/manual/reference/program/mongod/#mongodb-binary-bin.mongod
    注2:https://junghwanta.tistory.com/30?category=857330