MongoDB 3.2 for RHEL6.4 installation

本文涉及的产品
云数据库 MongoDB,独享型 2核8GB
推荐场景:
构建全方位客户视图
简介:   从来不认为任何一门技术简单,尤其对于初次接触者;也许是因为开源,MongoDB不像Oracle数据库那么规范化,都有对应的详细的操作文档,按照文档来,就能达到目的,我觉得MongoDB在这方面差很多。
  从来不认为任何一门技术简单,尤其对于初次接触者;也许是因为开源,MongoDB不像Oracle数据库那么规范化,都有对应的详细的操作文档,按照文档来,就能达到目的,我觉得MongoDB在这方面差很多。下面,我以Oracle的安装思路总结下MongoDB的安装过程。
  1、创建mongodb的管理用户
 注意:有必要强调的是,LINUX版本最好是6.4以上,在REDHAT5.5上,我尝试安装,最后要求GLIBC版本最低是2.10,要升级GLIBC,风险很大。

[root@mongo ~]# uname -a

Linux mongo 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

[root@mongo ~]#

[root@mongo ~]#useradd -u 500 mongo

[root@mongo ~]#passwd mongo
 2、创建mongodb的安装目录
[root@mongo ~]# cd /opt/mongo/

[root@mongo ~]#chown -R mongo:mongo /opt/mongo

[root@mongo ~]#chmod -R 775 /opt/mongo

[mongo@mongo mongo]$ ls

soft

[mongo@mongo mongo]$ mkdir data

[mongo@mongo mongo]$ ls

data  soft

[mongo@mongo mongo]$ mkdir logs

[mongo@mongo mongo]$ ls

data  logs  soft

[mongo@mongo mongo]$ ls -l

total 12

drwxrwxr-x. 2 mongo mongo 4096 Jun 11 01:08 data  #MongoDB的数据文件存放目录

drwxrwxr-x. 2 mongo mongo 4096 Jun 11 01:08 logs  #MongoDB的日志文件存放目录,类似ORACLE的ALERT日志文件

drwxrwxr-x. 2 mongo mongo 4096 Jun 11 01:08 soft #MongoDB的软件安装目录
 3、mongodb管理用户登录服务器,上传安装介质并解压
 注意:这里需要强调,MongoDB的安装版本必须对应特定的操作系统平台及版本,这里我用 mongodb-linux-x86_64-rhel62-3.2.7.tgz

[mongo@mongo ~]$ cd /opt/mongo/

[mongo@mongo mongo]$ ls

mongodb-linux-x86_64-rhel62-3.2.7.tgz

[mongo@mongo mongo]$ tar -xvf mongodb-linux-x86_64-rhel62-3.2.7.tgz

mongodb-linux-x86_64-rhel62-3.2.7/README

mongodb-linux-x86_64-rhel62-3.2.7/THIRD-PARTY-NOTICES

mongodb-linux-x86_64-rhel62-3.2.7/MPL-2

mongodb-linux-x86_64-rhel62-3.2.7/GNU-AGPL-3.0

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongodump

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongorestore

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongoexport

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongoimport

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongostat

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongotop

mongodb-linux-x86_64-rhel62-3.2.7/bin/bsondump

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongofiles

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongooplog

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongoperf

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongod

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongos

mongodb-linux-x86_64-rhel62-3.2.7/bin/mongo

[mongo@mongo ~]$mv mongodb-linux-x86_64-rhel62-3.2.7 soft
 4、修改管理用户下的环境变量
[mongo@mongo ~]$ cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

         . ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

export PATH=$PATH:/opt/mongo/soft/bin

export MONGO_BASE=/opt/mongo

export MONGO_DATA=/opt/mongo/data

export MONGO_LOGS=/opt/mongo/logs
  5、检查mongo对glibc的要求
 注意:这里要求GLIBC版本号必须大于等于2.10

[root@mongo ~]# rpm -qi glibc

Name        : glibc                        Relocations: (not relocatable)

Version     : 2.12                              Vendor: Red Hat, Inc.

Release     : 1.107.el6                     Build Date: Tue 20 Nov 2012 08:22:45 PM PST

