MongoDB安装及做成服务
MongoDB安装及做成服务 安装及使用: www.2cto.com 首先在Ubuntu上安装MongoDB。 下载MongoDB, 现在最新的生产版本1.7.0 1. 解压文件. $ tar -xvf mongodb-linux-i686-1.4.3.tgz 2. 为MongoDB创建数据目录,默认情况下它将数据存储在/data/db $ sudo mkdir -
MongoDB安装及做成服务
安装及使用:
www.2cto.com
首先在Ubuntu上安装MongoDB。
下载MongoDB, 现在最新的生产版本1.7.0
1. 解压文件.
$ tar -xvf mongodb-linux-i686-1.4.3.tgz
2. 为MongoDB创建数据目录,默认情况下它将数据存储在/data/db
$ sudo mkdir -p /data/db/
$ sudo chown `id -u` /data/db
3. 启动MongoDB服务.
$ cd mongodb-linux-i686-1.4.3/bin
$ ./mongod
4. 打开另一个终端,并确保你在MongoDB的bin目录,输入如下命令.
$ ./mongo
====================================================================
每次开机运行都需要在(cmd)下面手动输入
E
cd E:\APMServ5.2.6\MongoDb\bin
mongod --dbpath E:\APMServ5.2.6\MongoDb\data
这样感觉非常麻烦,所以将Mongo数据库安装成为Windows服务。如此就方便很多啦
E:\APMServ5.2.6\MongoDb\bin>mongod --logpath E:\APMServ5.2.6\MongoDb\logs\MongoDB.log --logappend --dbpath E:\APMServ5.2.6\MongoDb\data --directoryperdb --serviceName MongoDB --install
回车显示如下便是服务安装成功
all output going to: E:\APMServ5.2.6\MongoDb\logs\MongoDB.log
Creating service MongoDB.
Service creation successful.
Service can be started from the command line via 'net start "MongoDB"'.
www.2cto.com
强调
1:log一定要指定一个xxx.log文件(文件不存在也要这么写,会自动创建,写成这样是不可以的--logpath d:\mongodb\logs)
2:serviceName的N字母要大写
注意:这条命令要到MongoDB的bin目录下运行,刚开始的时候,我就直接在D:\下运行,结果服务的可执行目录为【"D:\mongod" --logpath "D:\MongoDB\logs\MongoDB.log" --logappend --dbpath "D:\MongoDB\data" --directoryperdb --service 】,肯定是不对的。
该命令行指定了日志文件:E:\APMServ5.2.6\MongoDb\logs\MongoDB.log,日志是以追加的方式输出的;
数据文件目录:E:\APMServ5.2.6\MongoDb\data,并且参数--directoryperdb说明每个DB都会新建一个目录;

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

According to news on August 3, according to Huawei’s official introduction, Huawei’s July Service Day has officially started, from August 3 to August 4. It is understood that Huawei’s service days are from the first consecutive Friday to Sunday of each month (if the weekend spans the month, it will be postponed to the next weekend). Huawei users who visit the store during the event can enjoy six exclusive benefits including free film stickers and free labor costs for repairs. Specifically: Huawei mobile phones: free film, cleaning, maintenance, and system upgrade services. Huawei tablets, laptops, wearables, earphones of designated models, and smart glasses: free appearance cleaning and maintenance services. In addition, during the event, users are not required to go to the store for equipment repairs. Pay labor fees and go to the store to purchase Huawei brand accessories, extended service packages, and personalized film products: enjoy a 10% discount on the recommended retail price. The repaired equipment cannot be repaired on the same day.

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

According to news from this site on July 16, Xiaomi has launched its Thanksgiving Season event today, providing preferential replacement and maintenance services for mobile phones, laptops, air conditioners, washing machines, range hoods and other accessories. The content of the activities organized by this site is as follows: The event time is from 10:00 on July 16, 2024 to 24:00 on July 25, 2024. Mobile phone battery replacement can be enjoyed at 20% off for 80 models, with official quality and original accessories. 12 models can enjoy a 20% discount on mobile phone back cover replacement starting from 79.2 yuan. Mobile phone back cover replacement, official accessories, starting from 68 yuan. It should be noted that after users place an order for the back cover replacement service on Xiaomi Mall, the color can be selected at the store. , the specific inventory is subject to the actual situation of the store. If the selected color is out of stock, there may be a delivery delay. Replace your laptop battery with a new one and enjoy 20% off on 14 models of laptops

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).

When developing an e-commerce website, I encountered a difficult problem: how to provide users with personalized product recommendations. Initially, I tried some simple recommendation algorithms, but the results were not ideal, and user satisfaction was also affected. In order to improve the accuracy and efficiency of the recommendation system, I decided to adopt a more professional solution. Finally, I installed andres-montanez/recommendations-bundle through Composer, which not only solved my problem, but also greatly improved the performance of the recommendation system. You can learn composer through the following address:

Detailed explanation of MongoDB efficient backup strategy under CentOS system This article will introduce in detail the various strategies for implementing MongoDB backup on CentOS system to ensure data security and business continuity. We will cover manual backups, timed backups, automated script backups, and backup methods in Docker container environments, and provide best practices for backup file management. Manual backup: Use the mongodump command to perform manual full backup, for example: mongodump-hlocalhost:27017-u username-p password-d database name-o/backup directory This command will export the data and metadata of the specified database to the specified backup directory.

MongoDB and relational database: In-depth comparison This article will explore in-depth the differences between NoSQL database MongoDB and traditional relational databases (such as MySQL and SQLServer). Relational databases use table structures of rows and columns to organize data, while MongoDB uses flexible document-oriented models to better suit the needs of modern applications. Mainly differentiates data structures: Relational databases use predefined schema tables to store data, and relationships between tables are established through primary keys and foreign keys; MongoDB uses JSON-like BSON documents to store them in a collection, and each document structure can be independently changed to achieve pattern-free design. Architectural design: Relational databases need to pre-defined fixed schema; MongoDB supports
