CentOS 시스템 에서 MongoDB 설치 및 설정 튜 토리 얼

13137 단어 CentOSMongoDB
1.준비 작업:
yum 명령 을 실행 하여 MongoDB 의 패키지 정 보 를 봅 니 다.

[root@vm ~]# yum info mongo-10gen
(알림 에 일치 하 는 정보 가 없습니다.)
이 는 centos 시스템 의 yum 소스 에 MongoDB 관련 자원 이 포함 되 어 있 지 않 기 때문에 yum 명령 으로 MongoDB 를 설치 하기 전에 yum 소스 를 추가 해 야 한 다 는 뜻 입 니 다.즉,/etc/yum.repos.d/디 렉 터 리 에*.repo yum 소스 설정 파일 을 추가 해 야 합 니 다.다음은 centos 64 비트 와 32 비트 다른 시스템 의 MongoDB yum 소스 설정 내용 입 니 다.
이 파일 을/etc/yum.repos.d/10gen.repo 라 고 명명 합 니 다.
64 비트 yum 원본 설정:

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 원본 설정:

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

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

자신의 시스템 에 따라 해당 하 는 설정 내용 을 선택 하 십시오.
시스템 이 32 비트 인지 64 비트 인지 확인 하 는 방법:

$ uname -a
x86 함유64 의 설명 은 64 비트 입 니 다.예 를 들 어 제 centos 6.0 64bit 시스템 이 이 명령 을 실행 한 후에 표 시 됩 니 다.

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 원본 설정 을 마 친 후 아래 명령 을 올 바 르 게 실행 하면 MongoDB 와 관련 된 정 보 를 조회 할 수 있 습 니 다.
mongoDB 의 서버 패키지 정보 보기

[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 ~]#

클 라 이언 트 도구 정보 보기

[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 ~]#

2.MongoDB 를 설치 하 는 서버 쪽 과 클 라 이언 트 도구
1.서버 쪽 설치:

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

―――――――――――――――C

이게 바로 MongoDB 의 프로그램 파일 입 니 다.
mongo-10gen-server 패 키 지 는 mongo-10gen 에 의존 하기 때문에 서버 를 설치 한 후 클 라 이언 트 공구 꾸러미 mongo-10gen 을 따로 설치 할 필요 가 없습니다.
2.클 라 이언 트 단독 설치:

[root@vm ~]# yum install mongo-10gen
3.검사

[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 ~]#
안 후 서버 쪽 이 실행 되 고 있다 는 뜻 입 니 다.
4.서버 설정:/etc/mongod.conf

[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 #
 
# Enables periodic logging of CPU utilization and I/O wait
# CPU I/O
#cpu = true
 
# Turn on/off security.  Off is currently the default
# ,
#noauth = true
#auth = true
 
# Verbose logging output.
#
#verbose = true
 
# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true
 
# Enable db quota management , db 8 , quotaFiles
#quota = true
# 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
#nocursors = true
 
# Ignore query hints
#nohints = true
# http , localhost:28017
# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true
 
# ,
# Turns off server-side scripting.  This will result in greatly limited
# functionality
#noscripting = true
# ,
# Turns off table scans.  Any query that would do a table scan fails.
#notablescan = true
#
# Disable data file preallocation.
#noprealloc = true
# .ns , :MB
# Specify .ns file size for new databases.
# nssize = <size>
 
# Accout token for Mongo monitoring server.
#mms-token = <token>
# mongo
# Server name for Mongo monitoring server.
#mms-name = <server-name>
# mongo ping
# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>
 
# Replication Options
 
# in replicated mongo databases, specify here whether this is a slave or master ,
#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 ~]#
 
, 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
  --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) ,
  --unixSocketPrefix arg alternative directory for UNIX domain sockets
                         (defaults to /tmp)
  --fork                 fork server process
  --auth                 run with security
  --cpu                  periodically show cpu and iowait utilization CPU IO
  --dbpath arg           directory for datafiles
  --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
                        
  --journal              enable journaling , ,
  --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
  --nohttpinterface      disable http interface http
  --noprealloc           disable data file preallocation - will often hurt
                         performance ,
  --noscripting          disable scripting engine
  --notablescan          do not allow table scans
  --nounixsocket         disable listening on unix sockets unix sockets
  --nssize arg (=16)     .ns file size (in MB) for new databases .ns
  --objcheck             inspect client data for validity on receipt
  --profile arg          0=off 1=slow, 2=all
  --quota                limits each database to a certain number of files (8
                         default) , db 8 , quotaFiles
  --quotaFiles arg       number of files allower per db, requires --quota
  --rest                 turn on simple rest api rest api
  --repair               run repair on all dbs
  --repairpath arg       root directory for repair files - defaults to dbpath ,
                         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) , 60 ,0 ( )
  --sysinfo              print some diagnostic system information
  --upgrade              upgrade db if needed ,
                        (<=1.0 1.1+ )
 
Replication options:   
  --fastsync            indicate that this instance is starting from a dbpath
                        snapshot of the repl peer dbpath
  --autoresync          automatically resync if slave data is stale ,
                       
  --oplogSize arg       size limit (in MB) for op log oplog
 
Master/slave options:   /
  --master              master mode
  --slave               slave mode 
  --source arg          when slave: specify master as <server:port>
  --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
 
Replica set options:   
  --replSet arg         arg is <setname>[/<optionalseedhostlist>]
                        :< >[< >]
 
Sharding options:      
  --configsvr           declare this is a config db of a cluster; default port
                        27019; default dir /data/configdb ,
                        27019 /data/configdb
  --shardsvr            declare this is a shard db of a cluster; default port
                        27018 , 27018
  --noMoveParanoia      turn off paranoid saving of data for moveChunk.  this
                        is on by default for now, but default will switch
                        。 ,
 
[root@vm ~]#

좋은 웹페이지 즐겨찾기