Install Date: Sat 11 Jun 2016 08:41:30 AM PDT      Build Host: x86-023.build.eng.bos.redhat.com

Group       : System Environment/Libraries   Source RPM: glibc-2.12-1.107.el6.src.rpm

Size        : 12947270                         License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+

Signature   : RSA/8, Tue 29 Jan 2013 07:00:11 AM PST, Key ID 199e2f91fd431d51

Packager    : Red Hat, Inc.

URL         : http://sources.redhat.com/glibc/

Summary     : The GNU libc libraries

Description :

The glibc package contains standard libraries which are used by

multiple programs on the system. In order to save disk space and

memory, as well as to make upgrading easier, common system code is

kept in one place and shared between programs. This particular package

contains the most important sets of shared libraries: the standard C

library and the standard math library. Without these two libraries, a

Linux system will not function.
  6、解决libssl.so.10问题
 通过mongod的可用性发现 libssl.so.10问题,此问题不解决,MongoDB无法启动
[mongo@mongo ~]$ mongod --help
mongod: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or director
  解决 libssl.so.10 问题,使用 root 建立软链接即可

[root@mongo lib]# pwd

/usr/lib

[root@mongo lib]# ls -l libss*

-rwxr-xr-x 1 root root 205052 Jul 20  2009 libssl3.so

-rw-r--r-- 1 root root 448536 Sep  4  2009 libssl.a

lrwxrwxrwx 1 root root     26 Feb 18  2014 libssl.so -> ../../lib/libssl.so.0.9.8e

[root@mongo lib64]# pwd

/lib64

[root@mongo lib64]# ln -s /lib64/libssl.so.0.9.8e /usr/lib/libssl.so.10

[root@mongo lib]# ls -l libss*

-rwxr-xr-x 1 root root 205052 Jul 20  2009 libssl3.so

-rw-r--r-- 1 root root 448536 Sep  4  2009 libssl.a

lrwxrwxrwx 1 root root     26 Feb 18  2014 libssl.so -> ../../lib/libssl.so.0.9.8e

lrwxrwxrwx 1 root root     23 Jun 11 11:36 libssl.so.10 -> /lib64/libssl.so.0.9.8e
 7、解决libcrypto.so.10问题
  通过 mongod的可用性发现 libcrypto.so.10问题,此问题不解决,MongoDB无法启动
 
解决 libcrypto.so.10 问题,使用 root 建立软链接即可

[root@mongo lib]# pwd

/usr/lib

[root@mongo lib]# ls -l libcryp*

-rw-r--r-- 1 root root   47750 Sep  4  2009 libcrypt.a

-rw-r--r-- 1 root root 2416230 Sep  4  2009 libcrypto.a

lrwxrwxrwx 1 root root      29 Feb 18  2014 libcrypto.so -> ../../lib/libcrypto.so.0.9.8e

lrwxrwxrwx 1 root root      22 Feb 18  2014 libcryptsetup.so.0 -> libcryptsetup.so.0.0.0

-rwxr-xr-x 1 root root   51276 Jul  2  2009 libcryptsetup.so.0.0.0

lrwxrwxrwx 1 root root      23 Feb 18  2014 libcrypt.so -> ../../lib/libcrypt.so.1

[root@mongo lib64]# pwd

/lib64

[root@mongo lib64]# ln -s /lib64/libcrypto.so.0.9.8e /usr/lib/libcrypto.so.10

[root@mongo lib]# ls -l libcryp*

-rw-r--r-- 1 root root   47750 Sep  4  2009 libcrypt.a

-rw-r--r-- 1 root root 2416230 Sep  4  2009 libcrypto.a

lrwxrwxrwx 1 root root      29 Feb 18  2014 libcrypto.so -> ../../lib/libcrypto.so.0.9.8e

lrwxrwxrwx 1 root root      26 Jun 11 11:43 libcrypto.so.10 -> /lib64/libcrypto.so.0.9.8e

lrwxrwxrwx 1 root root      22 Feb 18  2014 libcryptsetup.so.0 -> libcryptsetup.so.0.0.0

-rwxr-xr-x 1 root root   51276 Jul  2  2009 libcryptsetup.so.0.0.0

