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

MongoBD Learning (2) client connection

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The mongo client is started by bin/mongo

0. Help

Root@adela-vm:/opt/mongodb_simple#. / bin/mongo-- help

MongoDB shell version: 2.6.9

Usage:. / bin/mongo [options] [db address] [file names (ending in .js)]

1. Start the mongoDB client process

Root@adela-vm:/opt/mongodb_simple#. / bin/mongo 127.0.0.1:12345/test

MongoDB shell version: 2.6.9

Connecting to: 127.0.0.1:12345/test

Welcome to the MongoDB shell.

For interactive help, type "help".

For more comprehensive documentation, see

Http://docs.mongodb.org/

Questions? Try the support group

Http://groups.google.com/group/mongodb-user

>

2. Close the mongoDB client process

Method 1:

> db.shutdownServer ()

> db.shutdownServer ()

Shutdown command only works with the admin database; try 'use admin'

Admin is required to use the shutdown command

> use admin

Switched to db admin

> db.shutdownServer ()

2015-03-27T11:33:49.502+0800 DBClientCursor::init call () failed

Server should be down...

2015-03-27T11:33:49.506+0800 trying reconnect to 127.0.0.1 12345 (127.0.0.1) failed

2015-03-27T11:33:49.506+0800 warning: Failed to connect to 127.0.0.1 reason: errno:111 Connection refused 12345

2015-03-27T11:33:49.506+0800 reconnect 127.0.0.1 failed failed couldn't connect to server 127.0.0.1 connection attempt failed

>

Method 2:kill-15 process number or kill (no parameters) process number

Avoid using kill-9 process numbers except in special circumstances

3. Restart mongo

Numactl-- interleave=all bin/mongod-f conf/mongod.conf

The program 'numactl' is currently not installed. You can install it by typing:

Apt-get install numactl

Install numactl

Apt-get install numactl

Root@adela-vm:/opt/mongodb_simple/log# apt-get install numactl

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following NEW packages will be installed:

Numactl

0 upgraded, 1 newly installed, 0 to remove and 348 not upgraded.

Need to get 30.1 kB of archives.

After this operation, 135 kB of additional disk space will be used.

Get:1 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/universe numactl amd64 2.0.9~rc5-1ubuntu3 [30.1 kB]

Fetched 30.1 kB in 0s (62.3 kB/s)

Selecting previously unselected package numactl.

(Reading database... 170689 files and directories currently installed.)

Preparing to unpack... / numactl_2.0.9~rc5-1ubuntu3_amd64.deb...

Unpacking numactl (2.0.9~rc5-1ubuntu3)...

Processing triggers for man-db (2.6.7.1-1).

Setting up numactl (2.0.9~rc5-1ubuntu3)...

Restart the server

Root@adela-vm:/opt/mongodb_simple# numactl-- interleave=all bin/mongod-f conf/mongod.conf

About to fork child process, waiting until server is ready for connections.

Forked process: 4223

Child process started successfully, parent exiting

4. View the log

Tail mongod.log

2015-03-27T11:42:38.343+0800 [initandlisten] waiting for connections on port 12345

5. Start the client

Root@adela-vm:/opt/mongodb_simple#. / bin/mongo 127.0.0.1:12345/test

MongoDB shell version: 2.6.9

Connecting to: 127.0.0.1:12345/test

>

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