一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|數(shù)據(jù)庫技術(shù)|

服務(wù)器之家 - 數(shù)據(jù)庫 - MongoDB - CentOS系統(tǒng)下MongoDB安裝及配置教程

CentOS系統(tǒng)下MongoDB安裝及配置教程

2020-04-29 15:56MongoDB教程網(wǎng) MongoDB

這篇文章主要介紹了CentOS系統(tǒng)下MongoDB安裝及配置教程,本文先是講解了一些準(zhǔn)備工作,然后講解了安裝MongoDB的服務(wù)器端和客戶端工具的步驟,需要的朋友可以參考下

一、準(zhǔn)備工作:
運(yùn)行yum命令查看MongoDB的包信息

復(fù)制代碼 代碼如下:

[root@vm ~]# yum info mongo-10gen


(提示沒有相關(guān)匹配的信息,)

 

說明你的centos系統(tǒng)中的yum源不包含MongoDB的相關(guān)資源,所以要在使用yum命令安裝MongoDB前需要增加yum源,也就是在 /etc/yum.repos.d/目錄中增加 *.repo yum源配置文件,以下分別是針對centos 64位和32位不同的系統(tǒng)的MongoDB yum 源配置內(nèi)容:

我們這里就將該文件命名為:/etc/yum.repos.d/10gen.repo

For 64-bit yum源配置:

復(fù)制代碼 代碼如下:


vi /etc/yum.repos.d/10gen.repo

 