lrwxrwxrwx 1 root root      23 Feb 18  2014 libcrypt.so -> ../../lib/libcrypt.so.1
 8、测通MongoDB的mongod可用性
[mongo@mongo ~]$ mongod --help

Options:

General options:

  -h [ --help ]                         show this usage information

  --version                             show version information

  -f [ --config ] arg                   configuration file specifying

                                        additional options

  -v [ --verbose ] [=arg(=v)]           be more verbose (include multiple times

                                        for more verbosity e.g. -vvvvv)

  --quiet                               quieter output

  --port arg                            specify port number - 27017 by default

  --bind_ip arg                         comma separated list of ip addresses to

                                        listen on - all local ips by default

  --ipv6                                enable IPv6 support (disabled by

                                        default)

  --maxConns arg                        max number of simultaneous connections

                                        - 1000000 by default

  --logpath arg                         log file to send write to instead of

                                        stdout - has to be a file, not

                                        directory

  --syslog                              log to system's syslog facility instead

                                        of file or stdout

  --syslogFacility arg                  syslog facility used for mongodb syslog

                                        message

  --logappend                           append to logpath instead of

                                        over-writing

  --logRotate arg                       set the log rotation behavior

                                        (rename|reopen)

  --timeStampFormat arg                 Desired format for timestamps in log

                                        messages. One of ctime, iso8601-utc or

                                        iso8601-local

  --pidfilepath arg                     full path to pidfile (if not set, no

                                        pidfile is created)

  --keyFile arg                         private key for cluster authentication

  --noauth                              run without security

  --setParameter arg                    Set a configurable parameter

  --httpinterface                       enable http interface

  --clusterAuthMode arg                 Authentication mode used for cluster

                                        authentication. Alternatives are

                                        (keyFile|sendKeyFile|sendX509|x509)

  --nounixsocket                        disable listening on unix sockets

  --unixSocketPrefix arg                alternative directory for UNIX domain

                                        sockets (defaults to /tmp)

  --filePermissions arg                 permissions to set on UNIX domain

                                        socket file - 0700 by default

  --fork                                fork server process

  --auth                                run with security

  --jsonp                               allow JSONP access via http (has

                                        security implications)

  --rest                                turn on simple rest api

  --slowms arg (=100)                   value of slow for profile and console

                                        log

  --profile arg                         0=off 1=slow, 2=all

  --cpu                                 periodically show cpu and iowait

                                        utilization

  --sysinfo                             print some diagnostic system

                                        information

  --noIndexBuildRetry                   don't retry any index builds that were

                                        interrupted by shutdown

  --noscripting                         disable scripting engine

  --notablescan                         do not allow table scans

  --shutdown                            kill a running server (for init

                                        scripts)

Replication options:

  --oplogSize arg                       size to use (in MB) for replication op

                                        log. default is 5% of disk space (i.e.

                                        large is good)

Master/slave options (old; use replica sets instead):

  --master                              master mode

  --slave                               slave mode

  --source arg                          when slave: specify master as

                                       

  --only arg                            when slave: specify a single database

                                        to replicate

  --slavedelay arg                      specify delay (in seconds) to be used

                                        when applying master ops to slave

  --autoresync                          automatically resync if slave data is

                                        stale

Replica set options:

  --replSet arg                         arg is [/<optionalseedhostlist </optionalseedhostlist<>

                                        >]

  --replIndexPrefetch arg               specify index prefetching behavior (if

                                        secondary) [none|_id_only|all]

  --enableMajorityReadConcern           enables majority readConcern

Sharding options:

  --configsvr                           declare this is a config db of a

                                        cluster; default port 27019; default

                                        dir /data/configdb

  --configsvrMode arg                   Controls what config server protocol is

                                        in use. When set to "sccc" keeps server

                                        in legacy SyncClusterConnection mode

                                        even when the service is running as a

                                        replSet

  --shardsvr                            declare this is a shard db of a

                                        cluster; default port 27018

