MgO Write security mechanism

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

MgO Write security mechanism

    • MONGO Write security
    • MgO Write safe

MONGO Write security

MONGO itself has a full set of write security mechanisms, but only a small subset of the relevant parts are covered in this article. Put a link to skip this section without looking directly at this
Link.

    • Writeconcern.none: No exception thrown
    • Writeconcern.normal: Throw only network error exception, no server error exception
    • Writeconcern.safe: Throws a network error exception, server error exception, and waits for the server to complete the write operation.
    • Writeconcern.majority: Throws a network error exception, server error exception, and waits for a master server to complete the write operation.
    • Writeconcern.fsync_safe: Throws network error exception, server error exception, write operation waits for server to flush data to disk.
    • Writeconcern.journal_safe: Throws a network error exception, a server error exception, and a write operation waits for the server to submit a log file to disk.
    • Writeconcern.replicas_safe: Throws a network error exception, server error exception, wait for at least 2 servers to complete the write operation.

MgO Write safe

First put the safe structure in MgO.

type Safe struct {    W        int    // Min # of servers to ack before success    WMode    string // Write mode for MongoDB 2.0+ (e.g. "majority")    WTimeout int    // Milliseconds to wait for W before timing out    FSync    bool   // Sync via the journal if present, or via data files sync otherwise    J        bool   // Sync via the journal if present}
    • The W parameter corresponds to the Replicas_safe, which is waiting for the W server to complete the write operation
    • WMode can write MONGO security in the top four. " None "," normal "," safe "," majority "
    • Wtimeout notes are pretty clear written.
    • FSync writes asynchronous write to synchronous write, which is to wait for MONGO to return write feedback
    • J is equivalent to waiting for the log to be written back.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.