Mongodb入门安装与配置
作者:zhanhailiang 日期:2014-11-07 1. 安装mongodb: [root@~/wade/nodejs/nodeclub]# yum search mongodb[root@~/wade/nodejs/nodeclub]# yum install mongodb.x86_64 mongodb-server.x86_64 libmongodb.x86_64 libmongodb-devel.x86_64 2. 采用配置文件
作者:zhanhailiang 日期:2014-11-07
1. 安装mongodb:
[root@~/wade/nodejs/nodeclub]# yum search mongodb [root@~/wade/nodejs/nodeclub]# yum install mongodb.x86_64 mongodb-server.x86_64 libmongodb.x86_64 libmongodb-devel.x86_64
2. 采用配置文件+后台运行模式启动mongodb服务:
[root@/usr/local/mongodb]# ls conf data log [root@/usr/local/mongodb/conf]# cat mongodb_27017.conf fork = true bind_ip = 127.0.0.1 port = 27017 dbpath = /usr/local/mongodb/data/ logpath = /usr/local/mongodb/log/mongodb_27017.log logappend = true journal = true [root@/usr/local/mongodb/conf]# mongod -f /usr/local/mongodb/conf/mongodb_27017.conf about to fork child process, waiting until server is ready for connections. forked process: 21732 all output going to: /usr/local/mongodb/log/mongodb_27017.log child process started successfully, parent exiting [root@/usr/local/mongodb/conf]# ps -ef|grep mongodb root 21732 1 0 23:12 ? 00:00:00 mongod -f /usr/local/mongodb/conf/mongodb_27017.conf root 21750 21441 0 23:12 pts/1 00:00:00 grep mongodb
其中:
- fork:表示是否以后台进程模式启动。
- bind_ip:MongoDB进程绑定的监听IP,默认为 localhost(127.0.0.1)
- port:MongoDB 服务监听的TCP端口,默认为 27017
- dbpath:数据目录
- logpath:日志目录
- logappend:日志追加
-
journal: 是否开启预写日志
3. 使用客户端mongo登录mongodb,测试mongodb服务是否正常运行:
[root@/usr/local/mongodb/conf]# mongo MongoDB shell version: 2.4.6 connecting to: test > version() 2.4.6
Copy after login4. 停止mongodb服务:
可以使用客户端登录停止mongodb服务:
[root@/usr/local/mongodb/conf]# mongo MongoDB shell version: 2.4.6 connecting to: test > use admin; switched to db admin > db.shutdownServer(); Fri Nov 7 23:46:54.710 DBClientCursor::init call() failed server should be down... Fri Nov 7 23:46:54.712 trying reconnect to 127.0.0.1:27017 Fri Nov 7 23:46:54.712 reconnect 127.0.0.1:27017 failed couldn't connect to server 127.0.0.1:27017
Copy after login也可以使用 mongod 命令关闭:
[root@/usr/local/mongodb/conf]# mongod --shutdown -f /usr/local/mongodb/conf/mongodb_27017.conf killing process with pid: 23099
Copy after login推荐阅读:
- Manage mongod Processes
- MongoDB:启动服务
- MongoDB:关闭服务

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Editor of the Machine Power Report: Yang Wen The wave of artificial intelligence represented by large models and AIGC has been quietly changing the way we live and work, but most people still don’t know how to use it. Therefore, we have launched the "AI in Use" column to introduce in detail how to use AI through intuitive, interesting and concise artificial intelligence use cases and stimulate everyone's thinking. We also welcome readers to submit innovative, hands-on use cases. Video link: https://mp.weixin.qq.com/s/2hX_i7li3RqdE4u016yGhQ Recently, the life vlog of a girl living alone became popular on Xiaohongshu. An illustration-style animation, coupled with a few healing words, can be easily picked up in just a few days.