Storage options:

  --storageEngine arg                   what storage engine to use - defaults

                                        to wiredTiger if no data files present

  --dbpath arg                          directory for datafiles - defaults to

                                        /data/db

  --directoryperdb                      each database will be stored in a

                                        separate directory

  --noprealloc                          disable data file preallocation - will

                                        often hurt performance

  --nssize arg (=16)                    .ns file size (in MB) for new databases

  --quota                               limits each database to a certain

                                        number of files (8 default)

  --quotaFiles arg                      number of files allowed per db, implies

                                        --quota

  --smallfiles                          use a smaller default file size

  --syncdelay arg (=60)                 seconds between disk syncs (0=never,

                                        but not recommended)

  --upgrade                             upgrade db if needed

  --repair                              run repair on all dbs

  --repairpath arg                      root directory for repair files -

                                        defaults to dbpath

  --journal                             enable journaling

  --nojournal                           disable journaling (journaling is on by

                                        default for 64 bit)

  --journalOptions arg                  journal diagnostic options

  --journalCommitInterval arg           how often to group/batch commit (ms)

WiredTiger options:

  --wiredTigerCacheSizeGB arg           maximum amount of memory to allocate

                                        for cache; defaults to 1/2 of physical

                                        RAM

  --wiredTigerStatisticsLogDelaySecs arg (=0)

                                        seconds to wait between each write to a

                                        statistics file in the dbpath; 0 means

                                        do not log statistics

  --wiredTigerJournalCompressor arg (=snappy)

                                        use a compressor for log records

                                        [none|snappy|zlib]

  --wiredTigerDirectoryForIndexes       Put indexes and data in different

                                        directories

  --wiredTigerCollectionBlockCompressor arg (=snappy)

                                        block compression algorithm for

                                        collection data [none|snappy|zlib]

  --wiredTigerIndexPrefixCompression arg (=1)

                                        use prefix compression on row-store

                                        leaf pages
 9、启动mongodb数据库
[mongo@mongo ~]$ mongod --dbpath=$MONGO_DATA --logpath=$MONGO_LOGS/mongodb.log --logappend&

[1] 3028

[mongo@mongo ~]$
 10、检查mongodb的运行状态
[root@mongo mongo]# ps -ef|grep mongo

mongo     3028     1  1 01:31 pts/0    00:00:00 mongod --dbpath=/opt/mongo/data --logpath=/opt/mongo/logs/mongodb.log --logappend

root      3059  2443  0 01:32 pts/0    00:00:00 grep mongo
[root@mongo mongo]# cd /opt/mongo/logs

[root@mongo logs]# cat mongodb.log

2016-06-11T01:31:19.106-0700 I CONTROL  [initandlisten] MongoDB starting : pid=3028 port=27017 dbpath=/opt/mongo/data 64-bit host=mongo

2016-06-11T01:31:19.107-0700 I CONTROL  [initandlisten] db version v3.2.7

2016-06-11T01:31:19.107-0700 I CONTROL  [initandlisten] git version: 4249c1d2b5999ebbf1fdf3bc0e0e3b3ff5c0aaf2

2016-06-11T01:31:19.107-0700 I CONTROL  [initandlisten] allocator: tcmalloc

2016-06-11T01:31:19.107-0700 I CONTROL  [initandlisten] modules: none

2016-06-11T01:31:19.107-0700 I CONTROL  [initandlisten] build environment:

2016-06-11T01:31:19.107-0700 I CONTROL  [initandlisten]     distarch: x86_64

2016-06-11T01:31:19.107-0700 I CONTROL  [initandlisten]     target_arch: x86_64

2016-06-11T01:31:19.107-0700 I CONTROL  [initandlisten] options: { storage: { dbPath: "/opt/mongo/data" }, systemLog: { destination: "file", logAppend: true, path: "/opt/mongo/logs/mongodb.log" } }

2016-06-11T01:31:19.139-0700 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten]

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten]

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten]

2016-06-11T01:31:19.187-0700 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/opt/mongo/data/diagnostic.data'

2016-06-11T01:31:19.187-0700 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker

2016-06-11T01:31:19.194-0700 I NETWORK  [initandlisten] waiting for connections on port 27017
[root@mongo ~]# netstat -lanp  | grep 27017

tcp        0      0 0.0.0.0:27017               0.0.0.0:*                   LISTEN      3028/mongod        