[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0


For 32-bit yum源配置:

復(fù)制代碼 代碼如下:


vi /etc/yum.repos.d/10gen.repo

 

[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0


根據(jù)自己的系統(tǒng)選擇相應(yīng)的配置內(nèi)容

 

查看系統(tǒng)是32位還是64位的方法:

復(fù)制代碼 代碼如下:

$ uname -a


含有x86_64的那說明是64位的,例如我的centos6.0 64bit系統(tǒng)執(zhí)行這個命令后顯示:

復(fù)制代碼 代碼如下:

Linux vm.centos6 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 x86_64 x86_64 GNU/Linux


做好yum源的配置后,如果配置正確執(zhí)行下面的命令便可以查詢MongoDB相關(guān)的信息:

 

查看mongoDB的服務(wù)器包的信息

復(fù)制代碼 代碼如下:


[root@vm ~]# yum info mongo-10gen-server
****(省略多行不重要的信息)*********
Available Packages
Name : mongo-10gen-server
Arch : x86_64
Version : 1.8.2
Release : mongodb_1
Size : 4.7 M
Repo : 10gen
Summary : mongo server, sharding server, and support scripts
URL : http://www.mongodb.org
License : AGPL 3.0
Description: Mongo (from “huMONGOus”) is a schema-free document-oriented
: database.
:
: This package provides the mongo server software, mongo sharding
: server softwware, default configuration files, and init.d scripts.

 

[root@vm ~]#


查看客戶端工具的信息

復(fù)制代碼 代碼如下:


[root@vm ~]# yum info mongo-10gen
Loaded plugins: fastestmirror
**(省略多行不重要的信息)**
Installed Packages
Name : mongo-10gen
Arch : x86_64
Version : 1.8.2
Release : mongodb_1
Size : 55 M
Repo : 10gen
Summary : mongo client shell and tools
URL : http://www.mongodb.org
License : AGPL 3.0
Description: Mongo (from “huMONGOus”) is a schema-free document-oriented
: database. It features dynamic profileable queries, full indexing,
: replication and fail-over support, efficient storage of large
: binary data objects, and auto-sharding.
:
: This package provides the mongo shell, import/export tools, and
: other client utilities.

 

[root@vm ~]#

 

 

二、安裝MongoDB的服務(wù)器端和客戶端工具

 

1.安裝服務(wù)器端:

復(fù)制代碼 代碼如下:


[root@vm ~]# yum install mongo-10gen-server
[root@vm ~]# ls /usr/bin/mongo(tab鍵)
mongo mongod mongodump mongoexport mongofiles mongoimport mongorestore mongos mongostat

 

———————————————–


這些就是MongoDB的程序文件

 

因?yàn)閙ongo-10gen-server包依賴于mongo-10gen,所以安裝了服務(wù)器后就不需要單獨(dú)安裝客戶端工具包mongo-10gen了

2.單獨(dú)安裝可客戶端:

復(fù)制代碼 代碼如下:

[root@vm ~]# yum install mongo-10gen


3.檢查

復(fù)制代碼 代碼如下:

[root@vm ~]# /etc/init.d/mongod
Usage: /etc/init.d/mongod {start|stop|status|restart|reload|force-reload|condrestart}
[root@vm ~]# /etc/init.d/mongod status
mongod (pid 1341) is running…
[root@vm ~]#


說明安后服務(wù)器端已經(jīng)在運(yùn)行了

 

4.服務(wù)器配置: /etc/mongod.conf

復(fù)制代碼 代碼如下:

[root@vm ~]# cat /etc/mongod.conf
# mongo.conf
 
#where to log
logpath=/var/log/mongo/mongod.log
 
logappend=true #以追加方式寫入日志
 
# fork and run in background
fork = true
 
#port = 27017 #端口
 
dbpath=/var/lib/mongo #數(shù)據(jù)庫文件保存位置
 
# Enables periodic logging of CPU utilization and I/O wait
#啟用定期記錄CPU利用率和 I/O 等待
#cpu = true
 
# Turn on/off security.  Off is currently the default
# 是否以安全認(rèn)證方式運(yùn)行,默認(rèn)是不認(rèn)證的非安全方式
#noauth = true
#auth = true
 
# Verbose logging output.
# 詳細(xì)記錄輸出
#verbose = true
 
# Inspect all client data for validity on receipt (useful for
# developing drivers)用于開發(fā)驅(qū)動程序時的檢查客戶端接收數(shù)據(jù)的有效性
#objcheck = true
 
# Enable db quota management 啟用數(shù)據(jù)庫配額管理,默認(rèn)每個db可以有8個文件,可以用quotaFiles參數(shù)設(shè)置
#quota = true
# 設(shè)置oplog記錄等級
# Set oplogging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
#oplog = 0
 
# Diagnostic/debugging option 動態(tài)調(diào)試項(xiàng)
#nocursors = true
 
# Ignore query hints 忽略查詢提示
#nohints = true
# 禁用http界面,默認(rèn)為localhost:28017
# Disable the HTTP interface (Defaults to localhost:27018).這個端口號寫的是錯的
#nohttpinterface = true
 
# 關(guān)閉服務(wù)器端腳本,這將極大的限制功能
# Turns off server-side scripting.  This will result in greatly limited
# functionality
#noscripting = true
# 關(guān)閉掃描表,任何查詢將會是掃描失敗
# Turns off table scans.  Any query that would do a table scan fails.
#notablescan = true
# 關(guān)閉數(shù)據(jù)文件預(yù)分配
# Disable data file preallocation.
#noprealloc = true
# 為新數(shù)據(jù)庫指定.ns文件的大小,單位:MB
# Specify .ns file size for new databases.
# nssize = <size>
 
# Accout token for Mongo monitoring server.
#mms-token = <token>
# mongo監(jiān)控服務(wù)器的名稱
# Server name for Mongo monitoring server.
#mms-name = <server-name>
# mongo監(jiān)控服務(wù)器的ping 間隔
# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>
 
# Replication Options 復(fù)制選項(xiàng)
 
# in replicated mongo databases, specify here whether this is a slave or master 在復(fù)制中,指定當(dāng)前是從屬關(guān)系
#slave = true
#source = master.example.com
# Slave only: specify a single database to replicate
#only = master.example.com
# or
#master = true
#source = slave.example.com
[root@vm ~]#
 
以上是默認(rèn)的配置文件中的一些參數(shù),更多參數(shù)可以用 mongod -h 命令來查看
 
[root@vm ~]# mongod -h
Allowed options:
 
General options:
  -h [ --help ]          show this usage information
  --version              show version information
  -f [ --config ] arg    configuration file specifying additional options 指定啟動配置文件路徑
  -v [ --verbose ]       be more verbose (include multiple times for more
                         verbosity e.g. -vvvvv)
  --quiet                quieter output
  --port arg             specify port number 端口
  --bind_ip arg          comma separated list of ip addresses to listen on -
                         all local ips by default 綁定ip,可以多個
  --maxConns arg         max number of simultaneous connections 最大并發(fā)連接數(shù)
  --logpath arg          log file to send write to instead of stdout - has to
                         be a file, not directory 日志文件路徑
  --logappend            append to logpath instead of over-writing 日志寫入方式
  --pidfilepath arg      full path to pidfile (if not set, no pidfile is
                         created) pid文件路徑
  --keyFile arg          private key for cluster authentication (only for
                         replica sets)集群認(rèn)證私鑰,僅適用于副本集
  --unixSocketPrefix arg alternative directory for UNIX domain sockets
                         (defaults to /tmp)替代目錄
  --fork                 fork server process
  --auth                 run with security 使用認(rèn)證方式運(yùn)行
  --cpu                  periodically show cpu and iowait utilization 定期顯示的CPU和IO等待利用率
  --dbpath arg           directory for datafiles 數(shù)據(jù)庫文件路徑
  --diaglog arg          0=off 1=W 2=R 3=both 7=W+some reads oplog記錄等級
  --directoryperdb       each database will be stored in a separate directory
                         每個數(shù)據(jù)庫存儲到單獨(dú)目錄
  --journal              enable journaling 記錄日志,建議開啟,在異常宕機(jī)時可以恢復(fù)一些數(shù)據(jù)
  --journalOptions arg   journal diagnostic options
  --ipv6                 enable IPv6 support (disabled by default)
  --jsonp                allow JSONP access via http (has security
                         implications)允許JSONP通過http訪問,該方式存在安全隱患
  --noauth               run without security 不帶安全認(rèn)證的方式
  --nohttpinterface      disable http interface 禁用http接口
  --noprealloc           disable data file preallocation - will often hurt
                         performance 禁用數(shù)據(jù)文件的預(yù)分配,往往會損害性能
  --noscripting          disable scripting engine 禁用腳本引擎
  --notablescan          do not allow table scans 不允許表掃描
  --nounixsocket         disable listening on unix sockets禁止unix sockets監(jiān)聽
  --nssize arg (=16)     .ns file size (in MB) for new databases 為新數(shù)據(jù)設(shè)置.ns文件的大小
  --objcheck             inspect client data for validity on receipt 檢查在收到客戶端的數(shù)據(jù)的有效性
  --profile arg          0=off 1=slow, 2=all
  --quota                limits each database to a certain number of files (8
                         default)啟用數(shù)據(jù)庫配額管理,默認(rèn)每個db可以有8個文件,可以用quotaFiles參數(shù)設(shè)置
  --quotaFiles arg       number of files allower per db, requires --quota
  --rest                 turn on simple rest api 開啟rest api
  --repair               run repair on all dbs 修復(fù)所有數(shù)據(jù)庫
  --repairpath arg       root directory for repair files - defaults to dbpath修復(fù)文件的根目錄,默
                         認(rèn)為dbpath指定的目錄
  --slowms arg (=100)    value of slow for profile and console log
  --smallfiles           use a smaller default file size
  --syncdelay arg (=60)  seconds between disk syncs (0=never, but not
                         recommended)與硬盤同步數(shù)據(jù)的時間,默認(rèn)60秒,0表示不同步到硬盤(不建議)
  --sysinfo              print some diagnostic system information打印一些診斷系統(tǒng)信息
  --upgrade              upgrade db if needed 如果必要,將數(shù)據(jù)庫文件升級到新的格式
                        (<=1.0到1.1+升級時所需的)
 
Replication options:    復(fù)制選項(xiàng)
  --fastsync            indicate that this instance is starting from a dbpath
                        snapshot of the repl peer 從一個dbpath快照開始同步
  --autoresync          automatically resync if slave data is stale 自動同步,如果從機(jī)的數(shù)據(jù)不是新的
                        自動同步
  --oplogSize arg       size limit (in MB) for op log oplog的大小
 
Master/slave options:   主/從配置選項(xiàng)
  --master              master mode 主模式
  --slave               slave mode  從屬模式
  --source arg          when slave: specify master as <server:port>從屬服務(wù)器上指定主服務(wù)器地址
  --only arg            when slave: specify a single database to replicate從屬服務(wù)器上指定要復(fù)制的
                        數(shù)據(jù)庫
  --slavedelay arg      specify delay (in seconds) to be used when applying
                        master ops to slave 指定從主服務(wù)器上同步數(shù)據(jù)的時間間隔 單位秒
 
Replica set options:    副本集選項(xiàng)
  --replSet arg         arg is <setname>[/<optionalseedhostlist>]
                        參數(shù):<名稱>[<種子主機(jī)列表>]
 
Sharding options:       分片設(shè)置選項(xiàng)
  --configsvr           declare this is a config db of a cluster; default port
                        27019; default dir /data/configdb 聲明這是一個集群的配置數(shù)據(jù)庫,
                        默認(rèn)的端口是27019 默認(rèn)的路徑是/data/configdb
  --shardsvr            declare this is a shard db of a cluster; default port
                        27018 聲明這是集群的一個分片數(shù)據(jù)庫,默認(rèn)端口為27018
  --noMoveParanoia      turn off paranoid saving of data for moveChunk.  this
                        is on by default for now, but default will switch
                        關(guān)閉偏著保存大塊數(shù)據(jù)。現(xiàn)在它是默認(rèn)的,但是會變換
 
[root@vm ~]#

 

延伸 · 閱讀

精彩推薦
  • MongoDBmongodb基本命令實(shí)例小結(jié)

    mongodb基本命令實(shí)例小結(jié)

    這篇文章主要介紹了mongodb基本命令,結(jié)合實(shí)例形式總結(jié)分析了MongoDB數(shù)據(jù)庫切換、查看、刪除、查詢等基本命令用法與操作注意事項(xiàng),需要的朋友可以參考下...

    dawn-liu3652020-05-26
  • MongoDB分布式文檔存儲數(shù)據(jù)庫之MongoDB分片集群的問題

    分布式文檔存儲數(shù)據(jù)庫之MongoDB分片集群的問題

    這篇文章主要介紹了分布式文檔存儲數(shù)據(jù)庫之MongoDB分片集群的問題,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋...

    Linux-18743072020-12-20
  • MongoDBMongodb實(shí)現(xiàn)定時備份與恢復(fù)的方法教程

    Mongodb實(shí)現(xiàn)定時備份與恢復(fù)的方法教程

    這篇文章主要給大家介紹了Mongodb實(shí)現(xiàn)定時備份與恢復(fù)的方法教程,文中通過示例代碼介紹的非常詳細(xì),對大家具有一定的參考學(xué)習(xí)價值,需要的朋友們下面...

    chenjsh364522020-05-13
  • MongoDB遷移sqlserver數(shù)據(jù)到MongoDb的方法

    遷移sqlserver數(shù)據(jù)到MongoDb的方法

    這篇文章主要介紹了遷移sqlserver數(shù)據(jù)到MongoDb的方法,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下...

    聽楓xl9682021-01-03
  • MongoDBMongoDB憑什么躋身數(shù)據(jù)庫排行前五

    MongoDB憑什么躋身數(shù)據(jù)庫排行前五

    MongoDB以比去年同期超出65.96分的成績繼續(xù)雄踞榜單前五,這個增幅在全榜僅次于PostgreSQL的77.99,而其相對于4月份的6.10分的增長也是僅次于微軟SQL Server排名...

    孫浩峰3892020-05-22
  • MongoDBMongoDB中javascript腳本編程簡介和入門實(shí)例

    MongoDB中javascript腳本編程簡介和入門實(shí)例

    作為一個數(shù)據(jù)庫,MongoDB有一個很大的優(yōu)勢——它使用js管理數(shù)據(jù)庫,所以也能夠使用js腳本進(jìn)行復(fù)雜的管理——這種方法非常靈活 ...

    MongoDB教程網(wǎng)6982020-04-24
  • MongoDBMongoDB 內(nèi)存使用情況分析

    MongoDB 內(nèi)存使用情況分析

    都說 MongoDB 是個內(nèi)存大戶,但是怎么知道它到底用了多少內(nèi)存呢...

    MongoDB教程網(wǎng)10002020-09-29
  • MongoDBMongoDB安裝圖文教程

    MongoDB安裝圖文教程

    這篇文章主要為大家詳細(xì)介紹了MongoDB安裝圖文教程,分為兩大部分為大家介紹下載MongoDB和安裝MongoDB的方法,感興趣的小伙伴們可以參考一下 ...

    Yangyi.He6132020-05-07
主站蜘蛛池模板: 亚洲天堂男人的天堂 | 俄罗斯处女 | 亚洲欧美成人综合在线 | 亚洲久草 | 国内久久久 | 亚洲男人天| 高h短篇辣肉各种姿势bl | 草草线在成年免费视频网站 | 无颜之月5集全免费看无删除 | 黄绝一级 | 91大神在线精品视频一区 | 亚洲欧美国产在线 | 日本高清视频在线免费观看 | 91人人在线 | 欧美日韩国产一区二区三区伦 | avidolz性教师| 5g影院天天5g天天爽大陆 | 欧美军人男同69gay | 我和子伦系列小说 | 天美影视传媒mv直接看 | 好大用力深一点视频 | 日本高清全集免费观看 | 国产资源免费 | 亚洲国产在线视频精品 | 富士av105| 亚洲精品久久久久69影院 | 欧美一区二区三区视视频 | 亚洲国产美女精品久久 | 午夜久久精品 | 精品亚洲欧美中文字幕在线看 | 国产大片51精品免费观看 | 国产女王女m视频vk 国产农村一级特黄α真人毛片 | 国内精品久久久久影院中国 | 国产成人精品视频午夜 | 2021国产精品露脸在线 | 王雨纯羞羞 | 国产精品亚洲午夜不卡 | 久久AV国产麻豆HD真实乱 | 成人在线观看一区 | 国产久视频 | 久久黄色精品视频 |