The matrix is difficult to understand, but it may be different if you look at it from another perspective. When learning mathematics, we are often frustrated by the difficulty and abstractness of the knowledge we learn; but sometimes, just by changing the perspective, we can find a simple and intuitive solution to the problem. For example, when we were learning the formula for the sum of squares (a+b)² when we were children, we may not understand why it is equal to a²+2ab+b². We only knew that it was written like this in the book and the teacher asked us to remember it like this; until one day we saw I saw this animated picture: It suddenly dawned on me that we can understand it from a geometric perspective! Now, this sense of enlightenment occurs again: a non-negative matrix can be equivalently converted into the corresponding directed graph! As shown in the figure below, the 3×3 matrix on the left can actually be

At 2:00 pm on July 31, Beijing time, the latest member of the XREAL series of AR glasses, XREAL Air2 Ultra, was officially launched in China. It is currently available on JD.com, Tmall, Douyin and other platforms, with an initial price of 3,999 yuan. This AR glasses is a flagship product mainly for the developer community. It aims to lower the threshold for developers to enter spatial computing, promote innovation in the field of spatial computing, and establish a more prosperous AR ecosystem. Empowering developers with six core capabilities As XREAL’s second 6DoF (Six Degrees of Freedom, six degrees of freedom) full-featured glasses, XREAL Air2 Ultra is currently the only one in the industry that uses dual environment sensing sensors (SLAM Camera)

This article introduces how to configure MongoDB on Debian system to achieve automatic expansion. The main steps include setting up the MongoDB replica set and disk space monitoring. 1. MongoDB installation First, make sure that MongoDB is installed on the Debian system. Install using the following command: sudoaptupdatesudoaptinstall-ymongodb-org 2. Configuring MongoDB replica set MongoDB replica set ensures high availability and data redundancy, which is the basis for achieving automatic capacity expansion. Start MongoDB service: sudosystemctlstartmongodsudosys

This article describes how to build a highly available MongoDB database on a Debian system. We will explore multiple ways to ensure data security and services continue to operate. Key strategy: ReplicaSet: ReplicaSet: Use replicasets to achieve data redundancy and automatic failover. When a master node fails, the replica set will automatically elect a new master node to ensure the continuous availability of the service. Data backup and recovery: Regularly use the mongodump command to backup the database and formulate effective recovery strategies to deal with the risk of data loss. Monitoring and Alarms: Deploy monitoring tools (such as Prometheus, Grafana) to monitor the running status of MongoDB in real time, and

It is impossible to view MongoDB password directly through Navicat because it is stored as hash values. How to retrieve lost passwords: 1. Reset passwords; 2. Check configuration files (may contain hash values); 3. Check codes (may hardcode passwords).

PiNetwork is about to launch PiBank, a revolutionary mobile banking platform! PiNetwork today released a major update on Elmahrosa (Face) PIMISRBank, referred to as PiBank, which perfectly integrates traditional banking services with PiNetwork cryptocurrency functions to realize the atomic exchange of fiat currencies and cryptocurrencies (supports the swap between fiat currencies such as the US dollar, euro, and Indonesian rupiah with cryptocurrencies such as PiCoin, USDT, and USDC). What is the charm of PiBank? Let's find out! PiBank's main functions: One-stop management of bank accounts and cryptocurrency assets. Support real-time transactions and adopt biospecies

According to news on September 4, market research agency Counterpoint Research recently released market data for entry-level phones in the second quarter of 2024. It shows that global economical smartphone sales exceeded 100 million units in the quarter, a year-on-year increase of 10%, accounting for 37% of global smartphone sales. The top 10 best-selling budget smartphones reached a quarter, up from 21% in the same period last year. 1. Xiaomi, Samsung and OPPO each occupy three spots in the top ten rankings, and the remaining one spot belongs to Transsion. Redmi13C was the biggest winner, with the 4G version winning the championship and the 5G version ranking fourth, becoming the far leading single product. As the only 5G model on the list, Redmi13C5G fulfills Xiaomi’s classic slogan “
