【你应该知道的mongodb】-【启动脚本】

一、安装

虑过

二、启动


1:先看一下哈,脚本不少

[root@NODEA bin]# pwd
/opt/mongodb-linux-i686-2.2.0/bin
[root@NODEA bin]# ls -al
总计 130636
drwxr-xr-x 2 root root     4096 10-29 20:12 .
drwxr-xr-x 3 root root     4096 10-29 20:12 ..
-rwxr-xr-x 1  500  500 10218372 08-29 00:00 bsondump
-rwxr-xr-x 1  500  500  4073736 08-29 00:01 mongo
-rwxr-xr-x 1  500  500 10264740 08-29 00:01 mongod
-rwxr-xr-x 1  500  500 10268132 08-28 23:58 mongodump
-rwxr-xr-x 1  500  500 10230628 08-28 23:59 mongoexport
-rwxr-xr-x 1  500  500 10271636 08-29 00:00 mongofiles
-rwxr-xr-x 1  500  500 10244260 08-28 23:59 mongoimport
-rwxr-xr-x 1  500  500 10218308 08-29 00:00 mongooplog
-rwxr-xr-x 1  500  500 10222980 08-29 00:00 mongoperf
-rwxr-xr-x 1  500  500 10263396 08-28 23:59 mongorestore
-rwxr-xr-x 1  500  500  6504980 08-29 00:01 mongos
-rwxr-xr-x 1  500  500 10190296 08-29 00:00 mongosniff
-rwxr-xr-x 1  500  500 10267588 08-28 23:59 mongostat
-rwxr-xr-x 1  500  500 10222596 08-29 00:00 mongotop

2:看下help

如下,分为红色的几个部分,通用的选项一般用的比较多。

再就是副本及和分片的几个参数。其他的很少用。


[root@NODEA bin]# mongod --help
Thu Nov  1 00:21:37
Thu Nov  1 00:21:37 ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Thu Nov  1 00:21:37 **       see http://blog.mongodb.org/post/137788967/32-bit-limitations
Thu Nov  1 00:21:37 **       with --journal, the limit is lower
Thu Nov  1 00:21:37
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 - 27017 by default
  --bind_ip arg               comma separated list of ip addresses to listen on
                              - all local ips by default
  --maxConns arg              max number of simultaneous connections - 20000 by
                              default
  --objcheck                  inspect client data for validity on receipt
  --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)
  --keyFile arg               private key for cluster authentication
  --nounixsocket              disable listening on unix sockets
  --unixSocketPrefix arg      alternative directory for UNIX domain sockets
                              (defaults to /tmp)
  --fork                      fork server process
  --syslog                    log to system's syslog facility instead of file
                              or stdout
  --auth                      run with security
  --cpu                       periodically show cpu and iowait utilization
  --dbpath arg                directory for datafiles - defaults to /data/db/
  --diaglog arg               0=off 1=W 2=R 3=both 7=W+some reads
  --directoryperdb            each database will be stored in a separate
                              directory
  --ipv6                      enable IPv6 support (disabled by default)
  --journal                   enable journaling
  --journalCommitInterval arg how often to group/batch commit (ms)
  --journalOptions arg        journal diagnostic options
  --jsonp                     allow JSONP access via http (has security
                              implications)
  --noauth                    run without security
  --nohttpinterface           disable http interface
  --nojournal                 disable journaling (journaling is on by default
                              for 64 bit)
  --noprealloc                disable data file preallocation - will often hurt
                              performance
  --noscripting               disable scripting engine
  --notablescan               do not allow table scans
  --nssize arg (=16)          .ns file size (in MB) for new databases
  --profile arg               0=off 1=slow, 2=all
  --quota                     limits each database to a certain number of files
                              (8 default)
  --quotaFiles arg            number of files allowed per db, requires --quota
  --repair                    run repair on all dbs
  --repairpath arg            root directory for repair files - defaults to
                              dbpath
  --rest                      turn on simple rest api
  --shutdown                  kill a running server (for init scripts)
  --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)
  --sysinfo                   print some diagnostic system information
  --upgrade                   upgrade db if needed

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:
  --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
  --autoresync          automatically resync if slave data is stale

Replica set options:
  --replSet arg           arg is <setname>[/<optionalseedhostlist>]
  --replIndexPrefetch arg specify index prefetching behavior (if secondary)
                          [none|_id_only|all]

Sharding options:
  --configsvr           declare this is a config db of a cluster; default port
                        27019; default dir /data/configdb
  --shardsvr            declare this is a shard db of a cluster; default port
                        27018
  --noMoveParanoia      turn off paranoid saving of data for moveChunk.  this
                        is on by default for now, but default will switch


3:、启动脚本


[root@NODEA opt]# ls
config  data  log  mongodb-linux-i686-2.2.0  start.sh  view.sh


config:配置文件

data:数据目录

log:日志

m...:m文件夹

start.sh:启动脚本


[root@NODEA opt]# cat config 
fork=true
dbpath=data
logpath=log/log.log
logappend=true
port=29999
journal=true
[root@NODEA opt]# cat start.sh 
mongod -f config
[root@NODEA opt]# 

注:别忘了把bin放入到path中哈



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值