tcp        0      0 127.0.0.1:39769             127.0.0.1:27017             ESTABLISHED 3099/mongo         

tcp        0      0 127.0.0.1:27017             127.0.0.1:39769             ESTABLISHED 3028/mongod        

unix  2      [ ACC ]     STREAM     LISTENING     23441  3028/mongod         /tmp/mongodb-27017.sock

 11、登录MongoDB数据库
[mongo@mongo ~]$ mongo

MongoDB shell version: 3.2.7

connecting to: 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

Server has startup warnings:

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten]

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten]

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2016-06-11T01:31:19.186-0700 I CONTROL  [initandlisten]


 登录后,MongoDB要求关闭操作系统的 transparent_hugepage特性(这里可以放在MongoDB安装前,系统调整时执行),需要以root身份执行以下命令:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
[root@mongo transparent_hugepage]# echo never > /sys/kernel/mm/transparent_hugepage/enabled
[root@mongo transparent_hugepage]# echo never > /sys/kernel/mm/transparent_hugepage/defrag
 12、重启MongoDB数据库并测试数据库可用性
[mongo@mongo ~]$ mongo
MongoDB shell version: 3.2.7
connecting to: test
Server has startup warnings: 
2016-06-13T18:58:21.838-0700 I CONTROL  [initandlisten] 
2016-06-13T18:58:21.839-0700 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-06-13T18:58:21.839-0700 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-06-13T18:58:21.839-0700 I CONTROL  [initandlisten] 
2016-06-13T18:58:21.839-0700 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-06-13T18:58:21.839-0700 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-06-13T18:58:21.839-0700 I CONTROL  [initandlisten] 
> use admin
switched to db admin
> db.shutdownServer();
server should be down...
2016-06-13T19:04:21.290-0700 I NETWORK  [thread1] trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2016-06-13T19:04:21.291-0700 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2016-06-13T19:04:21.291-0700 I NETWORK  [thread1] reconnect 127.0.0.1:27017 (127.0.0.1) failed failed 
> exit
bye
[1]+  Done                    mongod --dbpath=$MONGO_DATA --logpath=$MONGO_LOGS/mongodb.log --logappend
[mongo@mongo ~]$ mongod --dbpath=$MONGO_DATA --logpath=$MONGO_LOGS/mongodb.log --logappend&
[1] 40476
[mongo@mongo ~]$ mongo
MongoDB shell version: 3.2.7
connecting to: test

> show db

local  0.000GB

> use zhul

switched to db zhul

> show dbs

local  0.000GB

> db.createCollection("test")

{ "ok" : 1 }

> show dbs

local  0.000GB

zhul   0.000GB
 安装成功!
