MongoDB Common Command Scripting-automated operations

Source: Internet
Author: User
Tags mongodb commands
MongoDB Common Command Scripting-automated OPS writes the MONGODB commands commonly used in operations into shell scripts, greatly facilitates maintenance
1 Modifying the settings of a replica set

#!/bin/bash

#mongodb Enter the client and enter primary
Cd/usr/mongodb/bin
Mongodb= './mongo 192.168.1.7:37017 '
$MongoDB <<eof
Use Mongomodeljobresume
#rs. Status ()
Cfg=rs.conf ()
cfg.members[0].priority=99
Cfg.members[1].priority=50
Cfg.members[2].priority=30
Rs.reconfig (CFG)
Rs.conf ()
Exit

Eof

Note: Write the above content to the ***.sh file chmod 777 ***.sh Assign permissions

These commands can be completed in Linux > sh ***.sh


MongoDB Common Command Scripting-automated operations

Related Article

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.