Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MongoDB installation, master-slave configuration, and monitorin

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Installation

# add installation source

[mongodb] name=MongoDB Repositorybaseurl= http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/gpgcheck=0enabled=1#yum installation

Yum install-y mongo-10gen mongo-10gen-server

# add to Boot Auto start

Chkconfig mongod on

2. Start, stop, restart command

Service mongod startservice mongod stopservice mongod restart

3. Testing

Use mongoperf to view disk IO performance

# mongoperf-h

Usage: mongoperf

< myjsonconfigfile{ nThreads:, // number of threads (default 1) fileSizeMB:, // test file size (default 1MB) sleepMicros:, // pause for sleepMicros/nThreads between each operation (default 0) mmf:, // if true do i/o's via memory mapped files (default false) r:, // do reads (default false) w:, // do writes (default false) recSizeKB:, // size of each write (default 4KB) syncDelay: // secs between fsyncs, like --syncdelay in mongod. (default 0/never)} 进行测试: [root@php1 ~]# cat db.foo.insert( { _id : 1 } )>

Ops = [{op: "findOne", ns: "test.foo", query: {_ id: 1}}, {op: "update", ns: "test.foo", query: {_ id: 1}, update: {$inc: {x: 1}] [{"op": "findOne", "ns": "test.foo", "query": {"_ id": 1}, {"op": "update", "ns": "test.foo" "query": {"_ id": 1}, "update": {"$inc": {"x": 1}}] > for (x = 1) Xuse local > db.slaves.find () / * 0 * / {"_ id": ObjectId ("526b44843f12574552e6ce48"), "config": {"host": "172.17.16.21 526b44843f12574552e6ce48", "upgradeNeeded": true}, "ns": "local.oplog.$main", "syncedTo": Timestamp (1382870579, 1)}

5. Monitoring and management

# mongostat

The mongostat utility provides a quick overview of the status of a currently running mongod or mongos instance. Mongostat is functionally similar to the UNIX/Linux file system utility vmstat, but provides data regarding mongod and mongos instances.

# mongotop

Mongotop provides a method to track the amount of time a MongoDB instance spends reading and writing data. Mongotop provides statistics on a per-collection level. By default, mongotop returns values every second.

# mongodb connection Management client robomongo

Download address: www.robomongo.org

# MMS Management

Management address: https://mms.mongodb.com

Need to install pymongo and install mms agent

1. Install Python 2.6 +

2. Install PyMongo

3. Download: mms-monitoring-agent

Wget https://mms.mongodb.com/settings/mmsAgent/15f01bbee11f24c1c5b2b31fab30c406/mms-monitoring-agent- (MMS-Group-Name). Tar.gz

4. Decompress and run

$nohup python agent.py > > / YOUR_LOG_DIRECTORY/agent.log 2 > & 1 &

5. Add a Mongo Node

You can log in to the MMS management address to view the MongoDB node monitoring information chart.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report