目录
相关文章
|
NoSQL Windows
mongodb 3.2.10 for windows server 2008 R2 installation
一、操作系统信息 二、集群网络环境测试 224心跳节点 253分片节点 227分片节点 三、集群环境NTP时钟检查 可以看到3个节点的时钟并不同步,接下来进行NTP时钟同步 点击windows界面右下角时间点击更改日期和时间设置 点击Internet时间 点击更改设置服务器输入:NTP服务器所在机器的IP地址,本集群选取10.
1587 0
|
4月前
|
NoSQL MongoDB 数据库
数据库数据恢复—MongoDB数据库数据恢复案例
MongoDB数据库数据恢复环境: 一台操作系统为Windows Server的虚拟机上部署MongoDB数据库。 MongoDB数据库故障: 工作人员在MongoDB服务仍然开启的情况下将MongoDB数据库文件拷贝到其他分区,数据复制完成后将MongoDB数据库原先所在的分区进行了格式化操作。 结果发现拷贝过去的数据无法使用。管理员又将数据拷贝回原始分区,MongoDB服务仍然无法使用,报错“Windows无法启动MongoDB服务(位于 本地计算机 上)错误1067:进程意外终止。”
|
4月前
|
缓存 NoSQL Linux
在CentOS 7系统中彻底移除MongoDB数据库的步骤
以上步骤完成后,MongoDB应该会从您的CentOS 7系统中被彻底移除。在执行上述操作前,请确保已经备份好所有重要数据以防丢失。这些步骤操作需要一些基本的Linux系统管理知识,若您对某一步骤不是非常清楚,请先进行必要的学习或咨询专业人士。在执行系统级操作时,推荐在实施前创建系统快照或备份,以便在出现问题时能够恢复到原先的状态。
422 79
|
4月前
|
存储 NoSQL MongoDB
MongoDB数据库详解-针对大型分布式项目采用的原因以及基础原理和发展-卓伊凡|贝贝|莉莉
MongoDB数据库详解-针对大型分布式项目采用的原因以及基础原理和发展-卓伊凡|贝贝|莉莉
271 8
MongoDB数据库详解-针对大型分布式项目采用的原因以及基础原理和发展-卓伊凡|贝贝|莉莉
|
3月前
|
运维 NoSQL 容灾
告别运维噩梦:手把手教你将自建 MongoDB 平滑迁移至云数据库
程序员为何逃离自建MongoDB?扩容困难、运维复杂、高可用性差成痛点。阿里云MongoDB提供分钟级扩容、自动诊断与高可用保障,助力企业高效运维、降本增效,实现数据库“无感运维”。
|
7月前
|
NoSQL MongoDB 数据库
数据库数据恢复——MongoDB数据库服务无法启动的数据恢复案例
MongoDB数据库数据恢复环境: 一台Windows Server操作系统虚拟机上部署MongoDB数据库。 MongoDB数据库故障: 管理员在未关闭MongoDB服务的情况下拷贝数据库文件。将MongoDB数据库文件拷贝到其他分区后,对MongoDB数据库所在原分区进行了格式化操作。格式化完成后将数据库文件拷回原分区,并重新启动MongoDB服务。发现服务无法启动并报错。
|
8月前
|
存储 NoSQL MongoDB
微服务——MongoDB常用命令1——数据库操作
本节介绍了 MongoDB 中数据库的选择、创建与删除操作。使用 `use 数据库名称` 可选择或创建数据库,若数据库不存在则自动创建。通过 `show dbs` 或 `show databases` 查看所有可访问的数据库,用 `db` 命令查看当前数据库。注意,集合仅在插入数据后才会真正创建。数据库命名需遵循 UTF-8 格式,避免特殊字符,长度不超过 64 字节,且部分名称如 `admin`、`local` 和 `config` 为系统保留。删除数据库可通过 `db.dropDatabase()` 实现,主要用于移除已持久化的数据库。
590 0
|
8月前
|
存储 NoSQL MongoDB
从 MongoDB 到 时序数据库 TDengine,沃太能源实现 18 倍写入性能提升
沃太能源是国内领先储能设备生产厂商,数十万储能终端遍布世界各地。此前使用 MongoDB 存储时序数据,但随着设备测点增加,MongoDB 在存储效率、写入性能、查询性能等方面暴露出短板。经过对比,沃太能源选择了专业时序数据库 TDengine,生产效能显著提升:整体上,数据压缩率超 10 倍、写入性能提升 18 倍,查询在特定场景上也实现了数倍的提升。同时减少了技术架构复杂度,实现了零代码数据接入。本文将对 TDengine 在沃太能源的应用情况进行详解。
408 0
|
9月前
|
存储 NoSQL MongoDB
数据库数据恢复—MongoDB数据库迁移过程中丢失文件的数据恢复案例
某单位一台MongoDB数据库由于业务需求进行了数据迁移,数据库迁移后提示:“Windows无法启动MongoDB服务(位于 本地计算机 上)错误1067:进程意外终止。”
|
11月前
|
存储 JSON NoSQL
学习 MongoDB:打开强大的数据库技术大门
MongoDB 是一个基于分布式文件存储的文档数据库,由 C++ 编写,旨在为 Web 应用提供可扩展的高性能数据存储解决方案。它与 MySQL 类似,但使用文档结构而非表结构。核心概念包括:数据库(Database)、集合(Collection)、文档(Document)和字段(Field)。MongoDB 使用 BSON 格式存储数据,支持多种数据类型,如字符串、整数、数组等,并通过二进制编码实现高效存储和传输。BSON 文档结构类似 JSON,但更紧凑,适合网络传输。
434 15

推荐镜像

更多