美文网首页
MongoDB Installation On CentOS7

MongoDB Installation On CentOS7

作者: dalianliyan | 来源:发表于2019-07-02 10:01 被阅读0次
    # add yum-source
    vim /etc/yum.repos.d/mongodb-org-4.0.repo
    i                       # into insert mode
    [Esc]                   # quit insert mode
    :wq                     # save file
    
    # mongodb-org-4.0.repo
    [mongodb-org-4.0]  
    name=MongoDB Repository  
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/  
    gpgcheck=1
    enabled=1
    gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
    
    # install mongodb
    yum install mongodb-org
    
    # remove yum-source
    rm -rf /etc/yum.repos.d/mongodb-org-4.0.repo
     
    # config mongodb
    vim /etc/mongod.conf
    bindIp: 127.0.0.1 ==> bindIp: 0.0.0.0
    
    # start mongo server
    systemctl enable mongod            # auto start while booting
    systemctl start mongod[.service]   # start mongo server
    systemctl stop mongod[.service] 
    systemctl status mongod[.service] 
    systemctl stop firewalld.service   # stop firewall
    systemctl disable firewalld.service # disable firewall while booting
    whereis mongod
    
    # start mongo client
    mongo
    # quit mongo client
    quit()
    # MongoDB的账号密码不是全局的, 而是每个库都要单独设置, 暂不设置
    

    相关文章

      网友评论

          本文标题:MongoDB Installation On CentOS7

          本文链接:https://www.haomeiwen.com/subject/gqhyxctx.html