王炸科技头像

centos下安装mongodb小纸条

来源:
       

  changetorootsu-##OR##sudo-iaddyumrepo/etc/yum.repos.d/10gen-mongodb.repo[10gen]name=10genRepositorybaseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686gpgcheck=0installmongodbyuminstallmongo-10genmongo-10changetoroot

  su-##OR##sudo-iaddyumrepo

  /etc/yum.repos.d/10gen-mongodb.repo[10gen]name=10genRepositorybaseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686gpgcheck=0installmongodb

  yuminstallmongo-10genmongo-10gen-serverConfigureMongoDB

  vi/etc/mongod.conflogpath=/var/log/mongo/mongod.logport=27017dbpath=/var/lib/mongoStartMongoDBServer

  servicemongodstart##OR##/etc/init.d/mongodstartStartMongoDBonboot

  chkconfig--levels235mongodonTestMongoDBServer

  mongousetestswitchedtodbtestdb.foo.find()db.foo.save({a:1})db.foo.find()OpenMongoDBPort(27017)onIptablesFirewall

  /etc/sysconfig/iptables-AINPUT-mstate--stateNEW-mtcp-ptcp--dport27017-jACCEPTRestartIptablesFirewall

  serviceiptablesrestart##OR##/etc/init.d/iptablesrestartTestremoteconnection

  mongoserver:port/database##Example##mongo10.0.10.45:27017/testnodejs

  cd~wgethttps://raw.github.com/isaacs/nave/master/nave.shchmod+xnave.sh./nave.shinstall0.10.21./nave.shuse0.10.21node-v

  原文地址:centos下安装mongodb小纸条,感谢原作者分享。