MongoDB::Admin - A collection of MongoDB administrative functions
use MongoDB; use MongoDB::Admin; my $connection = MongoDB::Connection->new(host => 'localhost', port => 27017); my $admin = MongoDB::Admin->new('connection' => $connection); my $ops = $admin->current_op(); my $locked = $admin->fsync_lock_check(); $admin->fsync_lock(); $admin->fsync_unlock(); $admin->killOp($opid);
my $result = $database->current_op()
Print out the current operations running on the MongoDB server. akin to db.currentOp() at the mongo shell
my $result = $conn->fsync_lock_check()
Checks if a fsync lock is in place, returning 1 if present, 0 otherwise.
my $result = $conn->fsync_lock()
Force a fsync and then lock the database to write operations, does nothing if writes are already locked.
my $result = $conn->unlock()
Unlock's MongoDB from a prior fsync_lock operation.
my $result = $conn->killOp($opid)
Kill MongoDB Query with opid $opid
my $result = $conn->serverStatus()
Return the MongoDB server status detail
my $result = $conn->stats($db)
Return the stats detail for the database named $db
my $result = $conn->serverBuildInfo() print $result->{version};
Return the MongoDB server build info.
my $result = $conn->version()
Return the MongoDB server version.
my $result = $conn->rs_status()
Return the replica set status.
my $result = $conn->rs_stepDown()
Step down as the master server, 60 second duration for new election on default.
my $result = $conn->rs_freeze()
Freeze the replica member from becoming the new master for $secs seconds, or 60 seconds if undefined.
my $result = $conn->rs_conf()
Return the replica set config
David Burley <david@geek.net>
To install MongoDB::Admin, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MongoDB::Admin
CPAN shell
perl -MCPAN -e shell install MongoDB::Admin
For more information on module installation, please visit the detailed CPAN module installation guide.